Files
pardeike-Harmony/.github/workflows/test.yml
Copilot 01258366a5 Partially add .NET 10 support (#744)
* Initial plan

* Add .NET 10 support to Harmony

Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>

* Update additional workflow files for .NET 10 SDK

Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>

* Fix CI by installing .NET 10 SDK in workflows

Updated workflows to install both 9.0.x and 10.0.x SDKs using wildcard versions.
This ensures .NET 10 SDK is installed when available in GitHub Actions runners.
Changed global.json to require SDK 10.0.100 with latestPatch rollForward for forward compatibility.

Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>

* Revert global.json to SDK 9.0.100 for CI compatibility

Changed global.json back to require SDK 9.0.100 with latestFeature rollForward.
Note: net10.0 targets will fail to build until .NET 10 SDK is available in GitHub Actions.
This is expected since .NET SDK was just released today.

Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>

* Set global.json to require .NET 10 SDK with latestPatch rollForward

Updated global.json to explicitly require SDK 10.0.100 with latestPatch rollForward.
This works because actions/setup-dotnet downloads and installs the SDK regardless of what's preinstalled on the runner.
Confirmed .NET 10.0.100 SDK is available and builds net10.0 targets successfully.

Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>

* Simplify workflow SDK installation to only use .NET 10

Removed dual 9.0.x/10.0.x SDK installation in favor of only installing 10.0.x.
The .NET 10 SDK can build all target frameworks including net9.0 and older using targeting packs.
This follows the minimal change approach requested.

Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>
2025-11-12 20:30:22 +01:00

224 lines
10 KiB
YAML

name: Platform Tests
on:
push:
branches:
- main
- master
paths-ignore:
- '.github/workflows/docs.yml'
- 'Harmony/Documentation/*'
pull_request:
branches:
- '**'
paths-ignore:
- '.github/workflows/docs.yml'
- 'Harmony/Documentation/*'
workflow_dispatch:
concurrency:
group: ${{github.workflow}}-${{github.event.pull_request.number || github.ref}}
cancel-in-progress: true
env:
# Right now we can't run experimental tests that can fail, since it will affect the PR
# We could potentially exclude experimental build on PR and only run it on master push
EXPERIMENTAL: false
# If set true, each target framework will be tested in it's own job instead of a single job
# NOTE: At some point when we'll have more target frameworks, parallelization should be more efficient
# It also will be more efficient once the `windows` workers will have a faster startup time
# METRICS:
# PARALLEL: true & PREBUILD: true ~ 15 minutes
# PARALLEL: false ~ 7 minutes
PARALLEL: false
# Whether we should build the binaries before running the tests
# Use with `PARALLEL: true` to reduce the execution time of test jobs, this increasing the throughput
PREBUILD: false
# You are interested in changing these values
BUILD_CONFIGURATIONS: "['Debug', 'Release']"
BUILD_CONFIGURATIONS_WITH_REF: "['Debug', 'Release']"
DOTNET_TARGET_FRAMEWORKS: "['netcoreapp3.0', 'netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0', 'net9.0', 'net10.0']"
DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64: "['net6.0', 'net7.0', 'net8.0', 'net9.0', 'net10.0']"
FRAMEWORK_TARGET_FRAMEWORKS: "['net35', 'net452', 'net472', 'net48']"
jobs:
# https://stackoverflow.com/a/77549656
variables:
name: Preparing # variable accessibility workaround for jobs
runs-on: ubuntu-22.04
outputs:
EXPERIMENTAL: ${{env.EXPERIMENTAL}}
PARALLEL: ${{env.PARALLEL}}
PREBUILD: ${{env.PREBUILD}}
BUILD_CONFIGURATIONS: ${{env.BUILD_CONFIGURATIONS}}
BUILD_CONFIGURATIONS_WITH_REF: ${{env.BUILD_CONFIGURATIONS_WITH_REF}}
DOTNET_TARGET_FRAMEWORKS: ${{env.DOTNET_TARGET_FRAMEWORKS}}
DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64: ${{env.DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64}}
FRAMEWORK_TARGET_FRAMEWORKS: ${{env.FRAMEWORK_TARGET_FRAMEWORKS}}
steps:
- name: Compute outputs
run: |
echo "EXPERIMENTAL=${{env.EXPERIMENTAL}}" >> $GITHUB_OUTPUT
echo "PARALLEL=${{env.PARALLEL}}" >> $GITHUB_OUTPUT
echo "PREBUILD=${{env.PREBUILD}}" >> $GITHUB_OUTPUT
echo "BUILD_CONFIGURATIONS=${{env.BUILD_CONFIGURATIONS}}" >> $GITHUB_OUTPUT
echo "BUILD_CONFIGURATIONS_WITH_REF=${{env.BUILD_CONFIGURATIONS_WITH_REF}}" >> $GITHUB_OUTPUT
echo "DOTNET_TARGET_FRAMEWORKS=${{env.DOTNET_TARGET_FRAMEWORKS}}" >> $GITHUB_OUTPUT
echo "DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64=${{env.DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64}}" >> $GITHUB_OUTPUT
echo "FRAMEWORK_TARGET_FRAMEWORKS=${{env.FRAMEWORK_TARGET_FRAMEWORKS}}" >> $GITHUB_OUTPUT
# Ideally we should be able to build binaries on Ubuntu to all platforms to test
# and have a job that will create binaries on each platform and compare the output dll's
build-binaries:
name: Build ${{ matrix.build_configuration }}
needs: variables
strategy:
matrix:
image: [ { os: 'ubuntu', code: 'ubuntu-22.04' } ]
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS_WITH_REF)}}
uses: ./.github/workflows/test-build.yml
with:
os: ${{matrix.image.os}}
image: ${{matrix.image.code}}
build_configuration: ${{matrix.build_configuration}}
publish: ${{matrix.image.os == 'ubuntu'}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
windows-dotnet:
name: Win .NET ${{matrix.architecture}}${{matrix.build_configuration && ''}}
needs: [variables, build-binaries]
strategy:
fail-fast: false
matrix:
architecture: ['x86', 'x64']
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-windows-dotnet.yml
with:
architecture: ${{matrix.architecture}}
target_framework: ${{matrix.target_framework}}
target_framework_array: ${{needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS}}
build_configuration: ${{matrix.build_configuration}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
windows-framework:
name: Win Fwk ${{matrix.architecture}}${{matrix.build_configuration && ''}}
needs: [variables, build-binaries]
strategy:
fail-fast: false
matrix:
architecture: ['x86', 'x64']
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-windows-framework.yml
with:
architecture: ${{matrix.architecture}}
target_framework: ${{matrix.target_framework}}
target_framework_array: ${{needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS}}
build_configuration: ${{matrix.build_configuration}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
windows-mono:
name: Win Mono ${{matrix.architecture}}${{matrix.build_configuration && ''}}
needs: [variables, build-binaries]
strategy:
fail-fast: false
matrix:
architecture: ['x86', 'x64']
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-windows-mono.yml
with:
architecture: ${{matrix.architecture}}
target_framework: ${{matrix.target_framework}}
target_framework_array: ${{needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS}}
build_configuration: ${{matrix.build_configuration}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
ubuntu-macos-x64-dotnet:
name: ${{ matrix.image.os == 'ubuntu' && 'Ubuntu' || 'macOS' }} .NET ${{ matrix.architecture }}${{ matrix.build_configuration && '' }}
needs: [variables, build-binaries]
strategy:
fail-fast: false
matrix:
image: [ { os: 'ubuntu', code: 'ubuntu-22.04' }, { os: 'macos', code: 'macos-14-large' } ]
architecture: ['x64']
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-unix-dotnet.yml
with:
os: ${{matrix.image.os}}
image: ${{matrix.image.code}}
architecture: ${{matrix.architecture}}
target_framework: ${{matrix.target_framework }}
target_framework_array: ${{needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS}}
build_configuration: ${{matrix.build_configuration}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
ubuntu-macos-x64-mono:
name: ${{ matrix.image.os == 'ubuntu' && 'Ubuntu' || 'macOS' }} Mono ${{ matrix.architecture }}${{ matrix.build_configuration && '' }}
needs: [variables, build-binaries]
strategy:
fail-fast: false
matrix:
image: [ { os: 'ubuntu', code: 'ubuntu-22.04' }, { os: 'macos', code: 'macos-14-large' } ]
architecture: ['x64']
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-unix-mono.yml
with:
os: ${{matrix.image.os}}
image: ${{matrix.image.code}}
architecture: ${{matrix.architecture}}
target_framework: ${{matrix.target_framework}}
target_framework_array: ${{needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS}}
build_configuration: ${{matrix.build_configuration}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
ubuntu-macos-arm64-mono:
name: ${{ matrix.image.os == 'ubuntu' && 'Ubuntu' || 'macOS' }} Mono ${{ matrix.architecture }}${{ matrix.build_configuration && '' }}
needs: [variables, build-binaries]
strategy:
fail-fast: false
matrix:
image: [ { os: 'ubuntu', code: 'ubuntu-22.04' }, { os: 'macos', code: 'macos-14' } ]
architecture: ['arm64']
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-unix-mono.yml
with:
os: ${{matrix.image.os}}
image: ${{matrix.image.code}}
architecture: ${{matrix.architecture}}
target_framework: ${{matrix.target_framework}}
target_framework_array: ${{needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS}}
build_configuration: ${{matrix.build_configuration}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
test-results:
name: Test Results
needs: [variables, windows-dotnet, windows-framework, windows-mono, ubuntu-macos-x64-dotnet, ubuntu-macos-x64-mono, ubuntu-macos-arm64-mono]
if: always()
uses: ./.github/workflows/test-result-upload.yml
with:
experimental: ${{needs.variables.outputs.EXPERIMENTAL == 'true'}}
cleanup-build-output:
name: Cleanup Build Output
needs: [test-results]
runs-on: ubuntu-22.04
if: always()
steps:
# Delete build output artifacts
- uses: joutvhu/delete-artifact@v2
with:
pattern: build-output-*
# Delete test result artifacts
- uses: joutvhu/delete-artifact@v2
with:
pattern: test-results-*