Update coverage-workflow.yml #43
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: Build Docker image for tests | ||
| run: docker build -f Dockerfile.test -t test-image . | ||
| working-directory: backend/tests # Set the working directory to backend/tests | ||
| - name: Run tests with coverage | ||
| run: docker run --rm test-image # Run the Docker container to execute the tests with coverage | ||
| working-directory: backend/tests # Set the working directory to backend/tests | ||
| - name: Upload coverage report | ||
| uses: codecov/codecov-action@v3 # Upload coverage report to Codecov | ||
| with: | ||
| file: coverage.xml # Specify the coverage file path | ||
| working-directory: backend/tests # Set the working directory to backend/tests | ||