Update coverage-workflow.yml #44
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
| name: Run Tests with Coverage | |
| on: | |
| push: | |
| branches: | |
| - gargi-production # Trigger only for the gargi-production branch | |
| pull_request: | |
| branches: | |
| - gargi-production # Trigger for PRs targeting gargi-production branch | |
| jobs: | |
| test: | |
| runs-on: self-hosted # Use self-hosted runner | |
| steps: | |
| - 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: Debug current directory and files | |
| run: | | |
| pwd | |
| ls -alh | |
| working-directory: backend/tests # Check the directory and files in backend/tests | |
| - name: Build Docker image for tests | |
| run: | | |
| cd backend/tests | |
| docker build -f Dockerfile.test -t test-image . | |
| - name: Run tests with coverage | |
| run: | | |
| cd backend/tests | |
| docker run --rm test-image | |
| - name: Upload coverage report | |
| uses: codecov/codecov-action@v3 # Upload coverage report to Codecov | |
| with: | |
| file: backend/tests/coverage.xml # Specify the coverage file path |