Skip to content

RNET-1161: Implement support for using a log level for a specific log category #2057

RNET-1161: Implement support for using a log level for a specific log category

RNET-1161: Implement support for using a log level for a specific log category #2057

Workflow file for this run

# Do not modify!
# This file was generated from a template using https://github.com/apple/pkl
name: PR Build
'on':
pull_request:
paths:
- '**.cs'
- '**.cpp'
- '**.hpp'
- '**.csproj'
- '**CMakeLists.txt'
- '**.ps1'
- '**.sh'
- '**.props'
- wrappers/realm-core
- .github/workflows/*.yml
- '!.github/workflows/main.yml'
- '!.github/workflows/publish-*.yml'
- .github/actions/**
- Tests/Tests.Android/Properties/AndroidManifest.xml
env:
REALM_DISABLE_ANALYTICS: true
DOTNET_NOLOGO: true
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-wrappers:
name: Wrappers
uses: ./.github/workflows/wrappers.yml
deploy-baas:
name: Deploy BaaS
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59
with:
dotnet-version: 8.0.x
- name: Deploy Apps
working-directory: Tools/DeployApps
run: dotnet run deploy-apps --baasaas-api-key=${{ secrets.BAASAAS_API_KEY }} --baas-differentiator=${{ matrix.differentiator }}-${{ github.run_id }}-${{ github.run_attempt }}
strategy:
matrix:
differentiator:
- code-coverage
fail-fast: false
build-packages:
name: Package NuGet
needs:
- build-wrappers
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
outputs:
package_version: ${{ steps.get-version.outputs.package_version }}
timeout-minutes: 30
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Setup JDK
uses: actions/setup-java@2e74cbce18569d23ca8b812590dbb83f13ac7c5a
with:
distribution: microsoft
java-version: 17
- name: Setup Android
uses: android-actions/setup-android@e1f5280adf78cf863c0fa43ffabc64a9cd08153f
- name: Install SDK platform 21
run: sdkmanager --install "platforms;android-21"
- uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59
with:
dotnet-version: 8.0.x
- name: Setup workloads
run: dotnet workload install tvos ios maccatalyst android
- name: Set version suffix
id: set-version-suffix
run: |-
$suffix = ""
if ($env:GITHUB_EVENT_NAME -eq "pull_request")
{
if (-Not "${{ github.head_ref }}".Contains("release"))
{
$suffix = "pr-${{ github.event.number }}.$env:GITHUB_RUN_NUMBER"
}
}
else
{
$suffix = "alpha.$env:GITHUB_RUN_NUMBER"
}
echo "build_suffix=$suffix" >> $Env:GITHUB_OUTPUT
shell: pwsh
- name: Fetch wrappers for macos
uses: actions/download-artifact@v4
with:
name: wrappers-macos
path: wrappers/build
- name: Fetch wrappers for catalyst
uses: actions/download-artifact@v4
with:
name: wrappers-catalyst
path: wrappers/build
- name: Fetch wrappers for linux-x86_64
uses: actions/download-artifact@v4
with:
name: wrappers-linux-x86_64
path: wrappers/build
- name: Fetch wrappers for linux-armhf
uses: actions/download-artifact@v4
with:
name: wrappers-linux-armhf
path: wrappers/build
- name: Fetch wrappers for linux-aarch64
uses: actions/download-artifact@v4
with:
name: wrappers-linux-aarch64
path: wrappers/build
- name: Fetch wrappers for android-armeabi-v7a
uses: actions/download-artifact@v4
with:
name: wrappers-android-armeabi-v7a
path: wrappers/build
- name: Fetch wrappers for android-arm64-v8a
uses: actions/download-artifact@v4
with:
name: wrappers-android-arm64-v8a
path: wrappers/build
- name: Fetch wrappers for android-x86
uses: actions/download-artifact@v4
with:
name: wrappers-android-x86
path: wrappers/build
- name: Fetch wrappers for android-x86_64
uses: actions/download-artifact@v4
with:
name: wrappers-android-x86_64
path: wrappers/build
- name: Fetch wrappers for windows-Win32
uses: actions/download-artifact@v4
with:
name: wrappers-windows-Win32
path: wrappers/build
- name: Fetch wrappers for windows-x64
uses: actions/download-artifact@v4
with:
name: wrappers-windows-x64
path: wrappers/build
- name: Fetch wrappers for windows-ARM64
uses: actions/download-artifact@v4
with:
name: wrappers-windows-ARM64
path: wrappers/build
- name: Fetch wrappers for windows-uwp-Win32
uses: actions/download-artifact@v4
with:
name: wrappers-windows-uwp-Win32
path: wrappers/build
- name: Fetch wrappers for windows-uwp-x64
uses: actions/download-artifact@v4
with:
name: wrappers-windows-uwp-x64
path: wrappers/build
- name: Fetch wrappers for windows-uwp-ARM
uses: actions/download-artifact@v4
with:
name: wrappers-windows-uwp-ARM
path: wrappers/build
- name: Fetch wrappers for windows-uwp-ARM64
uses: actions/download-artifact@v4
with:
name: wrappers-windows-uwp-ARM64
path: wrappers/build
- name: Fetch wrappers for iOS-Device
uses: actions/download-artifact@v4
with:
name: wrappers-iOS-Device
path: wrappers/build
- name: Fetch wrappers for iOS-Simulator
uses: actions/download-artifact@v4
with:
name: wrappers-iOS-Simulator
path: wrappers/build
- name: Fetch wrappers for tvOS-Device
uses: actions/download-artifact@v4
with:
name: wrappers-tvOS-Device
path: wrappers/build
- name: Fetch wrappers for tvOS-Simulator
uses: actions/download-artifact@v4
with:
name: wrappers-tvOS-Simulator
path: wrappers/build
- name: Add msbuild to PATH
if: ${{ runner.os == 'Windows' }}
uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9
- name: Build Realm/Realm
run: msbuild Realm/Realm -t:Pack -restore -p:Configuration=Release -p:PackageOutputPath=${{ github.workspace }}/Realm/packages -p:VersionSuffix=${{ steps.set-version-suffix.outputs.build_suffix }}
- name: Build Realm/Realm.PlatformHelpers
run: msbuild Realm/Realm.PlatformHelpers -t:Pack -restore -p:Configuration=Release -p:PackageOutputPath=${{ github.workspace }}/Realm/packages -p:VersionSuffix=${{ steps.set-version-suffix.outputs.build_suffix }}
- name: Build Realm/Realm.UnityUtils
run: msbuild Realm/Realm.UnityUtils -t:Pack -restore -p:Configuration=Release -p:PackageOutputPath=${{ github.workspace }}/Realm/packages -p:VersionSuffix=${{ steps.set-version-suffix.outputs.build_suffix }}
- name: Build Realm/Realm.UnityWeaver
run: msbuild Realm/Realm.UnityWeaver -t:Pack -restore -p:Configuration=Release -p:PackageOutputPath=${{ github.workspace }}/Realm/packages -p:VersionSuffix=${{ steps.set-version-suffix.outputs.build_suffix }}
- name: Read version
id: get-version
run: |-
cd Realm/packages
pkgVersion=$(find . -type f -regex ".*Realm.[1-9].*.nupkg" -exec basename {} \; | sed -n 's/Realm\.\(.*\)\.nupkg$/\1/p')
echo "package_version=$pkgVersion" >> $GITHUB_OUTPUT
shell: bash
- name: Store artifacts for Realm.${{ steps.get-version.outputs.package_version }}
uses: actions/upload-artifact@v4
with:
name: Realm.${{ steps.get-version.outputs.package_version }}
path: Realm/packages/Realm.${{ steps.get-version.outputs.package_version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for Realm.PlatformHelpers.${{ steps.get-version.outputs.package_version }}
uses: actions/upload-artifact@v4
with:
name: Realm.PlatformHelpers.${{ steps.get-version.outputs.package_version }}
path: Realm/packages/Realm.PlatformHelpers.${{ steps.get-version.outputs.package_version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for Realm.UnityUtils.${{ steps.get-version.outputs.package_version }}
uses: actions/upload-artifact@v4
with:
name: Realm.UnityUtils.${{ steps.get-version.outputs.package_version }}
path: Realm/packages/Realm.UnityUtils.${{ steps.get-version.outputs.package_version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for Realm.UnityWeaver.${{ steps.get-version.outputs.package_version }}
uses: actions/upload-artifact@v4
with:
name: Realm.UnityWeaver.${{ steps.get-version.outputs.package_version }}
path: Realm/packages/Realm.UnityWeaver.${{ steps.get-version.outputs.package_version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for ExtractedChangelog
uses: actions/upload-artifact@v4
with:
name: ExtractedChangelog
path: Realm/Realm/ExtractedChangelog.md
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Check Docfx cache
id: check-docfx-cache
if: contains(github.head_ref, 'release')
uses: actions/cache@v4
with:
path: C:\docfx
key: docfx-2.75.2
- name: Download docfx
if: contains(github.head_ref, 'release') && steps.check-docfx-cache.outputs.cache-hit != 'true'
run: |-
Invoke-WebRequest -Uri https://github.com/dotnet/docfx/releases/download/v2.75.2/docfx-win-x64-v2.75.2.zip -OutFile C:\docfx.zip
Expand-Archive -Path C:\docfx.zip -DestinationPath C:\docfx
- name: Build docs
if: contains(github.head_ref, 'release')
env:
DOCFX_SOURCE_BRANCH_NAME: ${{ github.head_ref }}
run: C:\docfx\docfx Docs/docfx.json
build-unity:
name: Package Unity
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 30
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.PlatformHelpers
uses: actions/download-artifact@v4
with:
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.UnityUtils
uses: actions/download-artifact@v4
with:
name: Realm.UnityUtils.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.UnityWeaver
uses: actions/download-artifact@v4
with:
name: Realm.UnityWeaver.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Build Unity
run: dotnet run --project Tools/SetupUnityPackage/ -- realm --packages-path Realm/packages --pack
- name: Store artifacts for io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
uses: actions/upload-artifact@v4
with:
name: io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
path: Realm/Realm.Unity/io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Build Tests
run: dotnet run --project Tools/SetupUnityPackage/ -- tests --realm-package Realm/Realm.Unity/io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
- name: Store artifacts for UnityTests
uses: actions/upload-artifact@v4
with:
name: UnityTests
path: Tests/Tests.Unity
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
build-unity-tests-linux:
name: Build Unity linux
needs:
- build-packages
- build-unity
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 30
runs-on:
- unity
- linux
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Cleanup Workspace
run: git clean -fdx
- name: Fetch io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
uses: actions/download-artifact@v4
with:
name: io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
path: Realm/Realm.Unity
- name: Fetch UnityTests
uses: actions/download-artifact@v4
with:
name: UnityTests
path: Tests/Tests.Unity
- name: Build Unity Tests
run: unity-editor -runTests -batchmode -projectPath ${{ github.workspace }}/Tests/Tests.Unity -testPlatform StandaloneLinux64 -testSettingsFile ${{ github.workspace }}/Tests/Tests.Unity/.TestConfigs/Mono-Net4.json -logFile -
- name: Store artifacts for UnityTestsRunner.linux
uses: actions/upload-artifact@v4
with:
name: UnityTestsRunner.linux
path: Tests/Tests.Unity/Player_StandaloneLinux64_Mono-Net4/
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
run-unity-tests-linux:
name: Test Unity linux
needs:
- build-unity-tests-linux
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch UnityTestsRunner.linux
uses: actions/download-artifact@v4
with:
name: UnityTestsRunner.linux
path: TestRunner
- name: Install xvfb
run: sudo apt install -y xvfb libglu1 libxcursor1
- name: Run Tests
run: |-
chmod +x ${{ github.workspace }}/TestRunner/PlayerWithTests.x86_64
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' ${{ github.workspace }}/TestRunner/PlayerWithTests.x86_64 -logFile - --result=${{ github.workspace }}/TestResults.xml
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Unity linux Mono-Net4
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
build-unity-tests-windows:
name: Build Unity windows
needs:
- build-packages
- build-unity
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 30
runs-on:
- unity
- windows
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Cleanup Workspace
run: git clean -fdx
- name: Fetch io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
uses: actions/download-artifact@v4
with:
name: io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
path: Realm/Realm.Unity
- name: Fetch UnityTests
uses: actions/download-artifact@v4
with:
name: UnityTests
path: Tests/Tests.Unity
- name: Build Unity Tests
run: unity-editor -runTests -batchmode -projectPath ${{ github.workspace }}/Tests/Tests.Unity -testPlatform StandaloneWindows64 -testSettingsFile ${{ github.workspace }}/Tests/Tests.Unity/.TestConfigs/Mono-Net4.json -logFile build.log
- name: Store artifacts for UnityTestsRunner.windows
uses: actions/upload-artifact@v4
with:
name: UnityTestsRunner.windows
path: Tests/Tests.Unity/Player_StandaloneWindows64_Mono-Net4/
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
run-unity-tests-windows:
name: Test Unity windows
needs:
- build-unity-tests-windows
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 30
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch UnityTestsRunner.windows
uses: actions/download-artifact@v4
with:
name: UnityTestsRunner.windows
path: TestRunner
- name: Run Tests
run: |-
Start-Process ${{ github.workspace }}\TestRunner\PlayerWithTests.exe -Wait -ArgumentList "-logFile","${{ github.workspace }}\test.log","--result=${{ github.workspace }}\TestResults.xml"
cat ${{ github.workspace }}\test.log
shell: pwsh
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Unity windows Mono-Net4
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-net-framework:
name: Test .NET Framework
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.PlatformHelpers
uses: actions/download-artifact@v4
with:
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Add msbuild to PATH
if: ${{ runner.os == 'Windows' }}
uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9
- name: Build Tests/Realm.Tests
run: msbuild Tests/Realm.Tests -restore -p:Configuration=Release -p:TargetFramework=net461 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} -p:RealmTestsStandaloneExe=true
- name: Run the tests
run: './Tests/Realm.Tests/bin/Release/net461/Realm.Tests.exe --result=TestResults.xml --labels=After '
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results .NET Framework
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-uwp:
name: Test UWP
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.PlatformHelpers
uses: actions/download-artifact@v4
with:
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Import test certificate
run: |-
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
$currentDirectory = Get-Location
[IO.File]::WriteAllBytes("${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx", $pfx_cert_byte)
certutil -f -p "${{ secrets.Pfx_Password }}" -importpfx my ${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx
shell: powershell
- name: Add msbuild to PATH
if: ${{ runner.os == 'Windows' }}
uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9
- name: Build Tests/Tests.UWP
run: msbuild Tests/Tests.UWP -restore -p:Configuration=Release -p:AppxBundle=Always -p:PackageCertificateKeyFile=${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx -p:PackageCertificatePassword=${{ secrets.Pfx_Password }} -p:UseDotNetNativeToolchain=false -p:AppxBundlePlatforms=x64 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Run the tests
run: ./Tests/Tests.UWP/RunTests.ps1 -ExtraAppArgs ''
shell: powershell
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results UWP
path: ${{ env.TEST_RESULTS }}
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-net-core:
name: Test ${{ matrix.framework }}, ${{ (matrix.os.runner == 'win81' && 'win81') || matrix.os.runtime }}
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: ${{ matrix.os.runner }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Cleanup Workspace
run: git clean -fdx
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.PlatformHelpers
uses: actions/download-artifact@v4
with:
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Clear nuget cache
if: ${{ matrix.os.runner == 'win81' }}
run: dotnet nuget locals all --clear
- name: Extract .NET version
id: get-net-version
run: |2-
NET_VERSION=$(echo '${{ matrix.framework }}.x' | sed 's/net//g')
echo "version=$NET_VERSION" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59
with:
dotnet-version: ${{ steps.get-net-version.outputs.version }}
- name: Publish Tests/Realm.Tests
run: dotnet publish Tests/Realm.Tests -c Release -f ${{ matrix.framework }} -r ${{ matrix.os.runtime }} -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} -p:RealmTestsStandaloneExe=true --no-self-contained
- name: Output executable path
id: dotnet-publish
run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/${{ matrix.framework }}/${{ matrix.os.runtime }}/Realm.Tests' >> $GITHUB_OUTPUT
shell: bash
- name: Run the tests
env:
DOTNET_DbgEnableMiniDump: 1
DOTNET_EnableCrashReport: 1
run: ${{ steps.dotnet-publish.outputs.executable-path }} --result=TestResults.xml --labels=After
- name: Archive core dump
if: ${{ failure() && runner.os != 'Windows' }}
uses: actions/upload-artifact@v4
with:
name: crash-report-net-core-${{ runner.os }}-${{ runner.arch }}
path: /tmp/coredump*
retention-days: 30
if-no-files-found: warn
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results ${{ matrix.framework }}, ${{ (matrix.os.runner == 'win81' && 'win81') || matrix.os.runtime }}
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
strategy:
matrix:
framework:
- net6.0
os:
- runner: windows-latest
runtime: win-x64
- runner: ubuntu-latest
runtime: linux-x64
- runner: macos-13
runtime: osx-x64
include:
- framework: net8.0
os:
runner: macos-14
runtime: osx-arm64
fail-fast: false
test-macos-xamarin:
name: Test Xamarin.macOS
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: macos-12
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.PlatformHelpers
uses: actions/download-artifact@v4
with:
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Add msbuild to PATH
if: ${{ runner.os == 'Windows' }}
uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9
- name: Build Tests/Tests.XamarinMac
run: msbuild Tests/Tests.XamarinMac -restore -p:Configuration=Release -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Run the tests
run: Tests/Tests.XamarinMac/bin/Release/Tests.XamarinMac.app/Contents/MacOS/Tests.XamarinMac --headless --result=${{ github.workspace }}/TestResults.xml --labels=All
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Xamarin.macOS
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-macos-maui:
name: Test Maui.MacCatalyst
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: macos-13
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.PlatformHelpers
uses: actions/download-artifact@v4
with:
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59
with:
dotnet-version: 8.0.x
- name: Setup workloads
run: dotnet workload install maui
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd
with:
xcode-version: latest-stable
- name: Build Tests/Tests.Maui
run: dotnet build Tests/Tests.Maui -c Release -f net8.0-maccatalyst -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Run the tests
run: 'Tests/Tests.Maui/bin/Release/net8.0-maccatalyst/maccatalyst-x64/Tests.Maui.app/Contents/MacOS/Tests.Maui --headless --result=${{ github.workspace }}/TestResults.xml --labels=All '
- name: Transform Results
run: xsltproc --output TestResults.xml_transformed.xml Tests/Realm.Tests/EmbeddedResources/nunit3-junit.xslt TestResults.xml
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Maui.MacCatalyst
path: TestResults.xml_transformed.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-ios-xamarin:
name: Test Xamarin.iOS
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: macos-12
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.PlatformHelpers
uses: actions/download-artifact@v4
with:
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Add msbuild to PATH
if: ${{ runner.os == 'Windows' }}
uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9
- name: Build Tests/Tests.iOS
run: msbuild Tests/Tests.iOS -restore -p:Configuration=Release -p:Platform=iPhoneSimulator -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Run on Simulator
uses: realm/ci-actions/run-ios-simulator@6418e15ed9bbdb19b7d456a347e5623779f95cdf
with:
appPath: Tests/Tests.iOS/bin/iPhoneSimulator/Release/Tests.iOS.app
bundleId: io.realm.dotnettests
iphoneToSimulate: iPhone-8
arguments: '--headless --result=${{ github.workspace }}/TestResults.xml --labels=All '
os: iOS
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Xamarin.iOS
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-ios-maui:
name: Test Maui.iOS
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: macos-13
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.PlatformHelpers
uses: actions/download-artifact@v4
with:
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59
with:
dotnet-version: 8.0.x
- name: Setup workloads
run: dotnet workload install maui
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd
with:
xcode-version: latest-stable
- name: Build Tests/Tests.Maui
run: dotnet build Tests/Tests.Maui -c Release -f net8.0-ios -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Run on Simulator
uses: realm/ci-actions/run-ios-simulator@6418e15ed9bbdb19b7d456a347e5623779f95cdf
with:
appPath: Tests/Tests.Maui/bin/Release/net8.0-ios/iossimulator-x64/Tests.Maui.app
bundleId: io.realm.mauitests
iphoneToSimulate: iPhone-15
arguments: '--headless --result=${{ github.workspace }}/TestResults.xml --labels=All '
os: iOS
- name: Transform Results
run: xsltproc --output TestResults.xml_transformed.xml Tests/Realm.Tests/EmbeddedResources/nunit3-junit.xslt TestResults.xml
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Maui.iOS
path: TestResults.xml_transformed.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-tvos:
name: Test Xamarin.tvOS
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: macos-12
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.PlatformHelpers
uses: actions/download-artifact@v4
with:
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Add msbuild to PATH
if: ${{ runner.os == 'Windows' }}
uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9
- name: Build Tests/Tests.XamarinTVOS
run: msbuild Tests/Tests.XamarinTVOS -restore -p:Configuration=Release -p:Platform=iPhoneSimulator -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Run on Simulator
uses: realm/ci-actions/run-ios-simulator@6418e15ed9bbdb19b7d456a347e5623779f95cdf
with:
appPath: Tests/Tests.XamarinTVOS/bin/iPhoneSimulator/Release/Tests.XamarinTVOS.app
bundleId: io.realm.Tests-XamarinTVOS
iphoneToSimulate: Apple-TV-1080p
arguments: '--headless --result=${{ github.workspace }}/TestResults.xml --labels=All '
os: tvOS
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Xamarin.tvOS
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-android-xamarin:
name: Test Xamarin.Android
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: windows-latest
steps:
- name: Setup JDK
uses: actions/setup-java@2e74cbce18569d23ca8b812590dbb83f13ac7c5a
with:
distribution: microsoft
java-version: 17
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.PlatformHelpers
uses: actions/download-artifact@v4
with:
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Add msbuild to PATH
if: ${{ runner.os == 'Windows' }}
uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9
- name: Build Tests/Tests.Android
run: msbuild Tests/Tests.Android -t:SignAndroidPackage -restore -p:Configuration=Release -p:AndroidUseSharedRuntime=False -p:EmbedAssembliesIntoApk=True -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_DEVICEFARM_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEVICEFARM_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Run the tests
id: run_tests
uses: ./.github/actions/run-android-device-farm-test
with:
apk-path: ${{ github.workspace }}/Tests/Tests.Android/bin/Release/io.realm.xamarintests-Signed.apk
app-id: io.realm.xamarintests
project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }}
device-pool-arn: ${{ secrets.DEVICEFARM_ANDROID_POOL_ARN }}
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Xamarin.Android
path: ${{ steps.run_tests.outputs.test-results-path }}
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-android-maui:
name: Test Maui.Android
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: windows-latest
steps:
- name: Setup JDK
uses: actions/setup-java@2e74cbce18569d23ca8b812590dbb83f13ac7c5a
with:
distribution: microsoft
java-version: 17
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.PlatformHelpers
uses: actions/download-artifact@v4
with:
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59
with:
dotnet-version: 8.0.x
- name: Setup workloads
run: dotnet workload install maui
- name: Publish Tests/Tests.Maui
run: dotnet publish Tests/Tests.Maui -c Release -f net8.0-android -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} --no-self-contained
- name: Output executable path
id: dotnet-publish
run: echo 'executable-path=./Tests/Tests.Maui/bin/Release/net8.0-android/null/Tests.Maui' >> $GITHUB_OUTPUT
shell: bash
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_DEVICEFARM_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEVICEFARM_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Run the tests
id: run_tests
uses: ./.github/actions/run-android-device-farm-test
with:
apk-path: ${{ github.workspace }}/Tests/Tests.Maui/bin/Release/net8.0-android/publish/io.realm.mauitests-Signed.apk
app-id: io.realm.mauitests
project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }}
device-pool-arn: ${{ secrets.DEVICEFARM_ANDROID_POOL_ARN }}
- name: Transform Results
run: xsltproc --output ${{ steps.run_tests.outputs.test-results-path }}_transformed.xml Tests/Realm.Tests/EmbeddedResources/nunit3-junit.xslt ${{ steps.run_tests.outputs.test-results-path }}
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Maui.Android
path: ${{ steps.run_tests.outputs.test-results-path }}_transformed.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-woven-classes:
name: Test Woven Classes
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.PlatformHelpers
uses: actions/download-artifact@v4
with:
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Publish Tests/Realm.Tests
run: dotnet publish Tests/Realm.Tests -c Release -f net8.0 -r win-x64 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} -p:RealmTestsStandaloneExe=true -p:TestWeavedClasses=true --no-self-contained
- name: Output executable path
id: dotnet-publish
run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/net8.0/win-x64/Realm.Tests' >> $GITHUB_OUTPUT
shell: bash
- name: Run the tests
run: ${{ steps.dotnet-publish.outputs.executable-path }} --result=TestResults.xml --labels=After
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Woven Classes
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-source-generation:
name: Test Source Generation
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59
with:
dotnet-version: 6.0.x
- name: Setup workloads
run: dotnet workload install android ${{ (runner.os != 'Linux' && 'tvos ios maccatalyst') || '' }}
- name: Publish Tests/SourceGenerators/Realm.SourceGenerator.Tests
run: dotnet publish Tests/SourceGenerators/Realm.SourceGenerator.Tests -c Release -f net6.0 -r win-x64 --no-self-contained
- name: Output executable path
id: dotnet-publish
run: echo 'executable-path=./Tests/SourceGenerators/Realm.SourceGenerator.Tests/bin/Release/net6.0/win-x64/Realm.SourceGenerator.Tests' >> $GITHUB_OUTPUT
shell: bash
- name: Run the tests
run: ${{ steps.dotnet-publish.outputs.executable-path }} --result=TestResults.xml --labels=After
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Source Generation
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-weaver:
name: Test Weaver
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: ${{ matrix.os.runner }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59
with:
dotnet-version: 6.0.x
- name: Setup workloads
run: dotnet workload install android ${{ (runner.os != 'Linux' && 'tvos ios maccatalyst') || '' }}
- name: Publish Tests/Weaver/Realm.Fody.Tests
run: dotnet publish Tests/Weaver/Realm.Fody.Tests -c Release -f net6.0 -r ${{ matrix.os.runtime }} --no-self-contained
- name: Output executable path
id: dotnet-publish
run: echo 'executable-path=./Tests/Weaver/Realm.Fody.Tests/bin/Release/net6.0/${{ matrix.os.runtime }}/Realm.Fody.Tests' >> $GITHUB_OUTPUT
shell: bash
- name: Run the tests
run: ${{ steps.dotnet-publish.outputs.executable-path }} --result=TestResults.xml --labels=After
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Weaver
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
strategy:
matrix:
os:
- runner: windows-latest
runtime: win-x64
- runner: ubuntu-latest
runtime: linux-x64
- runner: macos-14
runtime: osx-arm64
fail-fast: false
test-code-coverage:
name: Test Code Coverage
needs:
- build-wrappers
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch wrappers for linux-x86_64
uses: actions/download-artifact@v4
with:
name: wrappers-linux-x86_64
path: wrappers/build
- name: Deploy Apps
working-directory: Tools/DeployApps
run: dotnet run deploy-apps --baasaas-api-key=${{ secrets.BAASAAS_API_KEY }} --baas-differentiator=code-coverage-${{ github.run_id }}-${{ github.run_attempt }}
- name: Setup Coverlet & Report Generator
run: |-
dotnet tool install coverlet.console --tool-path tools
dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools
echo "${{ github.workspace }}/tools" >> $GITHUB_PATH
- name: Publish Tests/Realm.Tests
run: dotnet publish Tests/Realm.Tests -c Release -f net8.0 -r linux-x64 -p:RealmTestsStandaloneExe=true --no-self-contained
- name: Output executable path
id: dotnet-publish
run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/net8.0/linux-x64/Realm.Tests' >> $GITHUB_OUTPUT
shell: bash
- name: Run the tests
env:
DOTNET_DbgEnableMiniDump: 1
DOTNET_EnableCrashReport: 1
run: ./tools/coverlet ./Tests/Realm.Tests/bin/Release/net8.0/linux-x64 -t ${{ steps.dotnet-publish.outputs.executable-path }} -a '--result=TestResults.xml --labels=After --baasaas-api-key=${{ secrets.BAASAAS_API_KEY}} --baas-differentiator=code-coverage-${{ github.run_id }}-${{ github.run_attempt }}' -f lcov -o ./report.lcov --exclude '[Realm.Tests]*' --exclude '[Realm.Fody]*' --exclude '[Realm.PlatformHelpers]*'
- name: Archive core dump
if: ${{ failure() && runner.os != 'Windows' }}
uses: actions/upload-artifact@v4
with:
name: crash-report-net-core-${{ runner.os }}-${{ runner.arch }}
path: /tmp/coredump*
retention-days: 30
if-no-files-found: warn
- name: Publish Coverage
id: publish-coveralls
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ./report.lcov
git-commit: ${{ github.event.pull_request.head.sha }}
compare-sha: ${{ github.event.pull_request.base.sha }}
- name: Output Coveralls response
run: echo ${{ steps.publish-coveralls.outputs.coveralls-api-result }}
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Code Coverage
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
cleanup-baas:
name: Cleanup BaaS
needs:
- test-code-coverage
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59
with:
dotnet-version: 8.0.x
- name: Terminate Baas
working-directory: Tools/DeployApps
run: dotnet run terminate-baas --baasaas-api-key=${{ secrets.BAASAAS_API_KEY }} --baas-differentiator=${{ matrix.differentiator }}-${{ github.run_id }}-${{ github.run_attempt }}
strategy:
matrix:
differentiator:
- code-coverage
fail-fast: false
verify-namespaces:
name: Verify Namespaces
needs:
- build-packages
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.PlatformHelpers
uses: actions/download-artifact@v4
with:
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.UnityUtils
uses: actions/download-artifact@v4
with:
name: Realm.UnityUtils.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.UnityWeaver
uses: actions/download-artifact@v4
with:
name: Realm.UnityWeaver.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- run: dotnet tool install ilspycmd -g --version 8.0.0.7345
- name: Verify Namespaces
run: |-
$isFailure = $false
Get-ChildItem ./Realm/packages -Filter *.nupkg | Foreach-Object {
$targetPath = Join-Path ./Realm/packages $_.BaseName
Expand-Archive $_.FullName -DestinationPath $targetPath
Get-ChildItem $targetPath -Filter *.dll -Recurse | ForEach-Object {
if (-not ($_.FullName -match "runtimes")) {
$ilspyOutput = ilspycmd $_.FullName
$parentDll = $_.FullName
$ilspyOutput | ForEach-Object {
if ($_ -match "namespace.*Realm(\.|$)") {
Write-Output "::error file=$parentDll::Realm present in namespace - $($_)"
Set-Variable "isFailure" -Value $true
}
}
}
}
}
if ($isFailure) {
exit 1
}
shell: pwsh
lint:
name: Verify TODOs
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- uses: nirinchev/verify-todo@ffa352ac028b4cdc8bc626471d33aa341b3ab7c9
with:
token: ${{ secrets.GITHUB_TOKEN }}
include: '**/*.+(cs|cpp|hpp)'
exclude: wrappers/realm-core/**
pattern: \\WR[A-Z]+-[0-9]+