Skip to content

Commit

Permalink
feat: Upload coverage reports to Codecov (#340)
Browse files Browse the repository at this point in the history
* Send coverage report to Codecov

* Generate XML coverage

---------

Co-authored-by: Alex Morega <alex.morega@torchbox.com>
  • Loading branch information
mgax and mgax authored Nov 9, 2023
1 parent bd1ee93 commit 07494e5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/ci-run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ node_modules
*.log
ietf/templates/base.html
ietf/static/dist
docker/database/*.gz
docker/database/*.gz
.coverage
coverage.xml
3 changes: 2 additions & 1 deletion docker/init-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 07494e5

Please sign in to comment.