Rework some tests (#3460) #2378
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: main | |
"on": | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
publish-prerelease: | |
description: Indicates whether to publish the package to Sleet/npm | |
required: false | |
type: boolean | |
run-benchmark: | |
description: Indicates whether to run the benchmark tests | |
required: false | |
type: boolean | |
env: | |
REALM_DISABLE_ANALYTICS: true | |
DOTNET_NOLOGO: true | |
jobs: | |
build-wrappers: | |
uses: ./.github/workflows/wrappers.yml | |
name: Wrappers | |
deploy-cluster: | |
uses: ./.github/workflows/deploy-baas.yml | |
with: | |
differentiators: '["net-framework", "code-coverage", "uwp-managed", "xamarinmacos", "ios", "android", "maccatalyst"]' | |
BaseUrl: https://realm-qa.mongodb.com | |
AtlasBaseUrl: https://cloud-qa.mongodb.com | |
secrets: | |
AtlasProjectId: ${{ secrets.ATLAS_QA_PROJECT_ID }} | |
AtlasPublicKey: ${{ secrets.ATLAS_QA_PUBLIC_API_KEY }} | |
AtlasPrivateKey: ${{ secrets.ATLAS_QA_PRIVATE_API_KEY }} | |
build-packages: | |
uses: ./.github/workflows/build-packages.yml | |
name: Package | |
needs: | |
- build-wrappers | |
publish-packages-to-sleet: | |
runs-on: ubuntu-latest | |
name: Publish package to S3 | |
needs: | |
- build-packages | |
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && (github.event_name == 'push' || github.event.inputs.publish-prerelease) | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: false | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Fetch Realm.PlatformHelpers | |
uses: actions/download-artifact@v3 | |
with: | |
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }} | |
path: ${{ github.workspace }}/Realm/packages/ | |
- name: Fetch Realm | |
uses: actions/download-artifact@v3 | |
with: | |
name: Realm.${{ needs.build-packages.outputs.package_version }} | |
path: ${{ github.workspace }}/Realm/packages/ | |
- name: Configure .NET | |
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a | |
with: | |
dotnet-version: 6.0.x | |
- name: Install sleet | |
run: dotnet tool install -g sleet | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.NUGET_S3_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.NUGET_S3_SECRET_KEY }} | |
aws-region: us-east-1 | |
- name: NuGet Publish Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }} | |
run: sleet push ${{ github.workspace }}/Realm/packages/Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}.nupkg --config ${{ github.workspace }}/.github/sleet.json --source NugetSource | |
- name: NuGet Publish Realm.${{ needs.build-packages.outputs.package_version }} | |
run: sleet push ${{ github.workspace }}/Realm/packages/Realm.${{ needs.build-packages.outputs.package_version }}.nupkg --config ${{ github.workspace }}/.github/sleet.json --source NugetSource | |
build-unity: | |
uses: ./.github/workflows/build-unity.yml | |
name: Package | |
with: | |
version: ${{ needs.build-packages.outputs.package_version }} | |
needs: | |
- build-packages | |
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') | |
test-net-framework: | |
uses: ./.github/workflows/test-net-framework.yml | |
name: Test | |
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') | |
needs: | |
- build-packages | |
- deploy-cluster | |
with: | |
version: ${{ needs.build-packages.outputs.package_version }} | |
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }} | |
realmUrl: https://realm-qa.mongodb.com | |
atlasUrl: https://cloud-qa.mongodb.com | |
secrets: | |
AtlasProjectId: ${{ secrets.ATLAS_QA_PROJECT_ID }} | |
AtlasPublicKey: ${{ secrets.ATLAS_QA_PUBLIC_API_KEY }} | |
AtlasPrivateKey: ${{ secrets.ATLAS_QA_PRIVATE_API_KEY }} | |
test-uwp-managed: | |
uses: ./.github/workflows/test-uwp-managed.yml | |
name: Test | |
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') | |
needs: | |
- build-packages | |
- deploy-cluster | |
with: | |
version: ${{ needs.build-packages.outputs.package_version }} | |
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }} | |
realmUrl: https://realm-qa.mongodb.com | |
atlasUrl: https://cloud-qa.mongodb.com | |
secrets: | |
AtlasProjectId: ${{ secrets.ATLAS_QA_PROJECT_ID }} | |
AtlasPublicKey: ${{ secrets.ATLAS_QA_PUBLIC_API_KEY }} | |
AtlasPrivateKey: ${{ secrets.ATLAS_QA_PRIVATE_API_KEY }} | |
Pfx_Password: ${{ secrets.Pfx_Password }} | |
Base64_Encoded_Pfx: ${{ secrets.Base64_Encoded_Pfx }} | |
test-net-core: | |
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') | |
name: Test | |
needs: | |
- build-packages | |
uses: ./.github/workflows/test-net-core.yml | |
with: | |
version: ${{ needs.build-packages.outputs.package_version }} | |
framework: '["net6.0", "net7.0"]' | |
test-macos: | |
uses: ./.github/workflows/test-macos.yml | |
name: Test | |
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') | |
needs: | |
- build-packages | |
- deploy-cluster | |
with: | |
version: ${{ needs.build-packages.outputs.package_version }} | |
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }} | |
realmUrl: https://realm-qa.mongodb.com | |
atlasUrl: https://cloud-qa.mongodb.com | |
secrets: | |
AtlasProjectId: ${{ secrets.ATLAS_QA_PROJECT_ID }} | |
AtlasPublicKey: ${{ secrets.ATLAS_QA_PUBLIC_API_KEY }} | |
AtlasPrivateKey: ${{ secrets.ATLAS_QA_PRIVATE_API_KEY }} | |
test-ios: | |
uses: ./.github/workflows/test-ios.yml | |
name: Test | |
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') | |
needs: | |
- build-packages | |
- deploy-cluster | |
with: | |
version: ${{ needs.build-packages.outputs.package_version }} | |
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }} | |
realmUrl: https://realm-qa.mongodb.com | |
atlasUrl: https://cloud-qa.mongodb.com | |
secrets: | |
AtlasProjectId: ${{ secrets.ATLAS_QA_PROJECT_ID }} | |
AtlasPublicKey: ${{ secrets.ATLAS_QA_PUBLIC_API_KEY }} | |
AtlasPrivateKey: ${{ secrets.ATLAS_QA_PRIVATE_API_KEY }} | |
test-tvos: | |
uses: ./.github/workflows/test-tvos.yml | |
name: Test | |
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') | |
needs: | |
- build-packages | |
with: | |
version: ${{ needs.build-packages.outputs.package_version }} | |
secrets: {} | |
test-android: | |
uses: ./.github/workflows/test-android.yml | |
name: Test | |
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') | |
needs: | |
- build-packages | |
- deploy-cluster | |
with: | |
version: ${{ needs.build-packages.outputs.package_version }} | |
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }} | |
realmUrl: https://realm-qa.mongodb.com | |
atlasUrl: https://cloud-qa.mongodb.com | |
secrets: | |
AtlasProjectId: ${{ secrets.ATLAS_QA_PROJECT_ID }} | |
AtlasPublicKey: ${{ secrets.ATLAS_QA_PUBLIC_API_KEY }} | |
AtlasPrivateKey: ${{ secrets.ATLAS_QA_PRIVATE_API_KEY }} | |
AWS_DEVICEFARM_ACCESS_KEY_ID: ${{ secrets.AWS_DEVICEFARM_ACCESS_KEY_ID }} | |
AWS_DEVICEFARM_SECRET_ACCESS_KEY: ${{ secrets.AWS_DEVICEFARM_SECRET_ACCESS_KEY }} | |
DEVICEFARM_PROJECT_ARN: ${{ secrets.DEVICEFARM_PROJECT_ARN }} | |
DEVICEFARM_ANDROID_POOL_ARN: ${{ secrets.DEVICEFARM_ANDROID_POOL_ARN }} | |
test-xunit: | |
runs-on: windows-latest | |
name: Test xUnit Compatibility | |
timeout-minutes: 10 | |
needs: | |
- build-packages | |
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: false | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Register csc problem matcher | |
run: echo "::add-matcher::.github/problem-matchers/csc.json" | |
- name: Register msvc problem matcher | |
run: echo "::add-matcher::.github/problem-matchers/msvc.json" | |
- name: Fetch Realm.PlatformHelpers | |
uses: actions/download-artifact@v3 | |
with: | |
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }} | |
path: ${{ github.workspace }}/Realm/packages/ | |
- name: Fetch Realm | |
uses: actions/download-artifact@v3 | |
with: | |
name: Realm.${{ needs.build-packages.outputs.package_version }} | |
path: ${{ github.workspace }}/Realm/packages/ | |
- name: Publish Tests/Tests.XUnit | |
run: dotnet publish Tests/Tests.XUnit -c Release -f net6.0 -r win-x64 -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.XUnit/bin/Release/net6.0/win-x64' >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Run Tests | |
run: dotnet test ${{ steps.dotnet-publish.outputs.executable-path }}/Tests.XUnit.dll --logger GitHubActions | |
test-weaver: | |
uses: ./.github/workflows/test-weaver.yml | |
name: Test | |
test-code-coverage: | |
uses: ./.github/workflows/test-code-coverage.yml | |
name: Test | |
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') | |
needs: | |
- build-packages | |
- deploy-cluster | |
with: | |
version: ${{ needs.build-packages.outputs.package_version }} | |
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }} | |
realmUrl: https://realm-qa.mongodb.com | |
atlasUrl: https://cloud-qa.mongodb.com | |
secrets: | |
AtlasProjectId: ${{ secrets.ATLAS_QA_PROJECT_ID }} | |
AtlasPublicKey: ${{ secrets.ATLAS_QA_PUBLIC_API_KEY }} | |
AtlasPrivateKey: ${{ secrets.ATLAS_QA_PRIVATE_API_KEY }} | |
benchmark-linux: | |
name: Benchmark Linux | |
needs: build-packages | |
runs-on: performance-tests | |
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && (github.event_name == 'push' || github.event.inputs.run-benchmark) | |
timeout-minutes: 60 | |
steps: | |
- name: Cleanup Workspace | |
run: rm -rf "${{ github.workspace }}/*" | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: false | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Register csc problem matcher | |
run: echo "::add-matcher::.github/problem-matchers/csc.json" | |
- name: Register msvc problem matcher | |
run: echo "::add-matcher::.github/problem-matchers/msvc.json" | |
- name: Fetch Realm.PlatformHelpers | |
uses: actions/download-artifact@v3 | |
with: | |
name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }} | |
path: ${{ github.workspace }}/Realm/packages/ | |
- name: Fetch Realm | |
uses: actions/download-artifact@v3 | |
with: | |
name: Realm.${{ needs.build-packages.outputs.package_version }} | |
path: ${{ github.workspace }}/Realm/packages/ | |
- name: Publish Tests/Benchmarks/PerformanceTests | |
run: dotnet publish Tests/Benchmarks/PerformanceTests -c Release -f net6.0 -r linux-x64 -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/Benchmarks/PerformanceTests/bin/Release/net6.0/linux-x64' >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Run the tests | |
run: ${{ steps.dotnet-publish.outputs.executable-path }}/PerformanceTests -f "*" --join | |
- name: Find Results file | |
id: find-results-file | |
run: | | |
cd BenchmarkDotNet.Artifacts/results | |
file=$(basename BenchmarkRun*json) | |
echo "benchmark-results=$file" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Publish Benchmark Results | |
uses: ./.github/actions/benchmark-uploader | |
with: | |
realm-token: ${{ secrets.Realm_Token }} | |
file: ${{ github.workspace }}/BenchmarkDotNet.Artifacts/results/${{ steps.find-results-file.outputs.benchmark-results }} | |
dashboard-path: dashboard.charts | |
nuget-package: ${{ github.workspace }}/Realm/packages/Realm.${{ needs.build-packages.outputs.package_version }}.nupkg | |
- name: Store artifacts for dashboard.charts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dashboard.charts | |
path: ${{ github.workspace }}/dashboard.charts | |
retention-days: 30 | |
if-no-files-found: error | |
cleanup-cluster: | |
uses: ./.github/workflows/cleanup-baas.yml | |
if: always() | |
name: Cleanup | |
needs: | |
- deploy-cluster | |
- test-net-framework | |
- test-code-coverage | |
- test-uwp-managed | |
- test-macos | |
- test-ios | |
- test-android | |
with: | |
differentiators: '["net-framework", "code-coverage", "uwp-managed", "xamarinmacos", "ios", "android", "maccatalyst"]' | |
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }} | |
BaseUrl: https://realm-qa.mongodb.com | |
AtlasBaseUrl: https://cloud-qa.mongodb.com | |
secrets: | |
AtlasProjectId: ${{ secrets.ATLAS_QA_PROJECT_ID }} | |
AtlasPublicKey: ${{ secrets.ATLAS_QA_PUBLIC_API_KEY }} | |
AtlasPrivateKey: ${{ secrets.ATLAS_QA_PRIVATE_API_KEY }} |