Skip to content

Use pkl to generate gha workflows #1988

Use pkl to generate gha workflows

Use pkl to generate gha workflows #1988

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: 6.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
needs:
- build-wrappers
uses: ./.github/workflows/build-packages.yml
with:
build-docs: ${{ contains(github.head_ref, 'release') }}
build-unity:
name: Package
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
uses: ./.github/workflows/build-unity.yml
with:
version: ${{ needs.build-packages.outputs.package_version }}
test-unity:
name: Test
needs:
- build-unity
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
uses: ./.github/workflows/test-unity.yml
with:
version: ${{ needs.build-packages.outputs.package_version }}
settings: '["Mono-Net4"]'
platform: '[{ "os": "windows", "testPlatform": "Windows64" }, { "os": "linux", "testPlatform": "Linux64" }]'
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:
- net8.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: 11
- 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/configure-aws-credentials@v4.0.2
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: 11
- 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/configure-aws-credentials@v4.0.2
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/github-action@v2.3.0
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: 6.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]+