Skip to content

Commit

Permalink
ci: Add coverage badge generation and push to separate branch only fo…
Browse files Browse the repository at this point in the history
…r main & develop
  • Loading branch information
drikusroor committed Dec 7, 2023
1 parent 48a6bc8 commit 3016fcd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ jobs:
run: sudo docker-compose --env-file .env-github-actions run server bash -c "coverage run manage.py test"
- name: Generate Backend Coverage Report (Inline)
run: sudo docker-compose --env-file .env-github-actions run server bash -c "coverage report"
- name: Generate Backend Coverage Report (XML)

# Generate coverage badge (only for main and develop branches)
- name: Generate Backend Coverage Report (XML) and Badge
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
run: |
sudo docker-compose --env-file .env-github-actions run server bash -c "coverage xml"
sudo docker-compose --env-file .env-github-actions run server bash -c "genbadge coverage -i coverage.xml -o coverage-backend-badge-new.svg -n \"Backend Code Coverage\""
# Push coverage badge to separate branch (only for main and develop branches)
- name: Push Backend Coverage Badge to separate branch
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
run: |
if git ls-remote --heads origin code-coverage-badges; then
git fetch origin code-coverage-badges
Expand Down

0 comments on commit 3016fcd

Please sign in to comment.