diff --git a/.github/workflows/ci-run-tests.yml b/.github/workflows/ci-run-tests.yml index 0b74b313..34778102 100644 --- a/.github/workflows/ci-run-tests.yml +++ b/.github/workflows/ci-run-tests.yml @@ -31,4 +31,12 @@ jobs: run: docker run --name=memcached -d memcached:latest - name: Run tests - run: docker run -i --rm --name=app-test -u root --link=database --link=memcached -e DATABASE_URL="postgres://postgres:password@database/app" -e APP_SECRET_KEY=xxxx -e ENVIRONMENT=test app-test + run: | + set -x + docker run -i --rm --name=app-test -u root --link=database --link=memcached -e DATABASE_URL="postgres://postgres:password@database/app" -e APP_SECRET_KEY=xxxx -e ENVIRONMENT=test -v $(pwd)/coverage:/coverage app-test + cp coverage/.coverage coverage/coverage.xml ./ + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4-beta + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index e59cea6a..8d9db6e2 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,6 @@ node_modules *.log ietf/templates/base.html ietf/static/dist -docker/database/*.gz \ No newline at end of file +docker/database/*.gz +.coverage +coverage.xml diff --git a/docker/init-test.sh b/docker/init-test.sh index 112527b9..fe8432cf 100755 --- a/docker/init-test.sh +++ b/docker/init-test.sh @@ -3,5 +3,6 @@ python /app/manage.py migrate --no-input python /app/manage.py createcachetable python /app/manage.py collectstatic --no-input -pytest --cov +pytest --cov --cov-report=xml +if [ -d /coverage ]; then cp .coverage coverage.xml /coverage/; fi python /app/manage.py makemigrations --check --dry-run --no-input