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
5cca847
commit a194bb5
Showing
1 changed file
with
29 additions
and
25 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,31 +1,35 @@ | ||
| name: Backend Test Coverage | ||
| name: coverage-report | ||
|
|
||
| on: [push, pull_request] | ||
| on: | ||
| push: | ||
| branches: | ||
| - gargi-production | ||
| pull_request: | ||
| branches: | ||
| - gargi-production | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: self-hosted | ||
| defaults: | ||
| run: | ||
| working-directory: ./secfit/backend | ||
| runs-on: self-hosted # Runs on your self-hosted runner | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Build test image | ||
| run: docker build -f tests/Dockerfile.test -t backend-test . | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| docker run --name test-runner backend-test | ||
| docker cp test-runner:/app/coverage.xml . | ||
| docker cp test-runner:/app/htmlcov/ . | ||
| docker rm test-runner | ||
| - name: Upload coverage | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: coverage-report | ||
| path: | | ||
| secfit/backend/coverage.xml | ||
| secfit/backend/htmlcov/ | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Build test container | ||
| run: docker build -t secfit-backend-test -f backend/tests/dockerfile.test . | ||
|
|
||
| - 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 |