Skip to content

Commit

Permalink
Update coverage-workflow.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Garima Ketan Chauhan authored and GitHub Enterprise committed Apr 2, 2025
1 parent 03d5807 commit be47f90
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions .github/workflows/coverage-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
name: Django Coverage Report
name: Test Coverage

on:
push:
branches:
- gargi-production
- main
pull_request:
branches:
- gargi-production

jobs:
coverage:
runs-on: self-hosted
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
- name: Check out code
uses: actions/checkout@v3

- name: Build test image
run: docker build -f tests/Dockerfile.test -t django-test-coverage-image .
working-directory: backend/

- name: Run Django tests with coverage
run: docker run django-test-coverage-image
working-directory: backend/
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Copy .coverage file
run: docker cp $(docker ps -aqf "ancestor=django-test-coverage-image"):/app/.coverage .
working-directory: backend/
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r backend/requirements.txt
- name: Generate HTML coverage report
run: coverage html
working-directory: backend/
- name: Run tests with coverage
working-directory: tests
run: |
docker build -t coverage-test -f Dockerfile.test .
docker run coverage-test
- name: Upload HTML coverage report
- name: Upload coverage results
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: backend/htmlcov/ # Adjusted path
name: coverage-results
path: tests/coverage.xml

0 comments on commit be47f90

Please sign in to comment.