question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add documentation on matrix build, only upload coverage once

See original GitHub issue

When testing in a matrix, uploads often fail after the first one. I’m testing against different versions of Python, and I only need to upload the coverage information once, by including

if: matrix.python-version == 3.8

in the codecov job. It took me a while to figure this out, so maybe it is nice to include this in the readme.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
zhuanyan-wangcommented, Nov 9, 2020

Multiple Node.js and multiple OS

Expand on what @jhidding and @rfgamaral have said. If you are testing on multiple Node.js versions and multiple OS at the same time, something like this will work:

strategy:
  matrix:
    os: [ubuntu-latest, windows-latest, macos-latest]
    node-version: [10.x, 12.x, 14.x]

runs-on: ${{ matrix.os }}

steps:
  - name: Post Coverage
    uses: codecov/codecov-action@v1
    if: matrix.os == 'ubuntu-latest' && matrix.node-version == '10.x'

This posts the coverage reports to Codecov, only when the OS is ubuntu-latest and the Node.js version is 10.x. Just change if: matrix.os == 'ubuntu-latest' && matrix.node-version == '10.x' based on your own setup.

Result

The Post Coverage is skipped when the OS or the Node.js version does not match:

Annotation 2020-07-05 183237

Two subdirectories Default and Container have posted their reports once only (otherwise there will be 12 builds here):

Annotation 2020-07-05 183211

5reactions
rfgamaralcommented, Jan 24, 2020

I’ve started using Codecov with GitHub Actions (on this test project for now) and I’m wondering what’s the best practice for matrix builds!?

This particular project tests the code against 3 different Node.js version and with my current workflow I’m uploading 3 different coverage reports (but they are always the same):

image

This doesn’t make much sense to me. Ideally, only one coverage report would be uploaded.

Now, I understand I can add an if statement to the upload step like @jhidding mentioned in the original post, but somehow that feels like a hacky solution.

What is the recommended best practice to upload the coverage report only once independently of the number of jobs due to matrix configurations in GitHub actions?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generating test coverage reports only once within a GitHub ...
I want to generate a code coverage report for my tests, but only for a single matrix item. Here is a copy of...
Read more >
Requirements Module in HP ALM (Quality Center) Tutorial
In this tutorial, we create Requirement, Upload Requirement using Microsoft Excel and generate coverage analysis and traceability Matrix.
Read more >
How to Ditch Codecov for Python Projects - Hynek Schlawack
I have found a way to enforce coverage over a whole GitHub Actions build matrix that doesn't rely on third-party services. Coverage.py has...
Read more >
How to Generate a Code Coverage Report with CodeCov and ...
Hpw tp create a project and generate a coverage report · Step 1: Create a directory and navigate to it · Step 2:...
Read more >
Traceability and Test Coverage in TestRail
How do you create a traceability report in TestRail? ... What is a Requirements Traceability Matrix (“RTM”)?; How to start tracking ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found