Skip to content

Commit

Permalink
Merge pull request #571 from UW-GAC/maint/parallel-tests
Browse files Browse the repository at this point in the history
Parallelize tests for CI
  • Loading branch information
amstilp authored May 7, 2024
2 parents 9fd621a + aefc3c5 commit 9ca6a24
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,18 @@ jobs:
run: python manage.py collectstatic --noinput --settings=config.settings.test

- name: Run tests
run: coverage run -p -m pytest
run: |
pytest --cov=primed -n auto
mv .coverage .coverage-${{ strategy.job-index }}
- name: List files for debugging purposes
run: ls -lhta

- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ strategy.job-index }}
path: .coverage.*
path: .coverage-${{ strategy.job-index }}

coverage:
needs:
Expand All @@ -111,13 +116,14 @@ jobs:

- name: Merge coverage files
run: |
mv ./artifacts/coverage-data*/.coverage* .
python -m coverage combine ./artifacts/coverage-data*/.coverage-*
python -m coverage xml
ls -la .coverage*
- name: Combine coverage data
- name: Report coverage
run: |
python -m coverage combine
python -m coverage xml
python -m coverage report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
Expand Down
4 changes: 4 additions & 0 deletions requirements/test-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

# Pytest
pytest # https://github.com/pytest-dev/pytest
# Parallelized tests
pytest-xdist # https://github.com/pytest-dev/pytest-xdist
# Coverage integrated with pytest
pytest-cov
# Pytest improvements - progress bar, etc.
pytest-sugar # https://github.com/Frozenball/pytest-sugar
# Mock HTTP responses
Expand Down
6 changes: 6 additions & 0 deletions requirements/test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ django-test-migrations==1.3.0
# via -r requirements/test-requirements.in
exceptiongroup==1.2.0
# via pytest
execnet==2.1.1
# via pytest-xdist
factory-boy==3.3.0
# via -r requirements/test-requirements.in
faker==23.2.1
Expand Down Expand Up @@ -55,10 +57,14 @@ pytest==8.2.0
# -r requirements/test-requirements.in
# pytest-django
# pytest-sugar
pytest-cov==5.0.0
# via -r requirements/test-requirements.in
pytest-django==4.8.0
# via -r requirements/test-requirements.in
pytest-sugar==1.0.0
# via -r requirements/test-requirements.in
pytest-xdist==3.6.1
# via -r requirements/test-requirements.in
python-dateutil==2.8.2
# via
# -c requirements/requirements.txt
Expand Down

0 comments on commit 9ca6a24

Please sign in to comment.