Skip to content

Merge pull request #179 from filzrev/chore-modify-nuget-bench-conditions #59

Merge pull request #179 from filzrev/chore-modify-nuget-bench-conditions

Merge pull request #179 from filzrev/chore-modify-nuget-bench-conditions #59

Workflow file for this run

name: Build-Debug
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
jobs:
build-dotnet:
strategy:
matrix:
os: [ubuntu-24.04, windows-2025]
permissions:
contents: read
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: Cysharp/Actions/.github/actions/checkout@main
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
- run: dotnet build -c Release
- run: dotnet test -c Release --no-build
- run: dotnet build -c Release tests/System.Linq.Tests/System.Linq.Tests.slnx
- run: dotnet test -c Release tests/System.Linq.Tests/System.Linq.Tests.slnx --no-build
check-codecov-token:
permissions:
contents: read
runs-on: ubuntu-24.04
timeout-minutes: 10
outputs:
run_codecoverage: ${{ steps.check-token.outputs.token_exists }}
steps:
- id: check-token
shell: pwsh
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
if(![string]::IsNullOrEmpty($env:CODECOV_TOKEN))
{
echo "token_exists=true" >> $env:GITHUB_OUTPUT
}
else
{
echo "token_exists=false" >> $env:GITHUB_OUTPUT
}
code-coverage:
if: ${{ needs.check-codecov-token.outputs.run_codecoverage == 'true' }} # secrets can't referenced in `if` so it needs separate job.
needs: check-codecov-token
permissions:
contents: read
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: Cysharp/Actions/.github/actions/checkout@main
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
- run: |
dotnet build -c Release
dotnet build -c Release tests/System.Linq.Tests/System.Linq.Tests.slnx
- name: Enable diagnostics (It's disabled by `Cysharp/Actions/.github/actions/setup-dotnet`)
run: echo "COMPlus_EnableDiagnostics=1" >> $GITHUB_ENV
- name: Install `dotnet-coverage` tool
run: dotnet tool install -g dotnet-coverage
- name: Collect code coverage
shell: pwsh
working-directory: tests
run: |
$PSNativeCommandUseErrorActionPreference = $true
$sessionId = 'ZLinq'
dotnet coverage collect --session-id $sessionId --nologo --settings codecoverage.runsettings --server-mode --background
try
{
dotnet coverage connect $sessionId --nologo "dotnet test ../ -c Release --framework net9.0 --no-build"
dotnet coverage connect $sessionId --nologo "dotnet test -c Release System.Linq.Tests/System.Linq.Tests.slnx --framework net9.0 --no-build"
}
finally
{
dotnet coverage shutdown $sessionId --nologo --timeout 60000
}
# Upload coverage data to CodeCov
- uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
with:
fail_ci_if_error: false
files: tests/TestResults/coverage.cobertura.xml
token: ${{ secrets.CODECOV_TOKEN }}