Skip to content

refactor(metrics): align with dotnet/runtime#124140 Observable instruments proposal #552

refactor(metrics): align with dotnet/runtime#124140 Observable instruments proposal

refactor(metrics): align with dotnet/runtime#124140 Observable instruments proposal #552

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
build-test:
strategy:
fail-fast: false
matrix:
os:
[
windows-11-arm,
ubuntu-24.04-arm,
ubuntu-latest,
windows-latest,
macos-latest,
]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Setup .NET
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5
with:
dotnet-version: "9.0.x"
global-json-file: global.json
- name: Restore
shell: pwsh
run: dotnet restore
- name: Build
shell: pwsh
run: dotnet build --configuration Release --no-restore /warnaserror
- name: Test
shell: pwsh
run: dotnet test --configuration Release --no-build --logger 'trx;LogFileName=test-results.trx' --collect 'Xplat Code Coverage'
- name: Upload Test Artifacts
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: test-artifacts-${{ matrix.os }}-${{ runner.arch }}
path: |
**/TestResults/*.trx
**/coverage.cobertura.xml
- name: Run Benchmarks (all suites for gate)
shell: pwsh
run: |
$os = "${{ matrix.os }}"
$arch = "${{ runner.arch }}"
dotnet run -c Release --project tests/Benchmarks/Benchmarks.csproj --filter "*" --artifacts "BenchmarkDotNet.Artifacts"
$json = Get-ChildItem -Path BenchmarkDotNet.Artifacts/results -Filter "Benchmarks.CacheBenchmarks-report.json" | Select-Object -First 1
if (-not $json) { Write-Error 'CacheBenchmarks full JSON not found'; exit 1; }
$out = "BenchmarkDotNet.Artifacts/results/current.$os.$arch.json"
Copy-Item $json.FullName $out
$contJson = Get-ChildItem -Path BenchmarkDotNet.Artifacts/results -Filter "Benchmarks.ContentionBenchmarks-report.json" | Select-Object -First 1
if ($contJson) { Copy-Item $contJson.FullName "BenchmarkDotNet.Artifacts/results/current-contention.$os.$arch.json" }
- name: Bench Gate Compare (CacheBenchmarks)
if: $${{ false }}

Check warning on line 72 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / CI

Workflow syntax warning

.github/workflows/ci.yml (Line: 72, Col: 13): Conditional expression contains literal text outside replacement tokens. This will cause the expression to always evaluate to truthy. Did you mean to put the entire expression inside ${{ }}?
continue-on-error: true
shell: pwsh
run: |
$os = "${{ matrix.os }}"
$arch = "${{ runner.arch }}"
$baseline = "benchmarks/baseline/current.$os.$arch.json"
$current = "BenchmarkDotNet.Artifacts/results/current.$os.$arch.json"
if (Test-Path $baseline) {
dotnet run -c Release --project tools/BenchGate/BenchGate.csproj -- $baseline $current --suite=CacheBenchmarks
} else { Write-Host "Baseline $baseline missing; skipping." }
- name: Bench Gate Compare (ContentionBenchmarks)
if: $${{ false }}

Check warning on line 85 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / CI

Workflow syntax warning

.github/workflows/ci.yml (Line: 85, Col: 13): Conditional expression contains literal text outside replacement tokens. This will cause the expression to always evaluate to truthy. Did you mean to put the entire expression inside ${{ }}?
continue-on-error: true
shell: pwsh
run: |
$os = "${{ matrix.os }}"
$arch = "${{ runner.arch }}"
$baseline = "benchmarks/baseline/current-contention.$os.$arch.json"
$current = "BenchmarkDotNet.Artifacts/results/current-contention.$os.$arch.json"
if (Test-Path $current) {
if (Test-Path $baseline) {
dotnet run -c Release --project tools/BenchGate/BenchGate.csproj -- $baseline $current --suite=ContentionBenchmarks
} else { Write-Host "Baseline $baseline missing; skipping contention gate." }
} else { Write-Host 'No contention suite JSON produced; skipping.' }
- name: Upload Benchmark Artifacts
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: benchmark-artifacts-${{ matrix.os }}-${{ runner.arch }}
path: |
BenchmarkDotNet.Artifacts/results/*.md
BenchmarkDotNet.Artifacts/results/*.html
BenchmarkDotNet.Artifacts/results/*.json
benchmarks/baseline/*.json