forked from mathialm/secfit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Garima Ketan Chauhan
authored and
GitHub Enterprise
committed
Apr 2, 2025
1 parent
110a3a3
commit e466591
Showing
1 changed file
with
24 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,43 +1,33 @@ | ||
| name: coverage-report | ||
| name: Coverage Report Workflow | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - gargi-production | ||
| pull_request: | ||
| branches: | ||
| - gargi-production | ||
| - gargi-production # Adjust the branch name as needed | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: self-hosted # Use self-hosted runner if needed | ||
| build: | ||
| runs-on: self-hosted # You can change this to 'ubuntu-latest' if you're not using a self-hosted runner | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - 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: Debug List directory contents | ||
| run: | | ||
| echo "Listing contents of backend/tests/" | ||
| ls -la backend/tests/ | ||
| - name: Build test container | ||
| run: | | ||
| docker build -t secfit-backend-test -f backend/tests/Dockerfile.test backend/tests | ||
| # The build context is set to the backend/tests folder | ||
|
|
||
| - name: Run tests and generate coverage report | ||
| run: | | ||
| docker run --rm --name secfit-backend-test secfit-backend-test | ||
| - name: Copy coverage report from container | ||
| run: | | ||
| docker create --name temp_container secfit-backend-test | ||
| docker cp temp_container:/app/htmlcov . || echo "No coverage report found" | ||
| docker rm temp_container | ||
| - name: Upload coverage report | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-report | ||
| path: htmlcov | ||
| - 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 |