diff options
-rw-r--r-- | .github/workflows/test.yaml | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2476e55..350142d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -30,11 +30,6 @@ jobs: # Needed for the Docker Compose file. - name: Checkout code uses: actions/checkout@v2 - - - name: Start container - run: | - export IMAGE_SUFFIX='-venv:${{ inputs.tag }}' - docker-compose up --no-build -d # endregion # Memory limit tests would fail if this isn't disabled. @@ -45,9 +40,12 @@ jobs: # Suffix the generated coverage datafile with the name of the runner's OS. - name: Run tests id: run_tests - run: >- - docker exec -e COVERAGE_DATAFILE=.coverage.${{ matrix.os }} snekbox_dev /bin/bash -c - 'coverage run -m unittest' + run: | + export IMAGE_SUFFIX='-venv:${{ inputs.tag }}' + docker-compose run \ + --rm -T -e COVERAGE_DATAFILE=.coverage.${{ matrix.os }} \ + snekbox \ + coverage run -m unittest # Upload it so the coverage from all matrix jobs can be combined later. - name: Upload coverage data @@ -57,6 +55,14 @@ jobs: path: .coverage.* retention-days: 1 + # Self-hosted runner needs containers, images, networks, volumes, etc. + # removed because they persist across runs and may interfere. + - name: Docker cleanup + if: matrix.os == 'self-hosted' && always() + run: | + export IMAGE_SUFFIX='-venv:${{ inputs.tag }}' + docker-compose down --rmi all --remove-orphans -v -t 0 + report: name: Combine and report coverage data runs-on: ubuntu-20.04 |