Implemented a GitHub Actions testing pipeline #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Perform Testing | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- '.github/workflows/docs.yml' | |
- 'Harmony/Documentation/*' | |
pull_request: | |
branches: | |
- master | |
paths-ignore: | |
- '.github/workflows/docs.yml' | |
- 'Harmony/Documentation/*' | |
workflow_dispatch: | |
env: | |
# You are interested in changing these values | |
BUILD_CONFIGURATIONS: "['ReleaseFat', 'ReleaseThin']" | |
DOTNET_TARGET_FRAMEWORKS: "['netcoreapp3.0', 'netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0']" | |
DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64: "['net6.0', 'net7.0', 'net8.0']" | |
FRAMEWORK_TARGET_FRAMEWORKS: "['net35', 'net452', 'net472', 'net48']" | |
jobs: | |
# https://stackoverflow.com/a/77549656 | |
variables: | |
name: Variable Accessibility Workaround for Jobs | |
runs-on: ubuntu-latest | |
outputs: | |
BUILD_CONFIGURATIONS: ${{ env.BUILD_CONFIGURATIONS }} | |
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 "BUILD_CONFIGURATIONS=${{env.BUILD_CONFIGURATIONS}}" >> $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 Binaries | |
needs: variables | |
strategy: | |
matrix: | |
image: [ { os: 'windows', code: 'windows-latest' }, { os: 'ubuntu', code: 'ubuntu-latest' }, { os: 'macos', code: 'macos-13' }, { os: 'macos-arm64', code: 'macos-14' } ] | |
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}} | |
uses: ./.github/workflows/test-build.yml | |
with: | |
os: ${{ matrix.image.os }} | |
image: ${{ matrix.image.code }} | |
build_configuration: ${{ matrix.build_configuration }} | |
publish: ${{ matrix.image.os == 'windows' }} | |
windows-dotnet: | |
name: Windows .NET x86/x64 | |
needs: [variables, build-binaries] | |
strategy: | |
matrix: | |
architecture: ['x86', 'x64'] | |
target_framework: ${{fromJson(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 }} | |
build_configuration: ${{ matrix.build_configuration }} | |
windows-framework: | |
name: Windows .NET Framework x86/x64 | |
needs: [variables, build-binaries] | |
strategy: | |
fail-fast: false | |
matrix: | |
architecture: ['x86', 'x64'] | |
target_framework: ${{fromJson(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 }} | |
build_configuration: ${{ matrix.build_configuration }} | |
windows-mono: | |
name: Windows Mono x86/x64 | |
needs: [variables, build-binaries] | |
strategy: | |
fail-fast: false | |
matrix: | |
architecture: ['x86', 'x64'] | |
target_framework: ${{fromJson(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 }} | |
build_configuration: ${{ matrix.build_configuration }} | |
ubuntu-macos-x64-dotnet: | |
name: Ubuntu/MacOS .NET x64 | |
needs: [variables, build-binaries] | |
strategy: | |
fail-fast: false | |
matrix: | |
image: [ { os: 'ubuntu', code: 'ubuntu-latest' }, { os: 'macos', code: 'macos-13' } ] | |
architecture: ['x64'] | |
target_framework: ${{fromJson(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 }} | |
build_configuration: ${{ matrix.build_configuration }} | |
ubuntu-macos-x64-mono: | |
name: Ubuntu/MacOS Mono x64 | |
needs: [variables, build-binaries] | |
strategy: | |
fail-fast: false | |
matrix: | |
image: [ { os: 'ubuntu', code: 'ubuntu-latest' }, { os: 'macos', code: 'macos-13' } ] | |
architecture: ['x64'] | |
target_framework: ${{fromJson(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 }} | |
build_configuration: ${{ matrix.build_configuration }} | |
ubuntu-arm64-dotnet: | |
name: Ubuntu .NET arm64 | |
needs: [variables, build-binaries] | |
if: false # TODO: Enable once we are able to ignore a failed job | |
strategy: | |
fail-fast: false | |
matrix: | |
target_framework: ${{fromJson(needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64) }} | |
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}} | |
uses: ./.github/workflows/test-qemu-dotnet.yml | |
with: | |
target_framework: ${{ matrix.target_framework }} | |
build_configuration: ${{ matrix.build_configuration }} | |
run_settings_args: 'NUnit.DefaultTestNamePattern="{C}:{m}{a}" RunConfiguration.TargetPlatform=arm64' | |
experimental: true | |
ubuntu-arm64-mono: | |
name: Ubuntu .NET arm64 | |
needs: [variables, build-binaries] | |
if: false # TODO: Enable once we are able to ignore a failed job | |
strategy: | |
fail-fast: false | |
matrix: | |
target_framework: ${{fromJson(needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS) }} | |
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}} | |
uses: ./.github/workflows/test-qemu-mono.yml | |
with: | |
target_framework: ${{ matrix.target_framework }} | |
build_configuration: ${{ matrix.build_configuration }} | |
run_settings_args: 'NUnit.DefaultTestNamePattern="{C}:{m}{a}" RunConfiguration.TargetPlatform=arm64' | |
experimental: true | |
macos-arm64-dotnet: | |
name: MacOS .NET arm64 | |
needs: [variables, build-binaries] | |
if: false # TODO: Enable once we are able to ignore a failed job | |
strategy: | |
fail-fast: false | |
matrix: | |
image: [ { os: 'macos-arm64', code: 'macos-14' } ] | |
architecture: ['arm64'] | |
target_framework: ${{fromJson(needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64) }} | |
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 }} | |
build_configuration: ${{ matrix.build_configuration }} | |
experimental: true | |
test-results: | |
name: Download and Upload Test Results | |
needs: [windows-dotnet, windows-framework, windows-mono, ubuntu-macos-x64-dotnet, ubuntu-macos-x64-mono, ubuntu-arm64-dotnet, ubuntu-arm64-mono, macos-arm64-dotnet] | |
if: always() | |
uses: ./.github/workflows/test-result-upload.yml | |
test-results-experimental: | |
name: Download and Upload Test Results (Experimental) | |
needs: [windows-dotnet, windows-framework, windows-mono, ubuntu-macos-x64-dotnet, ubuntu-macos-x64-mono, ubuntu-arm64-dotnet, ubuntu-arm64-mono, macos-arm64-dotnet] | |
if: false && always() # TODO: Enable once we are able to ignore a failed job | |
uses: ./.github/workflows/test-result-upload.yml | |
with: | |
experimental: true | |
cleanup-build-output: | |
name: Cleanup Build Output | |
needs: [test-results, test-results-experimental] | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- uses: joutvhu/delete-artifact@v2 | |
with: | |
pattern: build-output-* | |
- uses: joutvhu/delete-artifact@v2 | |
with: | |
pattern: test-results-* | |
- uses: joutvhu/delete-artifact@v2 | |
if: false # TODO: Enable once we are able to ignore a failed job | |
with: | |
pattern: experimental-test-results-* |