Skip to content

Commit

Permalink
Split off CodeCov upload as independent action
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec committed Sep 14, 2023
1 parent 51243a5 commit 2ff511d
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 35 deletions.
24 changes: 6 additions & 18 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,15 @@ jobs:
uses: FedericoCarboni/setup-ffmpeg@v2 # v2.0.0

# Coverage.
- name: run coverage tests
- name: Run coverage tests
run: dotnet test Backend.Tests/Backend.Tests.csproj
shell: bash
- name: Upload coverage report
id: uploadCoverage
continue-on-error: true
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
- name: Upload coverage artifact
uses: actions/upload-artifact@v3
with:
files: Backend.Tests/coverage.cobertura.xml
flags: backend
name: Backend
fail_ci_if_error: true
- name: Upload coverage report - take 2 (if the first attempt fails)
if: steps.uploadCoverage.outcome == 'failure'
id: uploadCoverage2
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: Backend.Tests/coverage.cobertura.xml
flags: backend
name: Backend
fail_ci_if_error: true
name: coverage-backend
path: Backend.Tests/coverage.cobertura.xml
retention-days: 7

# Development build.
- run: dotnet build BackendFramework.sln
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/codecov_upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: codecov_upload

on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_run:
workflows: [backend, frontend]
types: completed

permissions:
contents: read

jobs:
upload_coverage:
runs-on: ubuntu-latest
steps:
- name: Download backend coverage artifact
uses: actions/download-artifact@v3
with:
name: coverage-backend
path: coverage.cobertura.xml
- name: Upload backend coverage report
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: coverage.cobertura.xml
flags: backend
name: Backend
- name: Download frontend coverage artifact
uses: actions/download-artifact@v3
with:
name: coverage-frontend
path: clover.xml
- name: Upload frontend coverage report
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: clover.xml
flags: frontend
name: Frontend
22 changes: 5 additions & 17 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,12 @@ jobs:
- run: npm run test-frontend:coverage
env:
CI: true
- name: Upload coverage report
id: uploadCoverage
continue-on-error: true
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
- name: Upload coverage artifact
uses: actions/upload-artifact@v3
with:
files: coverage/clover.xml
flags: frontend
name: Frontend
fail_ci_if_error: true
- name: Upload coverage report - take 2 (if the first attempt fails)
if: steps.uploadCoverage.outcome == 'failure'
id: uploadCoverage2
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: coverage/clover.xml
flags: frontend
name: Frontend
fail_ci_if_error: true
name: coverage-frontend
path: coverage/clover.xml
retention-days: 7

# Release build.
- run: npm run build
Expand Down

0 comments on commit 2ff511d

Please sign in to comment.