Skip to content

Commit

Permalink
add coverage to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lbluque committed Oct 22, 2024
1 parent 27c844d commit 422375c
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
matrix:
config:
- python: "3.9"
- python: "3.10"
- python: "3.11"

split: [1, 2, 3, 4, 5, 6, 7, 8]
Expand Down Expand Up @@ -58,10 +57,37 @@ jobs:
- name: Test with pytest
run: |
pytest --splits 8 --group ${{ matrix.split }} --durations-path tests/.test_durations tests
pytest --cov=smol --splits 8 --group ${{ matrix.split }} --durations-path tests/.test_durations tests
- if: ${{ matrix.config.python == '3.11' && github.event_name == 'push' }}
name: codacy-coverage-reporter
- name: Upload coverage
if: ${{ matrix.config.python == '3.11' && github.event_name == 'push' }}
uses: actions/upload-artifact@v4
with:
name: coverage${{ matrix.group }}
path: .coverage

coverage:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install deps
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Download all artifacts
# Downloads coverage1, coverage2, etc.
uses: actions/download-artifact@v2
- name: Run coverage
run: |
coverage combine coverage*/.coverage*
coverage report --fail-under=100
coverage xml
- name: codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
Expand Down

0 comments on commit 422375c

Please sign in to comment.