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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
if: github.event_name != 'merge_group'
permissions:
contents: read
code-quality: write
pull-requests: read
uses: ./.github/workflows/reusable-coverage.yml
secrets:
codecov-token: ${{ secrets.CODECOV_UPLOAD_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: dotnet build -c Release --no-restore

- name: Test
run: dotnet test -c Release --no-build --report-github --ignore-exit-code 8
run: dotnet test -c Release --no-build --report-gh --ignore-exit-code 8

- name: aot-publish test
run: dotnet publish ./samples/AspNetCore/Samples.AspNetCore.csproj
32 changes: 31 additions & 1 deletion .github/workflows/reusable-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:

permissions:
contents: read
pull-requests: read
code-quality: write

strategy:
matrix:
Expand All @@ -25,13 +27,15 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
# Check out the PR head commit (not the merge commit) so coverage line numbers map to the diff
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false

- name: Setup .NET
uses: ./.github/actions/setup-dotnet

- name: Run Test
run: dotnet test --coverlet --coverlet-output-format opencover --coverlet-exclude "[GitHubActionsTestLogger*]*" --ignore-exit-code 8
run: dotnet test --coverlet --coverlet-output-format opencover cobertura --ignore-exit-code 8
Comment thread
askpt marked this conversation as resolved.

# Keep globbing on non-Windows runners (works today)
- name: Upload coverage to Codecov (non-Windows)
Expand Down Expand Up @@ -69,3 +73,29 @@ jobs:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.codecov-token }}

# GitHub's code coverage API takes a single Cobertura file, so merge the per-project/per-TFM reports.
# Paths are rewritten to be repository-relative so coverage maps onto the files in the diff.
- name: Merge Cobertura reports (Linux)
if: runner.os == 'Linux'
run: |
dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.5.11
export PATH="$PATH:$HOME/.dotnet/tools"
reportgenerator \
-reports:"**/coverage.cobertura.*.xml" \
-targetdir:"coverage-report" \
-reporttypes:Cobertura \
-filefilters:"-**/obj/**"
sed -i -e "s#${GITHUB_WORKSPACE}/##g" \
-e "s#<source>[^<]*</source>#<source>.</source>#g" \
coverage-report/Cobertura.xml

- name: Upload coverage to GitHub (Linux)
if: runner.os == 'Linux'
uses: actions/upload-code-coverage@1c15be36fc3733ba839b1dd643bd9556e4426dc1 # v1.4.1
with:
file: coverage-report/Cobertura.xml
language: C#
label: code-coverage/coverlet
# Best effort: a coverage-service outage must never block CI. Codecov remains the gate.
fail-on-error: false
2 changes: 1 addition & 1 deletion .github/workflows/reusable-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
run: cp spec/specification/assets/gherkin/*.feature test/OpenFeature.E2ETests/Features/

- name: Run Tests
run: dotnet test test/OpenFeature.E2ETests/ --configuration Release --report-github
run: dotnet test test/OpenFeature.E2ETests/ --configuration Release --report-gh
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ dotnet test test/OpenFeature.Tests/
To run unit tests with code coverage execute:

```bash
dotnet test test/OpenFeature.Tests/ --coverlet --coverlet-output-format opencover
dotnet test test/OpenFeature.Tests/ --coverlet --coverlet-output-format opencover cobertura
```

#### E2E tests
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
<PackageVersion Include="AutoFixture" Version="5.0.0-rc.1" />
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
<PackageVersion Include="coverlet.MTP" Version="10.0.1" />
<PackageVersion Include="GitHubActionsTestLogger" Version="3.0.5" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Testing" Version="10.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="$(MicrosoftExtensionsVersion)" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.8.1" />
<PackageVersion Include="Microsoft.Testing.Extensions.GitHubActionsReport" Version="1.0.0-alpha.26377.5" />
<PackageVersion Include="NSubstitute" Version="6.0.0" />
<PackageVersion Include="OpenTelemetry" Version="1.17.0" />
<PackageVersion Include="OpenTelemetry.Exporter.InMemory" Version="1.17.0" />
Expand Down
4 changes: 2 additions & 2 deletions build/Common.tests.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<Using Include="Reqnroll" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" />
<ItemGroup Condition="$(MSBuildProjectName.EndsWith('Tests'))">
<PackageReference Include="Microsoft.Testing.Extensions.GitHubActionsReport" />
</ItemGroup>

<!-- Stops warning to use the .ConfigureAwait method. Tests should configure the await context as opposed to library code -->
Expand Down