From adb924e063828922c04c6ed0ecd72e74d3c1ac60 Mon Sep 17 00:00:00 2001 From: Moritz Mahringer Date: Mon, 13 Sep 2021 15:46:21 +0200 Subject: [PATCH] Explicitly invoke unit test docker --- .github/workflows/ci.yml | 39 +++++++++++++++++++-------------------- Dockerfile | 3 +++ 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5ca3032..8cf1f324 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,38 +97,37 @@ jobs: needs: - build - container: - image: mormahr/pdf-service:sha-${{ github.sha }}-testing - options: --user pdf_service_user - steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Run tests run: | - cd /usr/src/app - python -m pytest \ - -rA \ - --cov=pdf_service \ - --cov-report term \ - --cov-report html:coverage/cov_html \ - --cov-report xml:coverage/cov.xml \ - --cov-report annotate:coverage/cov_annotate - - - uses: actions/upload-artifact@v2 - if: ${{ failure() }} - with: - name: Generated test images - path: /usr/src/app/test-data/*.png + mkdir coverage + chown 1001 coverage + + docker run \ + --rm \ + --user pdf_service_user \ + -v "$(pwd)/coverage:/usr/src/app/coverage/" \ + mormahr/pdf-service:sha-${{ github.sha }}-testing \ + python -m pytest \ + -rA \ + --cov=pdf_service \ + --cov-report term \ + --cov-report html:coverage/cov_html \ + --cov-report xml:coverage/cov.xml \ + --cov-report annotate:coverage/cov_annotate - name: Upload coverage report uses: codecov/codecov-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} - files: /usr/src/app/coverage/cov.xml + files: coverage/cov.xml flags: unit name: unit fail_ci_if_error: true verbose: true - root_dir: /usr/src/app test-e2e: runs-on: ubuntu-20.04 diff --git a/Dockerfile b/Dockerfile index 4b15272d..09b3cd38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -77,6 +77,9 @@ ADD requirements-dev.txt . RUN pip install --user --no-cache-dir -r requirements-dev.txt +RUN mkdir -p /usr/src/app/coverage +VOLUME /usr/src/app/coverage + COPY . . ARG GITHUB_SHA