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
5756eef
commit 5cca847
Showing
1 changed file
with
17 additions
and
38 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,52 +1,31 @@ | ||
| name: Backend Test with Coverage | ||
| name: Backend Test Coverage | ||
|
|
||
| on: | ||
| push: | ||
| branches: gargi-production | ||
| pull_request: | ||
| branches: gargi-production | ||
| on: [push, pull_request] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: self-hosted | ||
| defaults: | ||
| run: | ||
| working-directory: ./backend | ||
| working-directory: ./secfit/backend | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
|
|
||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Build test image | ||
| run: docker build -f tests/Dockerfile.test -t backend-test . | ||
|
|
||
| - name: Run tests with coverage | ||
| id: coverage | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| docker run --name test-container backend-test | ||
| docker cp test-container:/app/coverage.xml . || echo "No coverage.xml found" | ||
| docker cp test-container:/app/htmlcov ./htmlcov || echo "No htmlcov found" | ||
| docker rm test-container | ||
| - name: Upload coverage report (XML) | ||
| if: always() && steps.coverage.outcome == 'success' | ||
| 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-xml | ||
| path: backend/coverage.xml | ||
|
|
||
| - name: Upload HTML coverage report | ||
| if: always() && steps.coverage.outcome == 'success' | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: coverage-html | ||
| path: backend/htmlcov/ | ||
|
|
||
| - name: Upload to Codecov | ||
| if: always() && steps.coverage.outcome == 'success' | ||
| uses: codecov/codecov-action@v3 | ||
| with: | ||
| file: backend/coverage.xml | ||
| name: coverage-report | ||
| path: | | ||
| secfit/backend/coverage.xml | ||
| secfit/backend/htmlcov/ |