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
44 changes: 23 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,21 @@ jobs:
with:
persist-credentials: false

- name: Setup .NET SDKs (8.0, 9.0, 10.0)
- name: Setup .NET SDKs (8.0, 9.0, 10.0, 11.0)
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
11.0.x
cache: true
cache-dependency-path: "**/*.csproj"

# The WPF tester targets *-windows, so on Linux/macOS we build only the
# cross-platform projects. CHDSharpTest spawns the CLI from
# CHDSharpCli/bin/<config>/<tfm>/CHDSharp.dll, so it must be built first
# in the same configuration and for all three target frameworks.
# in the same configuration and for all four target frameworks.
- name: Build (cross-platform projects)
if: runner.os != 'Windows'
run: |
Expand Down Expand Up @@ -83,13 +84,14 @@ jobs:
with:
persist-credentials: false

- name: Setup .NET SDKs (8.0, 9.0, 10.0)
- name: Setup .NET SDKs (8.0, 9.0, 10.0, 11.0)
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
11.0.x
cache: true
cache-dependency-path: "**/*.csproj"

Expand Down Expand Up @@ -134,10 +136,10 @@ jobs:
with:
persist-credentials: false

- name: Setup .NET SDK 10
- name: Setup .NET SDK 11
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: "10.0.x"
dotnet-version: "11.0.x"
cache: true
cache-dependency-path: "**/*.csproj"

Expand All @@ -159,7 +161,7 @@ jobs:
retention-days: 14

coverage:
name: coverage (net10.0)
name: coverage (net11.0)
runs-on: ubuntu-24.04
timeout-minutes: 45

Expand All @@ -169,18 +171,18 @@ jobs:
with:
persist-credentials: false

- name: Setup .NET SDK 10
- name: Setup .NET SDK 11
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: "10.0.x"
dotnet-version: "11.0.x"
cache: true
cache-dependency-path: "**/*.csproj"

- name: Build CLI and test suites (net10.0)
- name: Build CLI and test suites (net11.0)
run: |
dotnet build CHDSharpCli/CHDSharpCli.csproj -c Release -f net10.0 -warnaserror
dotnet build CHDSharpTest/CHDSharpTest.csproj -c Release -f net10.0 -warnaserror
dotnet build CHDSharpEncoderTest/CHDSharpEncoderTest.csproj -c Release -f net10.0 -warnaserror
dotnet build CHDSharpCli/CHDSharpCli.csproj -c Release -f net11.0 -warnaserror
dotnet build CHDSharpTest/CHDSharpTest.csproj -c Release -f net11.0 -warnaserror
dotnet build CHDSharpEncoderTest/CHDSharpEncoderTest.csproj -c Release -f net11.0 -warnaserror

- name: Install dotnet-coverage
run: dotnet tool install --global dotnet-coverage --version 18.12.0
Expand All @@ -190,9 +192,9 @@ jobs:
set -euo pipefail
export PATH="$PATH:$HOME/.dotnet/tools"
mkdir -p coverage
dotnet-coverage collect "dotnet test CHDSharpTest/CHDSharpTest.csproj -c Release -f net10.0 --no-build" -f cobertura -o coverage/lib.cobertura.xml --nologo
dotnet-coverage collect "dotnet test CHDSharpTest/CHDSharpTest.csproj -c Release -f net11.0 --no-build" -f cobertura -o coverage/lib.cobertura.xml --nologo
# Instrumentation invalidates wall-clock assertions, so skip the one timing benchmark.
dotnet-coverage collect "dotnet test CHDSharpEncoderTest/CHDSharpEncoderTest.csproj -c Release -f net10.0 --no-build --filter FullyQualifiedName!~ParallelEncode_IsFasterThanSingleThreaded" -f cobertura -o coverage/encoder.cobertura.xml --nologo
dotnet-coverage collect "dotnet test CHDSharpEncoderTest/CHDSharpEncoderTest.csproj -c Release -f net11.0 --no-build --filter FullyQualifiedName!~ParallelEncode_IsFasterThanSingleThreaded" -f cobertura -o coverage/encoder.cobertura.xml --nologo
dotnet-coverage merge coverage/lib.cobertura.xml coverage/encoder.cobertura.xml -f cobertura -o coverage/coverage.cobertura.xml --nologo

- name: Upload coverage report
Expand All @@ -214,10 +216,10 @@ jobs:
with:
persist-credentials: false

- name: Setup .NET SDK 10
- name: Setup .NET SDK 11
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: "10.0.x"
dotnet-version: "11.0.x"
cache: true
cache-dependency-path: "**/*.csproj"

Expand Down Expand Up @@ -252,18 +254,18 @@ jobs:
with:
persist-credentials: false

- name: Setup .NET SDK 10
- name: Setup .NET SDK 11
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: "10.0.x"
dotnet-version: "11.0.x"
cache: true
cache-dependency-path: "**/*.csproj"

- name: Build battle harness (net10.0)
run: dotnet build CHDSharpBattleTest/CHDSharpBattleTest.csproj -c Release -f net10.0 -warnaserror
- name: Build battle harness (net11.0)
run: dotnet build CHDSharpBattleTest/CHDSharpBattleTest.csproj -c Release -f net11.0 -warnaserror

- name: Run quick chdman parity battle
run: dotnet run --project CHDSharpBattleTest -c Release --framework net10.0 --no-build -- --chdman CHDSharpTester/chdman.exe --quick --no-keep
run: dotnet run --project CHDSharpBattleTest -c Release --framework net11.0 --no-build -- --chdman CHDSharpTester/chdman.exe --quick --no-keep

- name: Upload battle artifacts on failure
if: failure()
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ jobs:
with:
persist-credentials: false

- name: Setup .NET SDK 10
- name: Setup .NET SDK 11
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: "10.0.x"
dotnet-version: "11.0.x"
cache: true
cache-dependency-path: "**/*.csproj"

Expand All @@ -52,7 +52,7 @@ jobs:
queries: security-extended

- name: Build for CodeQL
run: dotnet build CHDSharpCli/CHDSharpCli.csproj -c Release -f net10.0
run: dotnet build CHDSharpCli/CHDSharpCli.csproj -c Release -f net11.0

- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:
with:
persist-credentials: false

- name: Setup .NET SDK 10
- name: Setup .NET SDK 11
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: "10.0.x"
dotnet-version: "11.0.x"
cache: true
cache-dependency-path: "**/*.csproj"

Expand Down
77 changes: 59 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Builds and publishes a CHDSharp release from a version tag:
# - six platform bundles (framework-dependent single-file CLI) attached to the GitHub release
# - six platform bundles (framework-dependent single-file CLI) attached to the GitHub release:
# Windows .zip, Linux .tar.gz, macOS .dmg
# - build provenance attestations for the bundles and the NuGet package
# - the CHDSharp NuGet package
# - the docs/ folder synced to the GitHub wiki (Pages is deployed by pages.yml)
#
# Assets are named CHDSharp_<os>-<arch>_v<version>.zip - the exact names the CLI's
# built-in update check (VersionCheckService) looks up via the GitHub releases API.
# Assets are named CHDSharp_<os>-<arch>_v<version>.<zip|tar.gz|dmg> - the exact names the
# CLI's built-in update check (VersionCheckService) looks up via the GitHub releases API.
name: Release

on:
Expand All @@ -21,9 +22,48 @@ concurrency:

jobs:
bundles:
name: Bundles & GitHub release
runs-on: ubuntu-24.04
name: bundles (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
rids: linux-x64,linux-arm64
- os: windows-latest
rids: win-x64,win-arm64
- os: macos-latest
rids: osx-x64,osx-arm64
runs-on: ${{ matrix.os }}
timeout-minutes: 60

steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup .NET SDK 11
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: "11.0.x"

- name: Build release bundles
shell: pwsh
run: ./scripts/package-release.ps1 -Rids ${{ matrix.rids }} -OutputPath dist

- name: Upload bundles
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: bundles-${{ matrix.os }}
path: dist/*
if-no-files-found: error
retention-days: 7

release:
name: GitHub release
needs: bundles
runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
contents: write
id-token: write
Expand All @@ -38,11 +78,6 @@ jobs:
with:
persist-credentials: false

- name: Setup .NET SDK 10
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: "10.0.x"

- name: Verify tag matches Directory.Build.props
shell: pwsh
run: |
Expand All @@ -51,14 +86,19 @@ jobs:
if ($tag -ne "v$version") { throw "Tag '$tag' does not match version 'v$version' in Directory.Build.props" }
Write-Host "Releasing v$version"

- name: Build release bundles
shell: pwsh
run: ./scripts/package-release.ps1 -OutputPath dist
- name: Download bundles
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
path: dist
merge-multiple: true

- name: List bundles
run: ls -lh dist

- name: Attest bundle provenance
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-path: "dist/*.zip"
subject-path: "dist/*"

- name: Create GitHub release and upload bundles
env:
Expand All @@ -70,12 +110,12 @@ jobs:
if ! gh release view "$tag" >/dev/null 2>&1; then
gh release create "$tag" --title "CHDSharp v$ver" --notes-file WhatsNew.md
fi
gh release upload "$tag" dist/*.zip --clobber
gh release upload "$tag" dist/* --clobber
gh release view "$tag" --json url,assets --jq '.url, (.assets[]?.name)'

nuget:
name: NuGet publish
needs: bundles
needs: release
runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
Expand All @@ -92,13 +132,14 @@ jobs:
with:
persist-credentials: false

- name: Setup .NET SDKs (8.0, 9.0, 10.0)
- name: Setup .NET SDKs (8.0, 9.0, 10.0, 11.0)
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
11.0.x

- name: Pack and push to NuGet
env:
Expand All @@ -125,7 +166,7 @@ jobs:

wiki:
name: Wiki & Pages
needs: bundles
needs: release
runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
Expand Down
39 changes: 20 additions & 19 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ the CHD (Compressed Hunks of Data) disk-image format used by MAME.

## Build / test / run

Requires .NET SDK 8 or later (`global.json` rolls forward; targets `net8.0;net9.0;net10.0`,
LangVersion 14).
Requires .NET SDK 11 or later (`global.json` rolls forward; targets
`net8.0;net9.0;net10.0;net11.0`, LangVersion 15).

```bash
dotnet build -c Release # whole solution
Expand Down Expand Up @@ -136,7 +136,7 @@ matches `Directory.Build.props`.
```bash
dotnet build -c Release
dotnet test
dotnet run --project CHDSharpBattleTest -c Release --framework net10.0
dotnet run --project CHDSharpBattleTest -c Release --framework net11.0
jb inspectcode CSharp_CHDSharp.sln --severity=WARNING # must report 0 findings
```

Expand All @@ -149,29 +149,30 @@ matches `Directory.Build.props`.
pwsh scripts/package-release.ps1
```

Writes `CHDSharp_<rid>_v<version>.zip` for win/linux/osx × x64/arm64 into
`CHDSharpLib/bin/Release` (the default output path) without deleting other files there. Each
bundle gets the single framework-dependent binary (the .NET runtime is **not** embedded) plus
`LICENSE.txt`, `README.md`, `README.txt` and `WhatsNew.md`. Asset names must match
`VersionCheckService.GetExpectedAssetName`:
`CHDSharp_{win|linux|osx}-{x64|arm64}_v<version>.zip`.
Writes the platform-native bundle for win/linux/osx × x64/arm64 into
`CHDSharpLib/bin/Release` (the default output path) without deleting other files there:
`.zip` on Windows, `.tar.gz` on Linux and `.dmg` on macOS. Each bundle gets the single
framework-dependent binary (the .NET runtime is **not** embedded) plus `LICENSE.txt`,
`README.md`, `README.txt` and `WhatsNew.md`. macOS `.dmg` bundles require macOS (use `-Rids`
on other hosts). Asset names must match `VersionCheckService.GetExpectedAssetName`:
`CHDSharp_{win|linux|osx}-{x64|arm64}_v<version>.<zip|tar.gz|dmg>`.

6. **Tag and push**:

```bash
git tag -a v1.5.2 -m "CHDSharp v1.5.2"
git push origin main v1.5.2
git tag -a v1.7.0 -m "CHDSharp v1.7.0"
git push origin main v1.7.0
```

`release.yml` verifies the tag against `Directory.Build.props`, rebuilds the six bundles,
creates the GitHub release with `WhatsNew.md` as the body, uploads the assets, publishes the
NuGet package (skipped when the version already exists), syncs the wiki and
deploys the documentation site (`pages.yml`).
`release.yml` verifies the tag against `Directory.Build.props`, rebuilds the six bundles on
native runners (Windows `.zip`, Linux `.tar.gz`, macOS `.dmg`), creates the GitHub release
with `WhatsNew.md` as the body, uploads the assets, publishes the NuGet package (skipped when
the version already exists), syncs the wiki and deploys the documentation site (`pages.yml`).

7. **Verify the release**:

```bash
gh release view v1.5.2
gh release view v1.7.0
gh run list --workflow=release.yml --limit 1
(Invoke-RestMethod https://api.nuget.org/v3-flatcontainer/chdsharp/index.json).versions
```
Expand All @@ -186,15 +187,15 @@ Pages rebuild request; needs `repo` scope).

`.github/workflows/ci.yml` runs on every push to `main`, every pull request, and manual dispatch:

- **`build & test`** - Linux/macOS/Windows matrix; installs the .NET 8/9/10 SDKs, builds with
- **`build & test`** - Linux/macOS/Windows matrix; installs the .NET 8/9/10/11 SDKs, builds with
`-warnaserror` (NuGet audit is on), and runs both xUnit suites (`CHDSharpTest`,
`CHDSharpEncoderTest`) for all three target frameworks. The CLI is built first because
`CHDSharpEncoderTest`) for all four target frameworks. The CLI is built first because
`CHDSharpTest` spawns `CHDSharpCli/bin/<config>/<tfm>/CHDSharp.dll`; the Windows job also builds
the full solution (WPF tester, battle harness, benchmark).
- **`quality`** - Windows; installs JetBrains ReSharper GlobalTools and fails on any
`jb inspectcode --severity=WARNING` finding, uploading the SARIF to code scanning.
- **`package`** - packs `CHDSharpLib`, checks the `.nupkg` contents, and uploads it as an artifact.
- **`coverage`** - collects merged Cobertura coverage for both suites on `net10.0`.
- **`coverage`** - collects merged Cobertura coverage for both suites on `net11.0`.
- **`docs build (Jekyll + DocFX)`** - builds the Jekyll site with `--strict_front_matter`, then
generates the DocFX API reference (`scripts/build-api-docs.ps1`).
- **`chdman parity (smoke)`** - Windows; runs the quick battle harness against
Expand Down
Loading
Loading