Skip to content

Commit

Permalink
Update coverage-workflow.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Garima Ketan Chauhan authored and GitHub Enterprise committed Apr 2, 2025
1 parent 4d4d4fb commit e174609
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/coverage-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ on:

jobs:
test:
runs-on: self-hosted
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend # All commands run from here
working-directory: ./backend

steps:
- name: Checkout code
Expand All @@ -27,21 +27,26 @@ jobs:
id: coverage
run: |
docker run --name test-container backend-test
# Copy coverage files to backend/ directory
docker cp test-container:/app/coverage.xml . || true
docker cp test-container:/app/htmlcov ./htmlcov || true
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'
uses: actions/upload-artifact@v3
with:
name: coverage-xml
path: backend/coverage.xml
if: always() && exists('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/
if: always() && exists('backend/htmlcov')

- name: Upload to Codecov
if: always() && steps.coverage.outcome == 'success'
uses: codecov/codecov-action@v3
with:
file: backend/coverage.xml

0 comments on commit e174609

Please sign in to comment.