Build and run tests #148
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: Build and run tests | |
on: | |
schedule: | |
- cron: "0 2 * * 1,4" | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
net: | |
name: .NET | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-22.04, macos-13, windows-latest ] | |
runs-on: ${{ matrix.os }} | |
env: | |
MSBUILDTERMINALLOGGER: off | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
3.1.x | |
5.0.x | |
8.0.x | |
- name: Restore | |
run: dotnet restore | |
- name: Build and run tests | |
run: dotnet test --configuration Release --no-restore --verbosity normal --logger 'trx;LogFilePrefix=test-results' | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: net-test-results-${{ matrix.os }} | |
path: ${{ github.workspace }}/**/tests/TestResults/* | |
if-no-files-found: error | |
net-macos-arm64: | |
name: .NET macOS ARM64 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ macos-latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
MSBUILDTERMINALLOGGER: off | |
DotNetSdkX64: "~/.dotnet-sdk/x64" | |
DotNetSdkArm64: "~/.dotnet-sdk/arm64" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Manually setup .NET 8.0, 5.0 and 3.1 SDKs | |
run: > | |
curl -fsSLO https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh && chmod +x dotnet-install.sh && \ | |
./dotnet-install.sh --architecture arm64 --skip-non-versioned-files --channel 8.0 --install-dir $DotNetSdkArm64 && \ | |
./dotnet-install.sh --architecture x64 --skip-non-versioned-files --channel 3.1 --install-dir $DotNetSdkX64 && \ | |
./dotnet-install.sh --architecture x64 --skip-non-versioned-files --channel 5.0 --install-dir $DotNetSdkX64 && \ | |
./dotnet-install.sh --architecture x64 --skip-non-versioned-files --channel 8.0 --install-dir $DotNetSdkX64 | |
- name: Restore | |
run: $DotNetSdkArm64/dotnet restore | |
- name: Build and run arm64 tests | |
run: $DotNetSdkArm64/dotnet test -f net8.0 --configuration Release --no-restore --verbosity normal --logger 'trx;LogFilePrefix=test-results_arm64' | |
- name: Build and run x64 tests | |
run: $DotNetSdkX64/dotnet test --configuration Release --no-restore --verbosity normal --logger 'trx;LogFilePrefix=test-results_x64' | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: net-test-results-${{ matrix.os }} | |
path: ${{ github.workspace }}/**/tests/TestResults/* | |
if-no-files-found: error | |
net-qemu: | |
name: .NET QEMU | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [ s390x ] | |
runs-on: ubuntu-latest | |
env: | |
tfm: ${{ matrix.arch == 'ppc64le' && 'net9.0' || 'net8.0' }} | |
sdk: ${{ matrix.arch == 'ppc64le' && '9.0' || '8.0' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install QEMU static executables formats | |
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: Setup .NET SDK, Restore, Build and Tests under QEMU ${{ matrix.arch }} | |
run: > | |
docker run --rm -v "${{ github.workspace }}:/work" --platform linux/${{ matrix.arch }} ${{ matrix.arch }}/fedora:41 /bin/bash -c " \ | |
dnf install -y crypto-policies-scripts dotnet-sdk-${{ env.sdk }} && \ | |
update-crypto-policies --set DEFAULT:SHA1 && \ | |
cd /work && \ | |
export MSBUILDTERMINALLOGGER=off && \ | |
dotnet restore -p:JB_TargetFramework=${{ env.tfm }} && \ | |
dotnet test -f ${{ env.tfm }} -p:JB_TargetFramework=${{ env.tfm }} --configuration Release --no-restore --verbosity normal --logger 'trx;LogFilePrefix=test-results' && \ | |
true" | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: net-test-results-qemu-${{ matrix.arch }} | |
path: ${{ github.workspace }}/**/tests/TestResults/* | |
if-no-files-found: error | |
net-self-hosted: | |
name: .NET SelfHosted | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os-labels: [linux, amd64, musl] | |
- os-labels: [linux, arm64, musl] | |
- os-labels: [linux, s390x, glibc] | |
- os-labels: [linux, ppc64le, glibc] | |
- os-labels: [linux, riscv64, glibc] | |
- os-labels: [freebsd, amd64] | |
- os-labels: [freebsd, arm64] | |
runs-on: | |
- self-hosted | |
- ${{ matrix.os-labels }} | |
env: | |
MSBUILDTERMINALLOGGER: off | |
tfm: ${{ (contains(matrix.os-labels, 'riscv64') || contains(matrix.os-labels, 'ppc64le')) && 'net9.0' || 'net8.0' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Restore | |
run: dotnet restore -p:JB_TargetFramework=${{ env.tfm }} | |
- name: Build and Tests | |
run: dotnet test -f ${{ env.tfm }} -p:JB_TargetFramework=${{ env.tfm }} --configuration Release --no-restore --verbosity normal --logger "trx;LogFilePrefix=test-results" | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: net-test-results-self-hosted-${{ join(matrix.os-labels, '-') }} | |
path: ${{ github.workspace }}/**/tests/TestResults/* | |
if-no-files-found: error |