Skip to content

Commit

Permalink
Fix running tests with/without coverage (#5309)
Browse files Browse the repository at this point in the history
Apparently the `!` operator does not exist in GitHub Actions.

Also fix coverage upload.
  • Loading branch information
snejus committed Jun 15, 2024
2 parents bbb9aad + 30d345d commit 494c676
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,38 @@ jobs:
- name: Install Python dependencies
run: poetry install --only=main,test

- if: ${{ ! env.IS_MAIN_PYTHON }}
- if: ${{ env.IS_MAIN_PYTHON != 'true' }}
name: Test without coverage
run: poe test --no-cov

- if: ${{ env.IS_MAIN_PYTHON }}
- if: ${{ env.IS_MAIN_PYTHON == 'true' }}
name: Test with coverage
uses: liskin/gh-problem-matcher-wrap@v3
with:
linters: pytest
run: poe test

- if: ${{ env.IS_MAIN_PYTHON }}
name: Upload code coverage
continue-on-error: true
run: poetry run codecov
- if: ${{ env.IS_MAIN_PYTHON == 'true' }}
name: Store the coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: .reports/coverage.xml

upload-coverage:
name: Upload coverage report
needs: test
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Get the coverage report
uses: actions/download-artifact@v4
with:
name: coverage-report

- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
use_oidc: true

0 comments on commit 494c676

Please sign in to comment.