Parallelize pytest #360

This commit is contained in:
Daniel Grams 2022-01-13 22:35:33 +01:00
parent d7c8bbbea9
commit d687cffa6b

View File

@ -10,6 +10,9 @@ jobs:
integration-tests:
# Containers must run in Linux based operating systems
runs-on: ubuntu-latest
strategy:
matrix:
group: [1, 2, 3, 4]
# Service containers to run with `container-job`
services:
@ -47,12 +50,43 @@ jobs:
pip install -r requirements.txt
- name: Run tests
run: pytest --cov=project
run: pytest --cov=project --splits 4 --group ${{ matrix.group }}
env:
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/gsevpt_tests
- name: Codecov
- name: Upload coverage
uses: actions/upload-artifact@v2
with:
name: coverage${{ matrix.group }}
path: .coverage
coverage:
needs: integration-tests
if: ${{ success() }}
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
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: Combine coverage files
run: coverage combine coverage*/.coverage*
- name: Codecov
uses: codecov/codecov-action@v1
with:
verbose: true