Skip to content

fix: stabilize cross-platform mods path and harden migration, CI, and… #2

fix: stabilize cross-platform mods path and harden migration, CI, and…

fix: stabilize cross-platform mods path and harden migration, CI, and… #2

Workflow file for this run

name: CI
on:
push:
branches: [main]
paths-ignore:
- "**/*.md"
- "LICENSE"
pull_request:
branches: [main]
paths-ignore:
- "**/*.md"
- "LICENSE"
workflow_dispatch:
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
checks: write
env:
DOTNET_VERSION: 10.0.x
SOLUTION_FILE: Yellowcake.slnx
MIN_COVERAGE_PERCENT: 15
jobs:
build-and-test:
name: Build & Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
cache: true
cache-dependency-path: |
**/*.csproj
**/packages.lock.json
global.json
- name: Restore
run: dotnet restore ${{ env.SOLUTION_FILE }} --nologo
- name: Build
run: dotnet build ${{ env.SOLUTION_FILE }} -c Release --no-restore --nologo -warnaserror
- name: Verify formatting
if: runner.os == 'Linux'
run: dotnet format ${{ env.SOLUTION_FILE }} --verify-no-changes --no-restore
- name: Test with coverage
run: dotnet test ${{ env.SOLUTION_FILE }} -c Release --no-build --nologo --logger "trx;LogFileName=test-results.trx" --collect "XPlat Code Coverage" --results-directory TestResults/${{ runner.os }}
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ runner.os }}
path: TestResults/${{ runner.os }}
if-no-files-found: warn
retention-days: 14
- name: Enforce minimum coverage
if: runner.os == 'Linux'
shell: pwsh
run: |
$coverageFile = Get-ChildItem -Path "TestResults/${{ runner.os }}" -Recurse -Filter "coverage.cobertura.xml" | Select-Object -First 1
if (-not $coverageFile) {
throw "Coverage report not found under TestResults/${{ runner.os }}"
}
[xml]$coverageXml = Get-Content $coverageFile.FullName
$lineRate = [double]$coverageXml.coverage.'line-rate' * 100
$minCoverage = [double]"${{ env.MIN_COVERAGE_PERCENT }}"
Write-Host "Measured line coverage: $([math]::Round($lineRate, 2))%"
Write-Host "Minimum required line coverage: $minCoverage%"
if ($lineRate -lt $minCoverage) {
throw "Coverage gate failed: $([math]::Round($lineRate, 2))% < $minCoverage%"
}
package-smoke:
name: Package Smoke Check (Linux)
runs-on: ubuntu-latest
needs: build-and-test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
cache: true
cache-dependency-path: |
**/*.csproj
**/packages.lock.json
global.json
- name: Restore
run: dotnet restore ${{ env.SOLUTION_FILE }} --nologo
- name: Publish linux-x64
run: dotnet publish Yellowcake.csproj -c Release -r linux-x64 --self-contained true -p:ContinuousIntegrationBuild=true -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true --nologo -o publish/linux-x64
- name: Smoke test executable exists
run: test -f publish/linux-x64/Yellowcake