Skip to content

Commit

Permalink
ci(i): Upload code coverage even if some matrix jobs fail (sourcenetw…
Browse files Browse the repository at this point in the history
…ork#2089)

## Relevant issue(s)

Resolves sourcenetwork#2088 

## Description
- Enable uploading whatever coverage reports we have (even if a matrix
job failed).
- Don't upload coverage reports if manually canceled the workflow/jobs.
- Fix coverage reports that were overwritten because of OS name clashing
(was uploading only 18 artifacts instead of 20).
- Increase retention period to 7 days, for the coverage reports.


For example:
Currently windows build is flaky, and on a windows build failure it
doesn't upload any code coverage reports to codecov.
Before this PR the coverage upload job skips:
https://github.com/sourcenetwork/defradb/actions/runs/7016532008/job/19088626645

## Testing

### One Fail so 19 artifacts + Upload successful:
Here is a test run to see this working in action:
https://github.com/sourcenetwork/defradb/actions/runs/7018970859/attempts/1?pr=2089pr%3D2089
Note: even with 1 failure the build still uploads the report and the
total artifact count is 19 (-1 due to windows failure).


### Passed with 20 artifacts + Upload successful:
https://github.com/sourcenetwork/defradb/actions/runs/7018970859
  • Loading branch information
shahzadlone authored Nov 28, 2023
1 parent c721bcb commit 16b66ea
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/test-and-upload-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,23 @@ jobs:
if: ${{ !matrix.detect-changes }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.client-type }}_${{ matrix.database-type }}_${{ matrix.mutation-type }}
name: ${{ matrix.os }}_${{ matrix.client-type }}_${{ matrix.database-type }}_${{ matrix.mutation-type }}
path: coverage.txt
if-no-files-found: error
retention-days: 1
retention-days: 7

upload-coverage:
name: Upload test code coverage job

runs-on: ubuntu-latest

needs: run-tests

# Important to know:
# - We didn't use `if: always()` here, so this job doesn't run if we manually canceled.
# - `if: success()` is always implied unless `always()` or `failure()` is specified.
if: success() || failure()

runs-on: ubuntu-latest

steps:
- name: Checkout code into the directory
uses: actions/checkout@v3
Expand Down

0 comments on commit 16b66ea

Please sign in to comment.