diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 46d3163..0891f4b 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -3,10 +3,10 @@ on:
push:
branches:
- main
- pull_request:
+ pull_request:
branches:
- main
-permissions:
+permissions:
pull-requests: write #allow benchmark-action to comment on PRs
jobs:
build:
@@ -20,7 +20,18 @@ jobs:
uses: actions/setup-dotnet@v4
- name: Build & test
- run: dotnet test --configuration Release --report-github
+ run: >-
+ dotnet test --configuration Release --report-github --
+ --coverage --coverage-output-format cobertura
+ --coverage-output coverage.cobertura.xml
+ --results-directory ${{ github.workspace }}/coverage-results
+ - name: Upload coverage to Codecov
+ if: ${{ !cancelled() }}
+ uses: codecov/codecov-action@v5
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ files: ${{ github.workspace }}/coverage-results/coverage.cobertura.xml
+ fail_ci_if_error: false
- name: Download previous benchmark data
uses: actions/cache@v4
with:
@@ -28,11 +39,10 @@ jobs:
key: ${{ runner.os }}-benchmark
- name: Continuous Benchmark
uses: benchmark-action/github-action-benchmark@v1.20.4
- with:
+ with:
tool: benchmarkdotnet
output-file-path: src/artifacts/bin/SIL.Harmony.Tests/release/BenchmarkDotNet.Artifacts/results/SIL.Harmony.Tests.DataModelPerformanceBenchmarks-report-full-compressed.json
external-data-json-path: ./cache/benchmark-data.json
fail-on-alert: true
comment-on-alert: true
github-token: ${{ secrets.GITHUB_TOKEN }}
-
\ No newline at end of file
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 2217c19..549b010 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -12,6 +12,7 @@
+
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 0000000..8ec3603
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,12 @@
+# Codecov configuration
+# Coverage is published as status checks only; no PR comment.
+comment: false
+coverage:
+ status:
+ project:
+ default:
+ # report coverage as a check without blocking merges
+ informational: true
+ patch:
+ default:
+ informational: true
diff --git a/src/SIL.Harmony.Tests/SIL.Harmony.Tests.csproj b/src/SIL.Harmony.Tests/SIL.Harmony.Tests.csproj
index a53c443..575f837 100644
--- a/src/SIL.Harmony.Tests/SIL.Harmony.Tests.csproj
+++ b/src/SIL.Harmony.Tests/SIL.Harmony.Tests.csproj
@@ -17,6 +17,7 @@
+