From d687cffa6b0460fea714114cec3645b6a7bfd935 Mon Sep 17 00:00:00 2001 From: Daniel Grams Date: Thu, 13 Jan 2022 22:35:33 +0100 Subject: [PATCH] Parallelize pytest #360 --- .github/workflows/test.yml | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e5f18ef..b9eaf73 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: 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 - if: ${{ success() }} uses: codecov/codecov-action@v1 with: verbose: true