Skip to content

Build and run tests #330

Build and run tests

Build and run tests #330

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-latest, macos-13, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.1.x
8.0.x
- name: Restore
working-directory: ${{ github.workspace }}/net
run: dotnet restore
- name: Build and run tests
working-directory: ${{ github.workspace }}/net
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 }}/net/**/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:
DotNetSdkX64: "~/.dotnet-sdk/x64"
DotNetSdkArm64: "~/.dotnet-sdk/arm64"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Manually setup .NET 8.0 and 3.1 SDKs
working-directory: ${{ github.workspace }}/net
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 8.0 --install-dir $DotNetSdkX64
- name: Restore
working-directory: ${{ github.workspace }}/net
run: $DotNetSdkArm64/dotnet restore
- name: Build and run arm64 tests
working-directory: ${{ github.workspace }}/net
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
working-directory: ${{ github.workspace }}/net
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 }}/net/**/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/net && \
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 }}/net/**/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:
tfm: ${{ (contains(matrix.os-labels, 'riscv64') || contains(matrix.os-labels, 'ppc64le')) && 'net9.0' || 'net8.0' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore
working-directory: ${{ github.workspace }}/net
run: dotnet restore -p:JB_TargetFramework=${{ env.tfm }}
- name: Build and Tests
working-directory: ${{ github.workspace }}/net
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 }}/net/**/tests/TestResults/*
if-no-files-found: error
jvm:
name: JVM
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Run Tests
run: ./gradlew test --stacktrace
working-directory: ${{ github.workspace }}/jvm
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: jvm-test-results-${{ matrix.os }}
path: ${{ github.workspace }}/jvm/build/test-results/test/*
if-no-files-found: error
jvm-qemu:
name: JVM QEMU
strategy:
fail-fast: false
matrix:
arch: [ s390x, ppc64le ]
runs-on: ubuntu-latest
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 JDK and Tests under QEMU ${{ matrix.arch }}
run: >
docker run --rm -e JAVA_OPTS="-Djdk.lang.Process.launchMechanism=vfork" -v ${PWD}:/home/gradle/project -w /home/gradle/project/jvm --platform linux/${{ matrix.arch }} gradle:jdk17 gradle test --stacktrace
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: jvm-test-results-qemu-${{ matrix.arch }}
path: ${{ github.workspace }}/jvm/build/test-results/test/*
if-no-files-found: error
jvm-self-hosted:
name: JVM 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 }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Gradle Setup
uses: gradle/actions/setup-gradle@v4
- name: Run Tests
run: ./gradlew test --stacktrace
working-directory: ${{ github.workspace }}/jvm
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: jvm-test-results-self-hosted-${{ join(matrix.os-labels, '-') }}
path: ${{ github.workspace }}/jvm/build/test-results/test/*
if-no-files-found: error