Skip to content

docs: Add backend code coverage badge #910

docs: Add backend code coverage badge

docs: Add backend code coverage badge #910

Workflow file for this run

name: Test suite
on:
push:
jobs:
backend-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Backend Tests
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)
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\""
- name: Push Backend Coverage Badge to separate branch
run: |
if git ls-remote --heads origin code-coverage-badges; then
git fetch origin code-coverage-badges
git checkout code-coverage-badges
else
git checkout -b code-coverage-badges
git push origin code-coverage-badges
fi
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
rm backend/coverage-backend-badge.svg -f
mv backend/coverage-backend-badge-new.svg backend/coverage-backend-badge.svg
git add backend/coverage-backend-badge.svg
git commit -m "Add backend coverage badge for commit $GITHUB_SHA"
git push origin code-coverage-badges
frontend-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Frontend Tests
run: sudo docker-compose --env-file .env-github-actions run client yarn test --watchAll=false