Skip to content

Commit

Permalink
chore: replace codecov (#1222)
Browse files Browse the repository at this point in the history
  • Loading branch information
latonz authored Apr 8, 2024
1 parent d6cfd93 commit e3f991d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 23 deletions.
11 changes: 0 additions & 11 deletions .codecov/codecov.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ on:
jobs:
test:
uses: ./.github/workflows/test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

release-preview:
if: ${{ inputs.create_preview_release }}
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/release-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
jobs:
test:
uses: ./.github/workflows/test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

release:
needs: test
Expand Down
38 changes: 31 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,60 @@ name: test

on:
workflow_call:
secrets:
CODECOV_TOKEN:
required: false
pull_request:
branches:
- '**'
push:
branches:
- main
# run on the first day of each month
# since the coverage artifacts will expire after 35d
schedule:
- cron: '0 0 1 * *'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
# needed to write the coverage PR comment
pull-requests: write

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true

jobs:
test:
runs-on: ubuntu-latest
permissions:
# needed to write the coverage PR comment
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- run: dotnet build /p:TreatWarningsAsErrors=true
- run: dotnet test --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- uses: codecov/codecov-action@v4
- run: dotnet test --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
- uses: danielpalme/ReportGenerator-GitHub-Action@5
with:
reports: 'test/**/*cobertura.xml'
reporttypes: 'Cobertura'
targetdir: '${{ github.workspace }}'
- uses: clearlyip/code-coverage-report-action@v4
id: code_coverage_report_action
# dont run for dependabot
if: ${{ github.actor != 'dependabot[bot]'}}
with:
filename: 'Cobertura.xml'
fail_on_negative_difference: true
negative_difference_threshold: 5
overall_coverage_fail_threshold: 75
retention_days: 35
- uses: marocchino/sticky-pull-request-comment@v2
if: steps.code_coverage_report_action.outputs.file != '' && github.event_name == 'pull_request' && (success() || failure())
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
recreate: true
path: code-coverage-results.md
package:
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ obj/
# dot user settings
*.DotSettings.user

# Visual Studio code coverage results
# code coverage results
*.coverage
*.coveragexml
coverage.cobertura.xml

0 comments on commit e3f991d

Please sign in to comment.