Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -20,19 +20,29 @@ 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
Comment on lines +28 to +34

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 3 \
  'codecov-action|upload-artifact|coverage\.cobertura\.xml|name: coverage|if-no-files-found|fail_ci_if_error' \
  .github/workflows/test.yaml

Repository: sillsdev/harmony

Length of output: 838


Add a required coverage GitHub artifact and fail when the report is missing.

codecov/codecov-action@v5 uploads coverage to Codecov and does not create a coverage GitHub Actions artifact. With fail_ci_if_error: false, the upload also does not fail the workflow when the Cobertura report is missing or invalid. Add an actions/upload-artifact step for ${{ github.workspace }}/coverage-results/coverage.cobertura.xml with name: coverage and if-no-files-found: error, or change the destination as required.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/test.yaml around lines 28 - 34, Add an
actions/upload-artifact step alongside the Codecov upload, targeting
coverage-results/coverage.cobertura.xml with artifact name coverage and
if-no-files-found set to error. Keep the existing Codecov upload behavior
unchanged unless needed to ensure the required artifact is created and missing
reports fail the workflow.

- name: Download previous benchmark data
uses: actions/cache@v4
with:
path: ./cache
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 }}

1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<PackageVersion Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.12" />
<!-- Transitively referenced by xunit.v3.mtp-v2; pinned so the MTP v2 runner resolves consistently. -->
<PackageVersion Include="Microsoft.Testing.Platform" Version="2.0.2" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.3.1" />
<PackageVersion Include="Nito.AsyncEx.Coordination" Version="5.1.2" />
<PackageVersion Include="System.IO.Hashing" Version="10.0.7" />
<PackageVersion Include="System.Linq.Async" Version="7.0.1" />
Expand Down
12 changes: 12 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions src/SIL.Harmony.Tests/SIL.Harmony.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<PackageReference Include="Verify.EntityFramework" />
<PackageReference Include="Verify.XunitV3" />
<PackageReference Include="xunit.v3.mtp-v2" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" />
<PackageReference Include="System.Linq.Async"/>
<PackageReference Include="linq2db" />
<PackageReference Include="linq2db.Extensions" />
Expand Down
Loading