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 8f71086 commit 7eaf876
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions .github/workflows/coverage-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
name: Coverage Report Workflow
name: Run Tests with Coverage

on:
push:
branches:
- gargi-production # Adjust the branch name as needed
- gargi-production # Trigger only for the gargi-production branch
pull_request:
branches:
- gargi-production # Trigger for PRs targeting gargi-production branch

jobs:
build:
runs-on: self-hosted # You can change this to 'ubuntu-latest' if you're not using a self-hosted runner
test:
runs-on: self-hosted # Use self-hosted runner

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build Docker image
run: |
docker build --dns=8.8.8.8 -t secfit-backend-test -f backend/tests/dockerfile.test backend/tests
- name: Run tests with coverage
run: |
docker run --rm secfit-backend-test python manage.py test --coverage
- name: Upload Coverage Report
uses: codecov/codecov-action@v3
with:
file: coverage.xml # Ensure your coverage tool generates this report
name: coverage-report
flags: coverage
fail_ci_if_error: true
- name: Checkout repository
uses: actions/checkout@v3 # Checkout the code from the repository

- name: Set up Docker
uses: docker/setup-buildx-action@v2 # Set up Docker buildx to build Docker images

- name: Build Docker image for tests
run: docker build -f backend/tests/Dockerfile.test -t test-image .

- name: Run tests with coverage
run: docker run --rm test-image # Run the Docker container to execute the tests with coverage

- name: Upload coverage report
uses: codecov/codecov-action@v3 # Upload coverage report to Codecov
with:
file: coverage.xml # Specify the coverage file path

0 comments on commit 7eaf876

Please sign in to comment.