Browse Source

Deduplicate the cross-platform CI jobs

The Linux and macOS jobs were near-identical copies; their shared head
(checkout, SDK setup, version, restore, build, both test steps, test-log
upload) drifts the moment one is edited and the other is not. Collapse
them into a single platform-parameterized matrix job, and hoist the .NET
SDK version/quality and the staging directory to workflow-level env so an
SDK bump is a one-line change across all jobs.

The Windows job keeps its id (Build) so internal references stay stable,
but gains a display name to read as "Desktop (Windows)" alongside the
matrix "Desktop (linux)/(macos)" checks. Branch-protection required
checks must be repointed to the new check names.

Assisted-by: Claude:claude-opus-4-8:Claude Code
pull/3404/head
Christoph Wille 4 weeks ago
parent
commit
c6ec2c5893
  1. 128
      .github/workflows/build-ilspy.yml

128
.github/workflows/build-ilspy.yml

@ -9,8 +9,14 @@ on: @@ -9,8 +9,14 @@ on:
permissions:
contents: read
env:
DOTNET_SDK_VERSION: '11.0.x'
DOTNET_SDK_QUALITY: 'preview'
StagingDirectory: buildartifacts
jobs:
Build:
name: Desktop (Windows)
permissions:
packages: write # for dotnet nuget push
runs-on: windows-2025-vs2026
@ -20,7 +26,6 @@ jobs: @@ -20,7 +26,6 @@ jobs:
Configuration: [ Debug, Release ]
env:
BuildPlatform: Any CPU
StagingDirectory: buildartifacts
BuildAndPublishVsix: true
defaults:
@ -39,8 +44,8 @@ jobs: @@ -39,8 +44,8 @@ jobs:
- uses: actions/setup-dotnet@v5
with:
dotnet-version: '11.0.x'
dotnet-quality: 'preview'
dotnet-version: ${{ env.DOTNET_SDK_VERSION }}
dotnet-quality: ${{ env.DOTNET_SDK_QUALITY }}
cache: true
cache-dependency-path: '**/packages.lock.json'
env:
@ -268,10 +273,16 @@ jobs: @@ -268,10 +273,16 @@ jobs:
# 32-bit, roundtrip) self-exclude via Tester.SupportedOnCurrentPlatform and
# [Platform("Win")]. ILSpy.Tests.Windows runs only in the Windows job by design.
Linux:
runs-on: ubuntu-latest
env:
StagingDirectory: buildartifacts
Desktop:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux
- os: macos-15
platform: macos
runs-on: ${{ matrix.os }}
defaults:
run:
@ -288,8 +299,8 @@ jobs: @@ -288,8 +299,8 @@ jobs:
- uses: actions/setup-dotnet@v5
with:
dotnet-version: '11.0.x'
dotnet-quality: 'preview'
dotnet-version: ${{ env.DOTNET_SDK_VERSION }}
dotnet-quality: ${{ env.DOTNET_SDK_QUALITY }}
cache: true
cache-dependency-path: '**/packages.lock.json'
env:
@ -333,7 +344,7 @@ jobs: @@ -333,7 +344,7 @@ jobs:
uses: actions/upload-artifact@v7
if: success() || failure()
with:
name: test-results-linux
name: test-results-${{ matrix.platform }}
path: 'test-results/*.trx'
- name: Create Test Report
@ -343,13 +354,14 @@ jobs: @@ -343,13 +354,14 @@ jobs:
paths: "test-results/*.trx"
folded: true
- name: Publish (linux-x64 self-contained)
run: ./publish.ps1 -Configuration Release -Platform linux
- name: Publish (self-contained)
run: ./publish.ps1 -Configuration Release -Platform ${{ matrix.platform }}
- name: Package (zip, deb, rpm)
run: ./BuildTools/package-linux.ps1 -Configuration Release -Version "${{ steps.version.outputs.ILSPY_VERSION_NUMBER }}" -StagingDirectory $env:StagingDirectory
- name: Package
run: ./BuildTools/package-${{ matrix.platform }}.ps1 -Configuration Release -Version "${{ steps.version.outputs.ILSPY_VERSION_NUMBER }}" -StagingDirectory $env:StagingDirectory
- name: Upload zip build artifact
- name: Upload zip build artifact (Linux)
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v7
with:
name: ILSpy Linux x64 ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (Release)
@ -357,6 +369,7 @@ jobs: @@ -357,6 +369,7 @@ jobs:
if-no-files-found: error
- name: Upload deb build artifact
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v7
with:
name: ILSpy Linux x64 deb ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (Release)
@ -364,94 +377,15 @@ jobs: @@ -364,94 +377,15 @@ jobs:
if-no-files-found: error
- name: Upload rpm build artifact
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v7
with:
name: ILSpy Linux x64 rpm ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (Release)
path: ${{ env.StagingDirectory }}/*.rpm
if-no-files-found: error
macOS:
runs-on: macos-15
env:
StagingDirectory: buildartifacts
defaults:
run:
shell: pwsh
steps:
- run: mkdir -p $env:StagingDirectory
- uses: actions/checkout@v6
with:
submodules: true
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-dotnet@v5
with:
dotnet-version: '11.0.x'
dotnet-quality: 'preview'
cache: true
cache-dependency-path: '**/packages.lock.json'
env:
DOTNET_INSTALL_DIR: ${{ runner.temp }}/.dotnet
DOTNET_ROOT: ${{ runner.temp }}/.dotnet
- name: Get Version
id: version
run: |
./BuildTools/ghactions-install.ps1
Get-ChildItem Env: | Where-Object {$_.Name -Match "^ILSPY_"} | %{ echo "$($_.Name)=$($_.Value)" } | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Restore the application
run: >
dotnet restore ILSpy.Desktop.slnf
/p:RestoreEnablePackagePruning=false
/p:Configuration=Release
/p:Platform="Any CPU"
- name: Build
run: >
dotnet build ILSpy.Desktop.slnf --no-restore
-c Release
/p:Platform="Any CPU" /m
- name: Execute UI tests
run: >
dotnet test --project ILSpy.Tests/ILSpy.Tests.csproj
--configuration Release
--no-build --report-trx
--results-directory test-results
- name: Execute decompiler tests
run: >
dotnet test --project ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
--configuration Release
--no-build --report-trx
--results-directory test-results
- name: Upload Test Logs
uses: actions/upload-artifact@v7
if: success() || failure()
with:
name: test-results-macos
path: 'test-results/*.trx'
- name: Create Test Report
uses: test-summary/action@v2
if: always()
with:
paths: "test-results/*.trx"
folded: true
- name: Publish (osx-arm64 self-contained app bundle)
run: ./publish.ps1 -Configuration Release -Platform macos
- name: Package (zipped ILSpy.app)
run: ./BuildTools/package-macos.ps1 -Configuration Release -Version "${{ steps.version.outputs.ILSPY_VERSION_NUMBER }}" -StagingDirectory $env:StagingDirectory
- name: Upload app bundle build artifact
- name: Upload app bundle build artifact (macOS)
if: matrix.platform == 'macos'
uses: actions/upload-artifact@v7
with:
name: ILSpy macOS arm64 ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (Release)

Loading…
Cancel
Save