Skip to content

Commit

Permalink
Merge branch 'main' into fp/progress-notifications
Browse files Browse the repository at this point in the history
# Conflicts:
#	wrappers/realm-core
#	wrappers/src/async_open_task_cs.cpp
#	wrappers/src/sync_session_cs.cpp
  • Loading branch information
papafe committed Apr 9, 2024
2 parents 1c4d112 + 46fa89b commit 3ecbb55
Show file tree
Hide file tree
Showing 109 changed files with 7,033 additions and 1,054 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Fixes #
## TODO

* [ ] Changelog entry
* [ ] Tests (if applicable)
* [ ] Tests
1 change: 1 addition & 0 deletions .github/actions/run-android-device-farm-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ runs:
with:
project_arn: ${{ inputs.project-arn}}
device_pool_arn: ${{ inputs.device-pool-arn }}
timeout: 3000
app_file: ${{ inputs.apk-path }}
app_type: ANDROID_APP
test_type: APPIUM_PYTHON
Expand Down
44 changes: 8 additions & 36 deletions .github/templates/build.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,7 @@

#@ ignoreSkippedJobsCondition = "always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')"

#! These secrets will run against cloud-dev on PRs or cloud-qa on merges to main. They're commented out
#! because it appears cloud-dev is quite unstable at this point (Aug 2022).
#! realm_BaseUrl = "${{ (" + isRelease + " && secrets.REALM_QA_BASE_URL) || secrets.REALM_BASE_URL }}"
#! atlas_BaseUrl = "${{ (" + isRelease + " && secrets.ATLAS_QA_BASE_URL) || secrets.ATLAS_BASE_URL }}"
#! secret_AtlasPublicKey = "${{ (" + isRelease + " && secrets.ATLAS_QA_PUBLIC_API_KEY) || secrets.ATLAS_PUBLIC_API_KEY }}"
#! secret_AtlasPrivateKey = "${{ (" + isRelease + " && secrets.ATLAS_QA_PRIVATE_API_KEY) || secrets.ATLAS_PRIVATE_API_KEY }}"
#! secret_AtlasProjectId = "${{ (" + isRelease + " && secrets.ATLAS_QA_PROJECT_ID) || secrets.ATLAS_PROJECT_ID }}"

#@ realm_BaseUrl = "https://realm-qa.mongodb.com"
#@ atlas_BaseUrl = "https://cloud-qa.mongodb.com"
#@ secret_AtlasPublicKey = "${{ secrets.ATLAS_QA_PUBLIC_API_KEY }}"
#@ secret_AtlasPrivateKey = "${{ secrets.ATLAS_QA_PRIVATE_API_KEY }}"
#@ secret_AtlasProjectId = "${{ secrets.ATLAS_QA_PROJECT_ID }}"
#@ secret_BaaSaasApiKey = "${{ secrets.BAASAAS_API_KEY }}"

#@ def getJobName(prefix, name):
#@ if (prefix != ""):
Expand All @@ -31,43 +19,34 @@
#@ for target in targets:
#@ differentiators.append('"' + getJobName("", target) + '"')
#@ end
deploy-cluster:
deploy-baas:
uses: ./.github/workflows/deploy-baas.yml
with:
differentiators: #@ '[' + ", ".join(differentiators) + ']'
BaseUrl: #@ realm_BaseUrl
AtlasBaseUrl: #@ atlas_BaseUrl
secrets:
AtlasProjectId: #@ secret_AtlasProjectId
AtlasPublicKey: #@ secret_AtlasPublicKey
AtlasPrivateKey: #@ secret_AtlasPrivateKey
BaaSaasApiKey: #@ secret_BaaSaasApiKey
#@ end

#! We need to have two input arrays because there is not a 1-to-1 correspondence between dependencies
#! and targets, for example for macOS.
#@ def cleanupBaas(dependencies = [], targets = []):
#@ needs = ["deploy-cluster"]
#@ needs = ["deploy-baas"]
#@ differentiators = []
#@ for dependency in dependencies:
#@ needs.append(getJobName("test", dependency))
#@ end
#@ for target in targets:
#@ differentiators.append('"' + getJobName("", target) + '"')
#@ end
cleanup-cluster:
cleanup-baas:
uses: ./.github/workflows/cleanup-baas.yml
if: always()
name: Cleanup
needs: #@ needs
with:
differentiators: #@ '[' + ", ".join(differentiators) + ']'
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }}
BaseUrl: #@ realm_BaseUrl
AtlasBaseUrl: #@ atlas_BaseUrl
secrets:
AtlasProjectId: #@ secret_AtlasProjectId
AtlasPublicKey: #@ secret_AtlasPublicKey
AtlasPrivateKey: #@ secret_AtlasPrivateKey
BaaSaasApiKey: #@ secret_BaaSaasApiKey
#@ end

#@ def runTests(name, runSyncTests = True, additionalSecrets = []):
Expand All @@ -79,20 +58,13 @@ cleanup-cluster:
needs:
- build-packages
#@ if runSyncTests:
- deploy-cluster
- deploy-baas
#@ end
with:
version: ${{ needs.build-packages.outputs.package_version }}
#@ if runSyncTests:
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }}
realmUrl: #@ realm_BaseUrl
atlasUrl: #@ atlas_BaseUrl
#@ end
secrets:
#@ if runSyncTests:
AtlasProjectId: #@ secret_AtlasProjectId
AtlasPublicKey: #@ secret_AtlasPublicKey
AtlasPrivateKey: #@ secret_AtlasPrivateKey
BaaSaasApiKey: #@ secret_BaaSaasApiKey
#@ end
#@ for secret in additionalSecrets:
#@yaml/text-templated-strings
Expand Down
3 changes: 3 additions & 0 deletions .github/templates/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ jobs:
- #@ template.replace(cleanupWorkspace())
- #@ template.replace(checkoutCode())
- #@ template.replace(fetchPackageArtifacts("needs.build-packages.outputs.package_version"))
#! To avoid NU5037 error
- name: Clear nuget cache
run: dotnet nuget locals all --clear
- #@ template.replace(dotnetBuildTests("Tests/Benchmarks/PerformanceTests", "net6.0", "linux-x64", "needs.build-packages.outputs.package_version"))
- name: Run the tests
run: #@ "${{ steps.dotnet-publish.outputs.executable-path }}/PerformanceTests -f \"*\" --join"
Expand Down
4 changes: 4 additions & 0 deletions .github/templates/test-net-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ jobs:

steps:
- #@ template.replace(prepareTest(cleanupWorkspace = True))
#! To avoid NU5037 error
- name: Clear nuget cache
run: dotnet nuget locals all --clear
if: ${{ matrix.os.runner == 'win81' }}
- #@ template.replace(dotnetBuildTests("Tests/Realm.Tests", "${{ matrix.framework }}", "${{ matrix.os.runtime }}"))
- name: Run the tests
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/templates/test-net-framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
run-tests:
runs-on: windows-latest
name: .NET Framework
timeout-minutes: 45
timeout-minutes: 60
steps:
- #@ template.replace(prepareTest("net-framework"))
- #@ template.replace(buildTests("Tests/Realm.Tests", TargetFramework="net461", RealmTestsStandaloneExe="true"))
Expand Down
2 changes: 1 addition & 1 deletion .github/templates/test-uwp-managed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
run-tests:
runs-on: windows-latest
name: UWP
timeout-minutes: 45
timeout-minutes: 60
steps:
- #@ template.replace(prepareTest("uwp-managed"))
- name: Import test certificate
Expand Down
37 changes: 10 additions & 27 deletions .github/templates/test.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#@ load("common.lib.yml", "actionDownloadArtifact", "msbuild", "dotnetPublish", "fetchWrapperBinaries", "checkoutCode", "fetchPackageArtifacts")

#@ def baasTestArgs(differentiator):
#@ return " --baasurl=${{ inputs.realmUrl }} --baascluster=${{ inputs.clusterName }}-"+ differentiator +" --baasapikey=${{ secrets.AtlasPublicKey}} --baasprivateapikey=${{ secrets.AtlasPrivateKey}} --baasprojectid=${{ secrets.AtlasProjectId }} --baasdifferentiator=" + differentiator
#@ return " --baasaas-api-key=${{ secrets.BaaSaasApiKey}} --baas-differentiator=" + differentiator + "-${{ github.run_id }}-${{ github.run_attempt }}"
#@ end
---
#@ def publishTestsResults(files, test_title):
Expand All @@ -26,27 +26,14 @@ with:
version:
required: true
type: string
clusterName:
required: false
type: string
realmUrl:
required: false
type: string
atlasUrl:
required: false
type: string
#@ for input in additionalInputs:
#@yaml/text-templated-strings
(@= input @):
required: true
type: string
#@ end
secrets:
AtlasProjectId:
required: false
AtlasPublicKey:
required: false
AtlasPrivateKey:
BaaSaasApiKey:
required: false
#@ for secret in additionalSecrets:
#@yaml/text-templated-strings
Expand Down Expand Up @@ -93,17 +80,13 @@ env:
- #@ template.replace(fetchPackageArtifacts())
#@ end
#@ if (differentiator != ""):
#! The following is used in case we need to re-run the action and the main deploy cluster job is not re-run too (because successful)
- uses: realm/ci-actions/mdb-realm/deploy@fa20eb972b9f018654fdb4e2c7afb52b0532f907
name: Deploy Cluster (alternative)
if: ${{ inputs.realmUrl }}
with:
projectId: ${{ secrets.AtlasProjectId}}
realmUrl: ${{ inputs.realmUrl }}
atlasUrl: ${{ inputs.atlasUrl}}
apiKey: ${{ secrets.AtlasPublicKey}}
privateApiKey: ${{ secrets.AtlasPrivateKey }}
clusterName: #@ "${{ inputs.clusterName }}-" + differentiator
clusterSize: M10
#! The following is used in case we need to re-run the action and the main deploy baas job is not re-run too (because successful)
- name: Deploy Baas (alternative)
#! Secrets cannot be used directly in if
env:
apiKey: ${{ secrets.BaaSaasApiKey }}
if: ${{ env.apiKey }}
run: #@ "dotnet run deploy-apps --baasaas-api-key=${{ secrets.BaaSaasApiKey }} --baas-differentiator=" + differentiator + "-${{ github.run_id }}-${{ github.run_attempt }}"
working-directory: Tools/DeployApps
#@ end
#@ end
2 changes: 1 addition & 1 deletion .github/workflows/check-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8230315d06ad95c617244d2f265d237a1682d445
uses: actions/checkout@v4
with:
submodules: false
- name: Enforce Changelog
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# NOTE: This is a common file that is overwritten by realm/ci-actions sync service
# and should only be modified in that repository.

name: "Check PR Title"
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled, converted_to_draft, edited]

jobs:
check-pr-title:
name: Check PR Title
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: false
- name: Enforce PR title
uses: realm/ci-actions/title-checker@main
with:
regex: R[A-Z]{2,6}-[0-9]{1,6}
error-hint: Invalid PR title. Make sure it's prefixed with the JIRA ticket the PR addresses or add the no-jira-ticket label.
ignore-labels: 'no-jira-ticket'
29 changes: 7 additions & 22 deletions .github/workflows/cleanup-baas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,15 @@ name: cleanup-baas
differentiators:
required: true
type: string
clusterName:
required: true
type: string
BaseUrl:
required: true
type: string
AtlasBaseUrl:
required: true
type: string
secrets:
AtlasProjectId:
required: true
AtlasPublicKey:
required: true
AtlasPrivateKey:
BaaSaasApiKey:
required: true
env:
REALM_DISABLE_ANALYTICS: true
DOTNET_NOLOGO: true
jobs:
cleanup-baas:
name: Cleanup Cluster
name: Cleanup Baas
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -38,11 +25,9 @@ jobs:
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- uses: realm/ci-actions/mdb-realm/cleanup@fa20eb972b9f018654fdb4e2c7afb52b0532f907
- uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a
with:
projectId: ${{ secrets.AtlasProjectId}}
realmUrl: ${{ inputs.BaseUrl }}
atlasUrl: ${{ inputs.AtlasBaseUrl}}
apiKey: ${{ secrets.AtlasPublicKey}}
privateApiKey: ${{ secrets.AtlasPrivateKey }}
clusterName: ${{ inputs.clusterName }}-${{ matrix.differentiator }}
dotnet-version: 6.0.x
- name: Terminate Baas
run: dotnet run terminate-baas --baasaas-api-key=${{ secrets.BaaSaasApiKey }} --baas-differentiator=${{ matrix.differentiator }}-${{ github.run_id }}-${{ github.run_attempt }}
working-directory: Tools/DeployApps
50 changes: 3 additions & 47 deletions .github/workflows/deploy-baas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,15 @@ name: deploy-baas
differentiators:
required: true
type: string
BaseUrl:
required: true
type: string
AtlasBaseUrl:
required: true
type: string
outputs:
clusterName:
value: ${{ jobs.deploy-baas.outputs.clusterName }}
secrets:
AtlasProjectId:
required: true
AtlasPublicKey:
required: true
AtlasPrivateKey:
BaaSaasApiKey:
required: true
env:
REALM_DISABLE_ANALYTICS: true
DOTNET_NOLOGO: true
jobs:
deploy-baas:
name: Deploy Cluster
runs-on: ubuntu-latest
strategy:
matrix:
differentiator: ${{ fromJson(inputs.differentiators) }}
outputs:
clusterName: ${{ steps.generate-cluster-name.outputs.clusterName }}
timeout-minutes: 20
steps:
- name: Generate cluster name
id: generate-cluster-name
run: |
name=$( echo ${{ github.run_id }}-${{ github.run_attempt }} | md5sum | cut -c1-7)
echo "clusterName=$name" >> "$GITHUB_OUTPUT"
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- uses: realm/ci-actions/mdb-realm/deploy@fa20eb972b9f018654fdb4e2c7afb52b0532f907
id: deploy-cluster
with:
projectId: ${{ secrets.AtlasProjectId}}
realmUrl: ${{ inputs.BaseUrl }}
atlasUrl: ${{ inputs.AtlasBaseUrl}}
apiKey: ${{ secrets.AtlasPublicKey}}
privateApiKey: ${{ secrets.AtlasPrivateKey }}
clusterName: ${{ steps.generate-cluster-name.outputs.clusterName }}-${{ matrix.differentiator }}
clusterSize: M5
deploy-apps:
name: Deploy Apps
needs: deploy-baas
name: Deploy Baas
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -73,5 +29,5 @@ jobs:
with:
dotnet-version: 6.0.x
- name: Deploy Apps
run: dotnet run . --baasurl=${{ inputs.BaseUrl }} --baascluster=${{ needs.deploy-baas.outputs.clusterName }}-${{ matrix.differentiator }} --baasapikey=${{ secrets.AtlasPublicKey }} --baasprivateapikey=${{ secrets.AtlasPrivateKey }} --baasprojectid=${{ secrets.AtlasProjectId }} --baasdifferentiator=${{ matrix.differentiator }}
run: dotnet run deploy-apps --baasaas-api-key=${{ secrets.BaaSaasApiKey }} --baas-differentiator=${{ matrix.differentiator }}-${{ github.run_id }}-${{ github.run_attempt }}
working-directory: Tools/DeployApps
2 changes: 1 addition & 1 deletion .github/workflows/issue-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
template: [ bug.yml, feature.yml ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Parse issue form
uses: stefanbuck/github-issue-parser@c1a559d78bfb8dd05216dab9ffd2b91082ff5324 # v3.0.1
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/lock-threads.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Lock Threads'

on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:

permissions:
issues: write
pull-requests: write
discussions: write

concurrency:
group: lock-threads

jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v5
with:
issue-inactive-days: 30
pr-inactive-days: 30
log-output: true
Loading

0 comments on commit 3ecbb55

Please sign in to comment.