From 831b059f0e26bfc0fd55c70efd379624abff2fcc Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 13 Dec 2023 15:24:10 +0000 Subject: [PATCH 01/67] Testing device farm with Sync --- .../action.yml | 66 +++++++++++++++++++ .github/workflows/include-check-cache.yml | 34 ++++++++++ .github/workflows/pr.yml | 36 +++++++++- 3 files changed, 133 insertions(+), 3 deletions(-) create mode 100644 .github/actions/run-android-device-farm-sync-test/action.yml diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml new file mode 100644 index 0000000000..adfc1d4370 --- /dev/null +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -0,0 +1,66 @@ +name: 'Run Android tests on Device Farm' +inputs: + apk-path: + required: true + apk-auxiliary-path: + required: true + app-id: + required: true + project-arn: + required: true + device-pool-arn: + required: true + arguments: + default: _ +outputs: + test-results-path: + value: ${{ steps.get-test-results.outputs.results-path }} +runs: + using: "composite" + steps: + - name: Run the tests + uses: nhachicha/aws-devicefarm/test-application@034225295b7f7351606f1a752429d50dfbc43d58 + id: run-tests + with: + project_arn: ${{ inputs.project-arn }} + device_pool_arn: ${{ inputs.device-pool-arn }} + app_file: ${{ inputs.apk-path }} + auxiliaryApp: ${{ inputs.apk-path }} + app_type: ANDROID_APP + test_type: APPIUM_PYTHON + test_package_file: https://github.com/realm/aws-devicefarm-sample-data/releases/download/0.3/sample_env_python3.zip + test_package_type: APPIUM_PYTHON_TEST_PACKAGE + test_spec_file: test_spec-${{ inputs.app-id }}.yaml + test_spec_type: APPIUM_PYTHON_TEST_SPEC + remote_src: true + test_spec: | + version: 0.1 + phases: + install: + commands: + - export PYTHON_VERSION=3 + test: + commands: + - adb shell am instrument -w -r io.realm.sync.testapp.test/androidx.test.runner.AndroidJUnitRunner | egrep 'OK \([0-9]+ test[s]?\)' + + - run: | + Install-Module -Name AWSPowerShell -Force + echo "::group::Data" + echo (ConvertFrom-Json '${{ steps.run-tests.outputs.data }}' | ConvertTo-Json) + echo "::endgroup::" + Import-Module AWSPowerShell + $runs = Get-DFRunList -Arn ${{ inputs.project-arn }} + $jobs = Get-DFJobList -Arn $runs[0].Arn + $suites = Get-DFSuiteList -Arn $jobs[0].Arn + $fileArtifacts = Get-DFArtifactList -Arn $suites[1].Arn -Type File + echo "All File Artifacts:" + echo $fileArtifacts + $logCatArtifacts = $fileArtifacts | Where-Object { $_.Name -EQ "Logcat" } + echo "LogCat Artifacts:" + echo $logCatArtifacts + echo "::group::Logcat" + Invoke-WebRequest -Uri $logCatArtifacts[0].Url | Select-Object -Expand RawContent + echo "::endgroup::" + shell: pwsh + if: always() + name: Device Farm Output diff --git a/.github/workflows/include-check-cache.yml b/.github/workflows/include-check-cache.yml index dab536b5b2..f5e8d97bfd 100644 --- a/.github/workflows/include-check-cache.yml +++ b/.github/workflows/include-check-cache.yml @@ -28,6 +28,8 @@ on: value: ${{ jobs.check-cache.outputs.packages-android-cache-hit }} android-test-base-apk-cache-hit: value: ${{ jobs.check-cache.outputs.android-test-base-apk-cache-hit }} + android-test-sync-apk-cache-hit: + value: ${{ jobs.check-cache.outputs.android-test-sync-apk-cache-hit }} packages-macos-x64-cache-hit: value: ${{ jobs.check-cache.outputs.packages-macos-x64-cache-hit }} packages-macos-arm64-cache-hit: @@ -63,6 +65,7 @@ jobs: packages-jvm-cache-hit: ${{ steps.jvm-cache.outputs.cache-hit }} packages-android-cache-hit: ${{ steps.android-cache.outputs.cache-hit }} android-test-base-apk-cache-hit: ${{ steps.android-test-base-apk.outputs.cache-hit }} + android-test-sync-apk-cache-hit: ${{ steps.android-test-sync-apk.outputs.cache-hit }} packages-macos-x64-cache-hit: ${{ steps.macos-x64-cache.outputs.cache-hit }} packages-macos-arm64-cache-hit: ${{ steps.macos-arm64-cache.outputs.cache-hit }} packages-ios-x64-cache-hit: ${{ steps.ios-x64-cache.outputs.cache-hit }} @@ -276,6 +279,18 @@ jobs: path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk key: android-base-test-apk-key-${{ steps.packages-cache-key.outputs.sha }} + # + # Android Sync Test APK + # + - name: Check Android Sync Test APK + id: android-test-sync-apk + uses: cmelchior/cache@main + with: + key: android-sync-test-apk-key-${{ steps.packages-cache-key.outputs.sha }} + path: | + ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk + ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk + - name: Save Android Test APK uses: actions/upload-artifact@v3 if: always() && !cancelled() && steps.android-test-base-apk.outputs.cache-hit == 'true' @@ -284,6 +299,16 @@ jobs: path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk retention-days: 1 + - name: Save Android Sync Test APK + uses: actions/upload-artifact@v3 + if: always() && !cancelled() && steps.android-test-sync-apk.outputs.cache-hit == 'true' + with: + name: android-sync-test-apk-${{ steps.find-library-version.outputs.label }} + retention-days: 1 + path: | + ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk + ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk + - name: Delete Android Test APK cache files id: delete-cache-android-base-test-apk uses: JesseTG/rm@v1.0.3 @@ -291,6 +316,15 @@ jobs: with: path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk + - name: Delete Android Sync Test APK cache files + id: delete-cache-android-sync-test-apk + uses: JesseTG/rm@v1.0.3 + if: always() && !cancelled() && steps.android-test-sync-apk.outputs.cache-hit == 'true' + with: + path: | + ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk + ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk + # # MacOS arm64 # diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 99eb408024..e3f0294a50 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -588,6 +588,10 @@ jobs: working-directory: packages run: ./gradlew :test-base:assembleAndroidTest -PignoreNativeLibs=true + - name: Build Android Sync Test Apk + working-directory: packages + run: ./gradlew :test-sync:packageDebug :test-sync:assembleAndroidTest -PignoreNativeLibs=true + - name: Build packages working-directory: packages run: ./gradlew publishCIPackages -Prealm.kotlin.targets=android -PignoreNativeLibs=true -Prealm.kotlin.mainHost=false @@ -609,6 +613,14 @@ jobs: path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk key: android-base-test-apk-key-${{ needs.check-cache.outputs.packages-sha }} + - name: Store build cache for Android Sync Test APK + uses: actions/cache@v3 + with: + key: android-sync-test-apk-key-${{ needs.check-cache.outputs.packages-sha }} + path: | + ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk + ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk + # TODO Must match naming found in include-check-cache.yml - name: Upload artifacts uses: actions/upload-artifact@v3 @@ -1081,6 +1093,14 @@ jobs: name: android-base-test-apk-${{ needs.check-cache.outputs.version-label }} path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk + - name: Restore Android Sync Test APK + uses: actions/download-artifact@v3 + with: + name: android-sync-test-apk-${{ needs.check-cache.outputs.version-label }} + path: | + ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk + ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk + - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 with: @@ -1088,11 +1108,21 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_DEVICEFARM_SECRET_ACCESS_KEY }} aws-region: us-west-2 - - name: Run the tests - uses: ./.github/actions/run-android-device-farm-test +# - name: Run the tests +# uses: ./.github/actions/run-android-device-farm-test +# id: run_android_tests +# with: +# apk-path: ${{ github.workspace }}/packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk/test-base-debug-androidTest.apk +# app-id: io.realm.testapp.test +# project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} +# device-pool-arn: ${{ secrets.DEVICEFARM_POOL_ARN }} + + - name: Run the Sync tests + uses: ./.github/actions/run-android-device-farm-sync-test id: run_android_tests with: - apk-path: ${{ github.workspace }}/packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk/test-base-debug-androidTest.apk + apk-path: ${{ github.workspace }}/packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk + apk-auxiliary-path: ${{ github.workspace }}/packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk app-id: io.realm.testapp.test project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} device-pool-arn: ${{ secrets.DEVICEFARM_POOL_ARN }} From bca12b938af6e02c7e6e4c6474ef06a4b27b545b Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 13 Dec 2023 16:25:43 +0000 Subject: [PATCH 02/67] Adding missing conf --- .github/workflows/pr.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index e3f0294a50..ad9d1bfed4 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -636,6 +636,15 @@ jobs: path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk retention-days: 1 + - name: Upload Android Sync Test APK + uses: actions/upload-artifact@v3 + with: + name: android-sync-test-apk-${{ needs.check-cache.outputs.version-label }} + retention-days: 1 + path: | + ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk + ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk + # TODO: ccache is not being used by this build for some reason build-macos-x64-packages: runs-on: macos-latest From b6f136bd9b4e0639394b911b4618d66ebc413813 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 13 Dec 2023 17:50:44 +0000 Subject: [PATCH 03/67] Testing Baasaas --- packages/gradle.properties | 2 +- packages/test-sync/src/androidMain/AndroidManifest.xml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/gradle.properties b/packages/gradle.properties index 550fbad87f..f723dbbdef 100644 --- a/packages/gradle.properties +++ b/packages/gradle.properties @@ -64,7 +64,7 @@ testBuildType=debug # Properties controlling which test server to run sync tests against. Default is a local # test server that has been started by calling `/tools/sync_test_server/start_local_server.sh` -syncTestUrl=http://localhost:9090 +syncTestUrl=http://54.82.116.220:32770 syncTestAppNamePrefix=test-app syncTestLoginEmail=unique_user@domain.com syncTestLoginPassword=password diff --git a/packages/test-sync/src/androidMain/AndroidManifest.xml b/packages/test-sync/src/androidMain/AndroidManifest.xml index ab5ec361ca..ff9d65c6a1 100644 --- a/packages/test-sync/src/androidMain/AndroidManifest.xml +++ b/packages/test-sync/src/androidMain/AndroidManifest.xml @@ -18,9 +18,11 @@ + + + android:usesCleartextTraffic="true"> From 23888087e8e95d8a55e4610007914c27a471436c Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 13 Dec 2023 23:11:07 +0000 Subject: [PATCH 04/67] Fixing config --- .../run-android-device-farm-sync-test/action.yml | 3 ++- .github/workflows/pr.yml | 10 +++++----- packages/gradle.properties | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index adfc1d4370..c1fe5a32c9 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -25,7 +25,7 @@ runs: project_arn: ${{ inputs.project-arn }} device_pool_arn: ${{ inputs.device-pool-arn }} app_file: ${{ inputs.apk-path }} - auxiliaryApp: ${{ inputs.apk-path }} + auxiliaryApp: ${{ inputs.apk-auxiliary-path }} app_type: ANDROID_APP test_type: APPIUM_PYTHON test_package_file: https://github.com/realm/aws-devicefarm-sample-data/releases/download/0.3/sample_env_python3.zip @@ -41,6 +41,7 @@ runs: - export PYTHON_VERSION=3 test: commands: + - adb shell pm list packages | grep realm - adb shell am instrument -w -r io.realm.sync.testapp.test/androidx.test.runner.AndroidJUnitRunner | egrep 'OK \([0-9]+ test[s]?\)' - run: | diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ad9d1bfed4..f61c00a0ff 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1096,11 +1096,11 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Restore Android Test APK - uses: actions/download-artifact@v3 - with: - name: android-base-test-apk-${{ needs.check-cache.outputs.version-label }} - path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk +# - name: Restore Android Test APK +# uses: actions/download-artifact@v3 +# with: +# name: android-base-test-apk-${{ needs.check-cache.outputs.version-label }} +# path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk - name: Restore Android Sync Test APK uses: actions/download-artifact@v3 diff --git a/packages/gradle.properties b/packages/gradle.properties index f723dbbdef..ec42544830 100644 --- a/packages/gradle.properties +++ b/packages/gradle.properties @@ -64,7 +64,7 @@ testBuildType=debug # Properties controlling which test server to run sync tests against. Default is a local # test server that has been started by calling `/tools/sync_test_server/start_local_server.sh` -syncTestUrl=http://54.82.116.220:32770 +syncTestUrl=http://54.82.116.220:32791 syncTestAppNamePrefix=test-app syncTestLoginEmail=unique_user@domain.com syncTestLoginPassword=password From e1c930d810e502d06ef70a9b4842dd5cdd1f5f69 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 14 Dec 2023 00:33:07 +0000 Subject: [PATCH 05/67] Using correct auxiliary param name --- .github/actions/run-android-device-farm-sync-test/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index c1fe5a32c9..4c35809683 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -19,13 +19,13 @@ runs: using: "composite" steps: - name: Run the tests - uses: nhachicha/aws-devicefarm/test-application@034225295b7f7351606f1a752429d50dfbc43d58 + uses: nhachicha/aws-devicefarm/test-application@6649db58af66706eda92ebaf478d8fb31a814a82 id: run-tests with: project_arn: ${{ inputs.project-arn }} device_pool_arn: ${{ inputs.device-pool-arn }} app_file: ${{ inputs.apk-path }} - auxiliaryApp: ${{ inputs.apk-auxiliary-path }} + apk_auxiliary_file: ${{ inputs.apk-auxiliary-path }} app_type: ANDROID_APP test_type: APPIUM_PYTHON test_package_file: https://github.com/realm/aws-devicefarm-sample-data/releases/download/0.3/sample_env_python3.zip From 675bc40496fb6e588746ecc45dfc42cb12f0f94e Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 14 Dec 2023 01:08:29 +0000 Subject: [PATCH 06/67] Update pr.yml --- .github/workflows/pr.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f61c00a0ff..e4e3165499 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1106,9 +1106,7 @@ jobs: uses: actions/download-artifact@v3 with: name: android-sync-test-apk-${{ needs.check-cache.outputs.version-label }} - path: | - ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk - ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk + path: ./packages/test-sync/build/outputs/apk/ - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 @@ -1132,7 +1130,7 @@ jobs: with: apk-path: ${{ github.workspace }}/packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk apk-auxiliary-path: ${{ github.workspace }}/packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk - app-id: io.realm.testapp.test + app-id: io.realm.sync.testapp.test project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} device-pool-arn: ${{ secrets.DEVICEFARM_POOL_ARN }} From 42e3ffa38262c85bce65a4bcf52226fdb6039594 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 14 Dec 2023 01:45:02 +0000 Subject: [PATCH 07/67] debugging --- .github/actions/run-android-device-farm-sync-test/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index 4c35809683..f565a3b9c0 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -19,7 +19,7 @@ runs: using: "composite" steps: - name: Run the tests - uses: nhachicha/aws-devicefarm/test-application@6649db58af66706eda92ebaf478d8fb31a814a82 + uses: nhachicha/aws-devicefarm/test-application@c55f6647eb1c6bc78ec86857ef6a990fd84a6b98 id: run-tests with: project_arn: ${{ inputs.project-arn }} From c4d9a6f7ca6e27fcaaf2af79c2ab3f0d4fbd8f2f Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 14 Dec 2023 02:12:50 +0000 Subject: [PATCH 08/67] debug --- .github/actions/run-android-device-farm-sync-test/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index f565a3b9c0..c388077d00 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -19,7 +19,7 @@ runs: using: "composite" steps: - name: Run the tests - uses: nhachicha/aws-devicefarm/test-application@c55f6647eb1c6bc78ec86857ef6a990fd84a6b98 + uses: nhachicha/aws-devicefarm/test-application@972cd0cbd0d048ef977cb3f6399d12ec9b7bcb27 id: run-tests with: project_arn: ${{ inputs.project-arn }} @@ -41,7 +41,7 @@ runs: - export PYTHON_VERSION=3 test: commands: - - adb shell pm list packages | grep realm + - adb shell pm list packages | grep realm - adb shell am instrument -w -r io.realm.sync.testapp.test/androidx.test.runner.AndroidJUnitRunner | egrep 'OK \([0-9]+ test[s]?\)' - run: | From 1ad5a05ed9df7efd58a2152ace8d9deb2ff826db Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 14 Dec 2023 10:01:18 +0000 Subject: [PATCH 09/67] debug --- .github/actions/run-android-device-farm-sync-test/action.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index c388077d00..e9f19d8a2d 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -18,6 +18,11 @@ outputs: runs: using: "composite" steps: + - name: Log message using the console object + run: | + console.warn('>>>>>>>>>>>> Using new action with apk-auxiliary-path'); + echo "APK with AUX apps" + - name: Run the tests uses: nhachicha/aws-devicefarm/test-application@972cd0cbd0d048ef977cb3f6399d12ec9b7bcb27 id: run-tests From d68cb13d48af4e4dca4cb4b53b88506ce7152eee Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 14 Dec 2023 10:22:26 +0000 Subject: [PATCH 10/67] debug --- .github/actions/run-android-device-farm-sync-test/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index e9f19d8a2d..9b9f981dca 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -30,7 +30,7 @@ runs: project_arn: ${{ inputs.project-arn }} device_pool_arn: ${{ inputs.device-pool-arn }} app_file: ${{ inputs.apk-path }} - apk_auxiliary_file: ${{ inputs.apk-auxiliary-path }} + app_auxiliary_file: ${{ inputs.apk-auxiliary-path }} app_type: ANDROID_APP test_type: APPIUM_PYTHON test_package_file: https://github.com/realm/aws-devicefarm-sample-data/releases/download/0.3/sample_env_python3.zip From 05e30174fa1a327b2636da685107f32c95ae9621 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 14 Dec 2023 10:42:48 +0000 Subject: [PATCH 11/67] debug --- .github/actions/run-android-device-farm-sync-test/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index 9b9f981dca..1967c12db6 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -19,6 +19,7 @@ runs: using: "composite" steps: - name: Log message using the console object + shell: bash run: | console.warn('>>>>>>>>>>>> Using new action with apk-auxiliary-path'); echo "APK with AUX apps" From 2d5ad10f710501a9c638648fdaf0b47c4ad5ea23 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 14 Dec 2023 10:51:50 +0000 Subject: [PATCH 12/67] debug --- .../actions/run-android-device-farm-sync-test/action.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index 1967c12db6..b630245dd1 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -18,12 +18,6 @@ outputs: runs: using: "composite" steps: - - name: Log message using the console object - shell: bash - run: | - console.warn('>>>>>>>>>>>> Using new action with apk-auxiliary-path'); - echo "APK with AUX apps" - - name: Run the tests uses: nhachicha/aws-devicefarm/test-application@972cd0cbd0d048ef977cb3f6399d12ec9b7bcb27 id: run-tests @@ -47,7 +41,7 @@ runs: - export PYTHON_VERSION=3 test: commands: - - adb shell pm list packages | grep realm + - adb shell pm list packages |grep realm - adb shell am instrument -w -r io.realm.sync.testapp.test/androidx.test.runner.AndroidJUnitRunner | egrep 'OK \([0-9]+ test[s]?\)' - run: | From bd162ddd59a8e34bece9dcdbaaa2e0d4496d5a48 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 14 Dec 2023 11:11:21 +0000 Subject: [PATCH 13/67] debug --- .github/actions/run-android-device-farm-sync-test/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index b630245dd1..9e91a3dd03 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -19,7 +19,7 @@ runs: using: "composite" steps: - name: Run the tests - uses: nhachicha/aws-devicefarm/test-application@972cd0cbd0d048ef977cb3f6399d12ec9b7bcb27 + uses: nhachicha/aws-devicefarm/test-application@755918d1cdbcce207783ed350c1aaa75765e3881 id: run-tests with: project_arn: ${{ inputs.project-arn }} @@ -41,7 +41,7 @@ runs: - export PYTHON_VERSION=3 test: commands: - - adb shell pm list packages |grep realm + - adb shell pm list packages | grep realm - adb shell am instrument -w -r io.realm.sync.testapp.test/androidx.test.runner.AndroidJUnitRunner | egrep 'OK \([0-9]+ test[s]?\)' - run: | From 58e53ca9fe936075ef6310cffd33c1aa62a7c1ba Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 14 Dec 2023 16:59:18 +0000 Subject: [PATCH 14/67] debug --- .github/actions/run-android-device-farm-sync-test/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index 9e91a3dd03..5d6d530086 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -19,9 +19,11 @@ runs: using: "composite" steps: - name: Run the tests - uses: nhachicha/aws-devicefarm/test-application@755918d1cdbcce207783ed350c1aaa75765e3881 + uses: nhachicha/aws-devicefarm/test-application@master + id: run-tests with: + force-pull: true project_arn: ${{ inputs.project-arn }} device_pool_arn: ${{ inputs.device-pool-arn }} app_file: ${{ inputs.apk-path }} From 3e4ae6ee93eeccb1b597022f06d54f0aacbc69c2 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Dec 2023 11:43:45 +0000 Subject: [PATCH 15/67] Using BAAS CLI --- .github/workflows/pr.yml | 35 +++++++++++++++++++++++++++++++++-- packages/gradle.properties | 2 +- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index e4e3165499..5290dcdfc7 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -540,7 +540,28 @@ jobs: echo "/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH - # TODO This cmake version is not being used by the Android builds. Figure out why. + - name: Install JSON parser + run: brew install jq + + # checkout BAAS CLI repo + - name: Checkout code + uses: actions/checkout@v3 + with: + repository: 10gen/baasaas + ref: main + + # Start BAAS instance in the background + # We save the container id to poll against and get the hostname info later + - name: Start Baas instance in the background + id: baas_cli_start + working-directory: baasaas + env: + BAAS_CLI_API: ${{ secrets.BAAS_CLI_API_KEY }} + run: | + OUTPUT=$(APIKEY=$BAAS_CLI_API ./cli.sh start) + echo "::set-output name=baas_container_id::$OUTPUT" + + # TODO This cmake version is not being used by the Android builds. Figure out why. - name: Setup cmake uses: jwlawson/actions-setup-cmake@v1.13 with: @@ -588,9 +609,19 @@ jobs: working-directory: packages run: ./gradlew :test-base:assembleAndroidTest -PignoreNativeLibs=true + # We poll the previously started BAAS container to get the hostname of the container to use with Device Farm tests + - name: Fetching the BAAS CLI hostname + id: baas_cli_poll + working-directory: baasaas + env: + BAAS_CLI_API: ${{ secrets.BAAS_CLI_API_KEY }} + run: | + OUTPUT=$(APIKEY=$BAAS_CLI_API ./cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + echo "::set-output name=baas_container_hostname::$OUTPUT" + - name: Build Android Sync Test Apk working-directory: packages - run: ./gradlew :test-sync:packageDebug :test-sync:assembleAndroidTest -PignoreNativeLibs=true + run: ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:packageDebug :test-sync:assembleAndroidTest -PignoreNativeLibs=true - name: Build packages working-directory: packages diff --git a/packages/gradle.properties b/packages/gradle.properties index ec42544830..550fbad87f 100644 --- a/packages/gradle.properties +++ b/packages/gradle.properties @@ -64,7 +64,7 @@ testBuildType=debug # Properties controlling which test server to run sync tests against. Default is a local # test server that has been started by calling `/tools/sync_test_server/start_local_server.sh` -syncTestUrl=http://54.82.116.220:32791 +syncTestUrl=http://localhost:9090 syncTestAppNamePrefix=test-app syncTestLoginEmail=unique_user@domain.com syncTestLoginPassword=password From 4790747374680e50ab0be772d8bf01dd6b60f921 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Dec 2023 12:13:27 +0000 Subject: [PATCH 16/67] First step to cleanup BAAS instance --- .github/workflows/pr.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5290dcdfc7..a2ead806ab 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1165,6 +1165,11 @@ jobs: project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} device-pool-arn: ${{ secrets.DEVICEFARM_POOL_ARN }} + post: + - name: Stop BAAS container + run: | + echo "TODO use cli.sh to stop container id: ${{ needs.build-android-packages.steps.baas_cli_start.outputs.baas_container_id }}" + test-macos-packages: timeout-minutes: 30 strategy: From 9bdd55f43a355724e77de5df9696821351132d0d Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Dec 2023 12:37:47 +0000 Subject: [PATCH 17/67] Trigger manually GHA --- .github/workflows/pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a2ead806ab..5bd8951a36 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,5 +1,6 @@ name: PR Build on: + workflow_dispatch: # Add this line to enable manual triggering pull_request: paths-ignore: - '**.md' From 1a3309f6e30a2ae9ff62b468cabc0ac63069b209 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Dec 2023 21:05:56 +0000 Subject: [PATCH 18/67] Fixing job syntax --- .github/workflows/pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5bd8951a36..337197f3bf 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1166,10 +1166,11 @@ jobs: project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} device-pool-arn: ${{ secrets.DEVICEFARM_POOL_ARN }} - post: - name: Stop BAAS container run: | echo "TODO use cli.sh to stop container id: ${{ needs.build-android-packages.steps.baas_cli_start.outputs.baas_container_id }}" + if: always() + test-macos-packages: timeout-minutes: 30 From 982ede3bdef59f6630ed7bd4b3ce81382b3e563a Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Dec 2023 21:29:52 +0000 Subject: [PATCH 19/67] Using github token for private repo --- .github/workflows/pr.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 337197f3bf..4df3115692 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -545,11 +545,10 @@ jobs: run: brew install jq # checkout BAAS CLI repo - - name: Checkout code - uses: actions/checkout@v3 - with: - repository: 10gen/baasaas - ref: main + - name: Checkout BAAS repo + run: | + git clone https://${{ secrets.GITHUB_TOKEN }}@github.com/10gen/baasaas.git + # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later From c32881d53b9b51bcb689885c3768361a0ae77a1e Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Dec 2023 21:36:22 +0000 Subject: [PATCH 20/67] using GITHUB_TOKEN --- .github/workflows/pr.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4df3115692..f80d214653 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -546,8 +546,10 @@ jobs: # checkout BAAS CLI repo - name: Checkout BAAS repo + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - git clone https://${{ secrets.GITHUB_TOKEN }}@github.com/10gen/baasaas.git + git clone https://github.com/10gen/baasaas # Start BAAS instance in the background From e49209eb12596be9731ed98b4bc8ee12a6e48118 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Dec 2023 21:43:51 +0000 Subject: [PATCH 21/67] using Github cli to clone --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f80d214653..3ccb1fd944 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -549,7 +549,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - git clone https://github.com/10gen/baasaas + gh repo clone 10gen/baasaas # Start BAAS instance in the background From a72e7337d6993c09f0d2b7e84c17870898532fdc Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Dec 2023 21:53:39 +0000 Subject: [PATCH 22/67] login with github token --- .github/workflows/pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 3ccb1fd944..bd688b63b8 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -549,6 +549,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token gh repo clone 10gen/baasaas From 09377ce186ece0390fe31b1e46f0bea1a4f8a289 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Dec 2023 22:02:09 +0000 Subject: [PATCH 23/67] removing token from env --- .github/workflows/pr.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index bd688b63b8..ca045389b7 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -546,8 +546,6 @@ jobs: # checkout BAAS CLI repo - name: Checkout BAAS repo - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token gh repo clone 10gen/baasaas From 0dceaf26008acc9b69a44a2828b60b32a0c82113 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Dec 2023 22:47:49 +0000 Subject: [PATCH 24/67] Using REALM_CI_PAT --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ca045389b7..8fbc869539 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -547,7 +547,7 @@ jobs: # checkout BAAS CLI repo - name: Checkout BAAS repo run: | - echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token + echo ${{ secrets.REALM_CI_PAT }} | gh auth login --with-token gh repo clone 10gen/baasaas From 82d959a0c0e34342ffab11d2eeb084d467f65dd0 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Dec 2023 23:04:09 +0000 Subject: [PATCH 25/67] using REALM_REPO_PAT --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8fbc869539..f2699f3d08 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -547,7 +547,7 @@ jobs: # checkout BAAS CLI repo - name: Checkout BAAS repo run: | - echo ${{ secrets.REALM_CI_PAT }} | gh auth login --with-token + echo ${{ secrets.REALM_REPO_PAT }} | gh auth login --with-token gh repo clone 10gen/baasaas From ba6c6a6303ea5ac23e0ca3446b2103ac5718c5d5 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Dec 2023 23:21:22 +0000 Subject: [PATCH 26/67] using BAASAAS_REPO_PAT --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f2699f3d08..a20fcd6f4a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -547,7 +547,7 @@ jobs: # checkout BAAS CLI repo - name: Checkout BAAS repo run: | - echo ${{ secrets.REALM_REPO_PAT }} | gh auth login --with-token + echo ${{ secrets.BAASAAS_REPO_PAT }} | gh auth login --with-token gh repo clone 10gen/baasaas From 85c50967c148fe25c1d058eee709aeb24f8e8d77 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 16 Dec 2023 00:14:06 +0000 Subject: [PATCH 27/67] using BAAS_CLI --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a20fcd6f4a..033524b399 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -547,7 +547,7 @@ jobs: # checkout BAAS CLI repo - name: Checkout BAAS repo run: | - echo ${{ secrets.BAASAAS_REPO_PAT }} | gh auth login --with-token + echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token gh repo clone 10gen/baasaas From ec1dcd8ff677c96a0ed56b54b4b1c9c703236240 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 16 Dec 2023 00:49:48 +0000 Subject: [PATCH 28/67] Using APIKEY as env --- .github/workflows/pr.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 033524b399..768a027922 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -557,9 +557,9 @@ jobs: id: baas_cli_start working-directory: baasaas env: - BAAS_CLI_API: ${{ secrets.BAAS_CLI_API_KEY }} + APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - OUTPUT=$(APIKEY=$BAAS_CLI_API ./cli.sh start) + OUTPUT=$(./cli.sh start) echo "::set-output name=baas_container_id::$OUTPUT" # TODO This cmake version is not being used by the Android builds. Figure out why. @@ -615,9 +615,9 @@ jobs: id: baas_cli_poll working-directory: baasaas env: - BAAS_CLI_API: ${{ secrets.BAAS_CLI_API_KEY }} + APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - OUTPUT=$(APIKEY=$BAAS_CLI_API ./cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + OUTPUT=$(./cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "::set-output name=baas_container_hostname::$OUTPUT" - name: Build Android Sync Test Apk From 836a46981b8298948d78a4ac654f5c40a97a9f3f Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 16 Dec 2023 12:54:20 +0000 Subject: [PATCH 29/67] using bash --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 768a027922..3f5b727fdb 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -559,7 +559,7 @@ jobs: env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - OUTPUT=$(./cli.sh start) + OUTPUT=$(bash cli.sh start) echo "::set-output name=baas_container_id::$OUTPUT" # TODO This cmake version is not being used by the Android builds. Figure out why. @@ -617,7 +617,7 @@ jobs: env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - OUTPUT=$(./cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "::set-output name=baas_container_hostname::$OUTPUT" - name: Build Android Sync Test Apk From f032af4b141638fc5716d39d7a80f958761ee424 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 16 Dec 2023 15:22:51 +0000 Subject: [PATCH 30/67] Force running jobs --- .github/workflows/pr.yml | 43 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 3f5b727fdb..81213e9dfd 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -77,11 +77,11 @@ jobs: runs-on: ubuntu-latest needs: [check-cache, build-jni-swig-stub] if: | - always() && - !cancelled() && - !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') && - needs.check-cache.outputs.jni-linux-lib-cache-hit != 'true' + always() +# !cancelled() && +# !contains(needs.*.result, 'failure') && +# !contains(needs.*.result, 'cancelled') && +# needs.check-cache.outputs.jni-linux-lib-cache-hit != 'true' steps: - name: Checkout code @@ -136,11 +136,11 @@ jobs: runs-on: windows-latest needs: [check-cache, build-jni-swig-stub] if: | - always() && - !cancelled() && - !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') && - needs.check-cache.outputs.jni-windows-lib-cache-hit != 'true' + always() +# !cancelled() && +# !contains(needs.*.result, 'failure') && +# !contains(needs.*.result, 'cancelled') && +# needs.check-cache.outputs.jni-windows-lib-cache-hit != 'true' steps: - name: Checkout code @@ -200,11 +200,11 @@ jobs: runs-on: macos-latest needs: [check-cache, build-jni-swig-stub] if: | - always() && - !cancelled() && - !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') && - needs.check-cache.outputs.jni-windows-lib-cache-hit != 'true' + always() +# !cancelled() && +# !contains(needs.*.result, 'failure') && +# !contains(needs.*.result, 'cancelled') && +# needs.check-cache.outputs.jni-windows-lib-cache-hit != 'true' steps: - name: Checkout code @@ -391,11 +391,11 @@ jobs: runs-on: macos-latest needs: [check-cache, build-jvm-linux-native-lib, build-jvm-windows-native-lib, build-jvm-macos-native-lib] if: | - always() && - !cancelled() && - !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') && - needs.check-cache.outputs.packages-jvm-cache-hit != 'true' + always() +# !cancelled() && +# !contains(needs.*.result, 'failure') && +# !contains(needs.*.result, 'cancelled') && +# needs.check-cache.outputs.packages-jvm-cache-hit != 'true' steps: - name: Checkout code @@ -504,7 +504,8 @@ jobs: runs-on: ubuntu-latest needs: check-cache # needs: static-analysis - if: always() && !cancelled() && needs.check-cache.outputs.packages-android-cache-hit != 'true' +# if: always() && !cancelled() && needs.check-cache.outputs.packages-android-cache-hit != 'true' + if: always() steps: - name: Checkout code From 9353e04c3f49de8372ec2aa4b78caba318ec4b64 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 16 Dec 2023 15:35:39 +0000 Subject: [PATCH 31/67] disable non Linux JVM jobs --- .github/workflows/pr.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 81213e9dfd..840fddf330 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -136,7 +136,7 @@ jobs: runs-on: windows-latest needs: [check-cache, build-jni-swig-stub] if: | - always() + never() # !cancelled() && # !contains(needs.*.result, 'failure') && # !contains(needs.*.result, 'cancelled') && @@ -200,7 +200,7 @@ jobs: runs-on: macos-latest needs: [check-cache, build-jni-swig-stub] if: | - always() + never() # !cancelled() && # !contains(needs.*.result, 'failure') && # !contains(needs.*.result, 'cancelled') && @@ -389,7 +389,7 @@ jobs: # all Kotlin Multiplatform Metadata build-jvm-packages: runs-on: macos-latest - needs: [check-cache, build-jvm-linux-native-lib, build-jvm-windows-native-lib, build-jvm-macos-native-lib] + needs: [check-cache, build-jvm-linux-native-lib] if: | always() # !cancelled() && @@ -476,17 +476,17 @@ jobs: name: jni-linux-lib-${{ needs.check-cache.outputs.version-label }} path: ./packages/cinterop/build/realmLinuxBuild - - name: Restore Windows JNI lib - uses: actions/download-artifact@v3 - with: - name: jni-windows-lib-${{ needs.check-cache.outputs.version-label }} - path: ./packages/cinterop/build/realmWindowsBuild/Release - - - name: Restore MacOS JNI lib - uses: actions/download-artifact@v3 - with: - name: jni-macos-lib-${{ needs.check-cache.outputs.version-label }} - path: ./packages/cinterop/build/realmMacOsBuild +# - name: Restore Windows JNI lib +# uses: actions/download-artifact@v3 +# with: +# name: jni-windows-lib-${{ needs.check-cache.outputs.version-label }} +# path: ./packages/cinterop/build/realmWindowsBuild/Release +# +# - name: Restore MacOS JNI lib +# uses: actions/download-artifact@v3 +# with: +# name: jni-macos-lib-${{ needs.check-cache.outputs.version-label }} +# path: ./packages/cinterop/build/realmMacOsBuild - name: Build JVM Package working-directory: packages From c24801c770d1cd16215e65ecdc28772e387b01be Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 16 Dec 2023 15:44:29 +0000 Subject: [PATCH 32/67] fixing never --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 840fddf330..4c45f4eb77 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -136,7 +136,7 @@ jobs: runs-on: windows-latest needs: [check-cache, build-jni-swig-stub] if: | - never() + ${{ false == true }} # !cancelled() && # !contains(needs.*.result, 'failure') && # !contains(needs.*.result, 'cancelled') && @@ -200,7 +200,7 @@ jobs: runs-on: macos-latest needs: [check-cache, build-jni-swig-stub] if: | - never() + ${{ false == true }} # !cancelled() && # !contains(needs.*.result, 'failure') && # !contains(needs.*.result, 'cancelled') && From 7927e8b3591ce73c19cdafd43c7e0365ff220421 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 16 Dec 2023 17:06:22 +0000 Subject: [PATCH 33/67] disable copying jvm --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4c45f4eb77..084828e287 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -490,7 +490,7 @@ jobs: - name: Build JVM Package working-directory: packages - run: ./gradlew publishCIPackages -Prealm.kotlin.targets=jvm -PignoreNativeLibs=true -PcopyJvmABIs=true -Prealm.kotlin.mainHost=false + run: ./gradlew publishCIPackages -Prealm.kotlin.targets=jvm -PignoreNativeLibs=true -PcopyJvmABIs=false -Prealm.kotlin.mainHost=false - name: Upload artifacts uses: actions/upload-artifact@v3 From 27065ad47a6180820faeb74ffc1a8ecdc3459cd4 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Mon, 18 Dec 2023 13:36:07 +0000 Subject: [PATCH 34/67] Revert changes --- .github/workflows/pr.yml | 69 ++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 084828e287..3f5b727fdb 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -77,11 +77,11 @@ jobs: runs-on: ubuntu-latest needs: [check-cache, build-jni-swig-stub] if: | - always() -# !cancelled() && -# !contains(needs.*.result, 'failure') && -# !contains(needs.*.result, 'cancelled') && -# needs.check-cache.outputs.jni-linux-lib-cache-hit != 'true' + always() && + !cancelled() && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') && + needs.check-cache.outputs.jni-linux-lib-cache-hit != 'true' steps: - name: Checkout code @@ -136,11 +136,11 @@ jobs: runs-on: windows-latest needs: [check-cache, build-jni-swig-stub] if: | - ${{ false == true }} -# !cancelled() && -# !contains(needs.*.result, 'failure') && -# !contains(needs.*.result, 'cancelled') && -# needs.check-cache.outputs.jni-windows-lib-cache-hit != 'true' + always() && + !cancelled() && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') && + needs.check-cache.outputs.jni-windows-lib-cache-hit != 'true' steps: - name: Checkout code @@ -200,11 +200,11 @@ jobs: runs-on: macos-latest needs: [check-cache, build-jni-swig-stub] if: | - ${{ false == true }} -# !cancelled() && -# !contains(needs.*.result, 'failure') && -# !contains(needs.*.result, 'cancelled') && -# needs.check-cache.outputs.jni-windows-lib-cache-hit != 'true' + always() && + !cancelled() && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') && + needs.check-cache.outputs.jni-windows-lib-cache-hit != 'true' steps: - name: Checkout code @@ -389,13 +389,13 @@ jobs: # all Kotlin Multiplatform Metadata build-jvm-packages: runs-on: macos-latest - needs: [check-cache, build-jvm-linux-native-lib] + needs: [check-cache, build-jvm-linux-native-lib, build-jvm-windows-native-lib, build-jvm-macos-native-lib] if: | - always() -# !cancelled() && -# !contains(needs.*.result, 'failure') && -# !contains(needs.*.result, 'cancelled') && -# needs.check-cache.outputs.packages-jvm-cache-hit != 'true' + always() && + !cancelled() && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') && + needs.check-cache.outputs.packages-jvm-cache-hit != 'true' steps: - name: Checkout code @@ -476,21 +476,21 @@ jobs: name: jni-linux-lib-${{ needs.check-cache.outputs.version-label }} path: ./packages/cinterop/build/realmLinuxBuild -# - name: Restore Windows JNI lib -# uses: actions/download-artifact@v3 -# with: -# name: jni-windows-lib-${{ needs.check-cache.outputs.version-label }} -# path: ./packages/cinterop/build/realmWindowsBuild/Release -# -# - name: Restore MacOS JNI lib -# uses: actions/download-artifact@v3 -# with: -# name: jni-macos-lib-${{ needs.check-cache.outputs.version-label }} -# path: ./packages/cinterop/build/realmMacOsBuild + - name: Restore Windows JNI lib + uses: actions/download-artifact@v3 + with: + name: jni-windows-lib-${{ needs.check-cache.outputs.version-label }} + path: ./packages/cinterop/build/realmWindowsBuild/Release + + - name: Restore MacOS JNI lib + uses: actions/download-artifact@v3 + with: + name: jni-macos-lib-${{ needs.check-cache.outputs.version-label }} + path: ./packages/cinterop/build/realmMacOsBuild - name: Build JVM Package working-directory: packages - run: ./gradlew publishCIPackages -Prealm.kotlin.targets=jvm -PignoreNativeLibs=true -PcopyJvmABIs=false -Prealm.kotlin.mainHost=false + run: ./gradlew publishCIPackages -Prealm.kotlin.targets=jvm -PignoreNativeLibs=true -PcopyJvmABIs=true -Prealm.kotlin.mainHost=false - name: Upload artifacts uses: actions/upload-artifact@v3 @@ -504,8 +504,7 @@ jobs: runs-on: ubuntu-latest needs: check-cache # needs: static-analysis -# if: always() && !cancelled() && needs.check-cache.outputs.packages-android-cache-hit != 'true' - if: always() + if: always() && !cancelled() && needs.check-cache.outputs.packages-android-cache-hit != 'true' steps: - name: Checkout code From 2cd6561a514b0cfa106dcfe44c08cf76efa8f000 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Mon, 18 Dec 2023 14:04:15 +0000 Subject: [PATCH 35/67] Adding JVM Sync tests with BAAS --- .../action.yml | 1 - .github/workflows/pr.yml | 51 +++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index 5d6d530086..17071a94c2 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -23,7 +23,6 @@ runs: id: run-tests with: - force-pull: true project_arn: ${{ inputs.project-arn }} device_pool_arn: ${{ inputs.device-pool-arn }} app_file: ${{ inputs.apk-path }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 3f5b727fdb..713be983c0 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1334,6 +1334,23 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + # checkout BAAS CLI repo + - name: Checkout BAAS repo + run: | + echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token + gh repo clone 10gen/baasaas + + # Start BAAS instance in the background + # We save the container id to poll against and get the hostname info later + - name: Start Baas instance in the background + id: baas_cli_start + working-directory: baasaas + env: + APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + run: | + OUTPUT=$(bash cli.sh start) + echo "::set-output name=baas_container_id::$OUTPUT" + - name: Setup Java 11 uses: actions/setup-java@v3 with: @@ -1372,6 +1389,40 @@ jobs: list-tests: failed fail-on-error: true + # We poll the previously started BAAS container to get the hostname of the container to use with Device Farm tests + - name: Fetching the BAAS CLI hostname + id: baas_cli_poll + working-directory: baasaas + env: + APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + run: | + OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + echo "::set-output name=baas_container_hostname::$OUTPUT" + + - name: Run Sync tests + working-directory: packages + run: ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:jvmTest -PincludeSdkModules=false --info --no-daemon + + - name: Publish Sync Unit Test Results + uses: dorny/test-reporter@v1 + if: always() || failure() + with: + name: ${{ matrix.test-title }} + path: ./packages/test-sync/build/**/TEST-*.xml + reporter: java-junit + list-suites: failed + list-tests: failed + fail-on-error: true + + - name: Stopping the BAAS container + if: always() || failure() + working-directory: baasaas + env: + APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + run: | + bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + + package-all-artifacts: runs-on: ubuntu-latest needs: [check-cache, build-jvm-packages, build-android-packages, build-macos-x64-packages, build-macos-arm64-packages, build-ios-x64-packages, build-ios-arm64-packages, build-kotlin-metadata-package] From 46ce108d21e6c197c4c6e97d0e62da610c18e62c Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Mon, 18 Dec 2023 16:22:41 +0000 Subject: [PATCH 36/67] Add conditional run for windows test (BAAS CLI runs on bash) --- .github/workflows/pr.yml | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 713be983c0..86376598b9 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1337,8 +1337,10 @@ jobs: # checkout BAAS CLI repo - name: Checkout BAAS repo run: | - echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas + if [[ ${{ matrix.os }} != 'windows-latest' ]]; then + echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token + gh repo clone 10gen/baasaas + fi # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later @@ -1348,8 +1350,10 @@ jobs: env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - OUTPUT=$(bash cli.sh start) - echo "::set-output name=baas_container_id::$OUTPUT" + if [[ ${{ matrix.os }} != 'windows-latest' ]]; then + OUTPUT=$(bash cli.sh start) + echo "::set-output name=baas_container_id::$OUTPUT" + fi - name: Setup Java 11 uses: actions/setup-java@v3 @@ -1396,16 +1400,21 @@ jobs: env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') - echo "::set-output name=baas_container_hostname::$OUTPUT" + if [[ ${{ matrix.os }} != 'windows-latest' ]]; then + OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + echo "::set-output name=baas_container_hostname::$OUTPUT" + fi - name: Run Sync tests working-directory: packages - run: ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:jvmTest -PincludeSdkModules=false --info --no-daemon + run: | + if [[ ${{ matrix.os }} != 'windows-latest' ]]; then + ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:jvmTest -PincludeSdkModules=false --info --no-daemon + fi - name: Publish Sync Unit Test Results uses: dorny/test-reporter@v1 - if: always() || failure() + if: matrix.os == 'windows-latest' || failure() with: name: ${{ matrix.test-title }} path: ./packages/test-sync/build/**/TEST-*.xml @@ -1420,7 +1429,9 @@ jobs: env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + if [[ ${{ matrix.os }} != 'windows-latest' ]]; then + bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + fi package-all-artifacts: From 7c7cf595bd3eba39166e9c24e70e963afcd5c33e Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Mon, 18 Dec 2023 16:41:51 +0000 Subject: [PATCH 37/67] Fixing syntax --- .github/workflows/pr.yml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 86376598b9..447b70b231 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1336,24 +1336,22 @@ jobs: # checkout BAAS CLI repo - name: Checkout BAAS repo + if: matrix.os == 'windows-latest' run: | - if [[ ${{ matrix.os }} != 'windows-latest' ]]; then - echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas - fi + echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token + gh repo clone 10gen/baasaas # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later - name: Start Baas instance in the background + if: matrix.os == 'windows-latest' id: baas_cli_start working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - if [[ ${{ matrix.os }} != 'windows-latest' ]]; then - OUTPUT=$(bash cli.sh start) - echo "::set-output name=baas_container_id::$OUTPUT" - fi + OUTPUT=$(bash cli.sh start) + echo "::set-output name=baas_container_id::$OUTPUT" - name: Setup Java 11 uses: actions/setup-java@v3 @@ -1395,22 +1393,20 @@ jobs: # We poll the previously started BAAS container to get the hostname of the container to use with Device Farm tests - name: Fetching the BAAS CLI hostname + if: matrix.os == 'windows-latest' id: baas_cli_poll working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - if [[ ${{ matrix.os }} != 'windows-latest' ]]; then - OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') - echo "::set-output name=baas_container_hostname::$OUTPUT" - fi + OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + echo "::set-output name=baas_container_hostname::$OUTPUT" - name: Run Sync tests + if: matrix.os == 'windows-latest' working-directory: packages run: | - if [[ ${{ matrix.os }} != 'windows-latest' ]]; then - ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:jvmTest -PincludeSdkModules=false --info --no-daemon - fi + ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:jvmTest -PincludeSdkModules=false --info --no-daemon - name: Publish Sync Unit Test Results uses: dorny/test-reporter@v1 From 6ef9e6e6d50f658fcd9c6646e2453df86abf35be Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Mon, 18 Dec 2023 16:57:51 +0000 Subject: [PATCH 38/67] Wrong conditional runs --- .github/workflows/pr.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 447b70b231..01862533f9 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1336,7 +1336,7 @@ jobs: # checkout BAAS CLI repo - name: Checkout BAAS repo - if: matrix.os == 'windows-latest' + if: matrix.os != 'windows-latest' run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token gh repo clone 10gen/baasaas @@ -1344,7 +1344,7 @@ jobs: # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later - name: Start Baas instance in the background - if: matrix.os == 'windows-latest' + if: matrix.os != 'windows-latest' id: baas_cli_start working-directory: baasaas env: @@ -1393,7 +1393,7 @@ jobs: # We poll the previously started BAAS container to get the hostname of the container to use with Device Farm tests - name: Fetching the BAAS CLI hostname - if: matrix.os == 'windows-latest' + if: matrix.os != 'windows-latest' id: baas_cli_poll working-directory: baasaas env: @@ -1403,7 +1403,7 @@ jobs: echo "::set-output name=baas_container_hostname::$OUTPUT" - name: Run Sync tests - if: matrix.os == 'windows-latest' + if: matrix.os != 'windows-latest' working-directory: packages run: | ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:jvmTest -PincludeSdkModules=false --info --no-daemon From e914723743ddc229b2c84562ebfd6ca6fca8a0b2 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Mon, 18 Dec 2023 17:15:28 +0000 Subject: [PATCH 39/67] More Syntax fix --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 01862533f9..32d45ba616 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1410,7 +1410,7 @@ jobs: - name: Publish Sync Unit Test Results uses: dorny/test-reporter@v1 - if: matrix.os == 'windows-latest' || failure() + if: matrix.os != 'windows-latest' with: name: ${{ matrix.test-title }} path: ./packages/test-sync/build/**/TEST-*.xml @@ -1420,7 +1420,7 @@ jobs: fail-on-error: true - name: Stopping the BAAS container - if: always() || failure() + if: matrix.os != 'windows-latest' working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} From 7fc8bd33bea7e3d5206c77e249071f1e0721e4c9 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Mon, 18 Dec 2023 22:54:19 +0000 Subject: [PATCH 40/67] Removing deprecated set-output --- .github/workflows/pr.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 32d45ba616..cefa021f06 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -560,7 +560,7 @@ jobs: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | OUTPUT=$(bash cli.sh start) - echo "::set-output name=baas_container_id::$OUTPUT" + echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT # TODO This cmake version is not being used by the Android builds. Figure out why. - name: Setup cmake @@ -618,7 +618,7 @@ jobs: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') - echo "::set-output name=baas_container_hostname::$OUTPUT" + echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Build Android Sync Test Apk working-directory: packages @@ -1351,7 +1351,7 @@ jobs: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | OUTPUT=$(bash cli.sh start) - echo "::set-output name=baas_container_id::$OUTPUT" + echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 uses: actions/setup-java@v3 @@ -1400,7 +1400,7 @@ jobs: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') - echo "::set-output name=baas_container_hostname::$OUTPUT" + echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Run Sync tests if: matrix.os != 'windows-latest' @@ -1418,16 +1418,14 @@ jobs: list-suites: failed list-tests: failed fail-on-error: true - + finally: - name: Stopping the BAAS container if: matrix.os != 'windows-latest' working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - if [[ ${{ matrix.os }} != 'windows-latest' ]]; then - bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} - fi + bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} package-all-artifacts: From f22d43e422e228f0f3f3013f4192320cbb40afe5 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Mon, 18 Dec 2023 23:10:15 +0000 Subject: [PATCH 41/67] Removing finally --- .github/workflows/pr.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index cefa021f06..e2d6773063 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1418,14 +1418,16 @@ jobs: list-suites: failed list-tests: failed fail-on-error: true - finally: + - name: Stopping the BAAS container if: matrix.os != 'windows-latest' working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then + bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + fi package-all-artifacts: From ddb0ac288c2212d5bf5c752c377cfb4d6439a12d Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Mon, 18 Dec 2023 23:53:00 +0000 Subject: [PATCH 42/67] Using tag when starting baas with cli --- .github/workflows/pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index e2d6773063..aea16913d9 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1350,7 +1350,7 @@ jobs: env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - OUTPUT=$(bash cli.sh start) + OUTPUT=$(bash cli.sh start -t foo=bar) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 @@ -1410,7 +1410,7 @@ jobs: - name: Publish Sync Unit Test Results uses: dorny/test-reporter@v1 - if: matrix.os != 'windows-latest' + if: always() && matrix.os != 'windows-latest' with: name: ${{ matrix.test-title }} path: ./packages/test-sync/build/**/TEST-*.xml @@ -1420,7 +1420,7 @@ jobs: fail-on-error: true - name: Stopping the BAAS container - if: matrix.os != 'windows-latest' + if: always() && matrix.os != 'windows-latest' working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} From 2782aa465f5aad6b29e2dd27a142da9933275671 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 19 Dec 2023 00:29:28 +0000 Subject: [PATCH 43/67] Custom Sync report --- .github/workflows/pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index aea16913d9..993fdaf667 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1384,7 +1384,7 @@ jobs: uses: dorny/test-reporter@v1 if: always() || failure() with: - name: ${{ matrix.test-title }} + name: ${{ matrix.test-title }} path: ./packages/test-base/build/**/TEST-*.xml reporter: java-junit list-suites: failed @@ -1410,9 +1410,9 @@ jobs: - name: Publish Sync Unit Test Results uses: dorny/test-reporter@v1 - if: always() && matrix.os != 'windows-latest' + if: ${{ !cancelled() && matrix.os != 'windows-latest' }} with: - name: ${{ matrix.test-title }} + name: "Sync - ${{ matrix.test-title }}" path: ./packages/test-sync/build/**/TEST-*.xml reporter: java-junit list-suites: failed From 509aae0e31ee393aafef239689f1e36bec2a6230 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 19 Dec 2023 01:31:30 +0000 Subject: [PATCH 44/67] Adding macOS & iOS Sync tests --- .github/workflows/pr.yml | 114 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 993fdaf667..8bbf3cc9a5 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1200,6 +1200,25 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + # checkout BAAS CLI repo + - name: Checkout BAAS repo + run: | + echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token + gh repo clone 10gen/baasaas + + # Start BAAS instance in the background + # We save the container id to poll against and get the hostname info later + - name: Start Baas instance in the background + id: baas_cli_start + working-directory: baasaas + env: + APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + run: | + # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner + # curl: option --data: error encountered when reading a file + OUTPUT=$(bash cli.sh start -t foo=bar) + echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT + - name: Setup Java 11 uses: actions/setup-java@v3 with: @@ -1235,7 +1254,43 @@ jobs: reporter: java-junit list-suites: failed list-tests: failed - fail-on-error: true + fail-on-error: true + + # We poll the previously started BAAS container to get the hostname of the container to use with Device Farm tests + - name: Fetching the BAAS CLI hostname + id: baas_cli_poll + working-directory: baasaas + env: + APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + run: | + OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT + + - name: Run Sync tests + working-directory: packages + run: | + ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:macosTest -PincludeSdkModules=false --info --no-daemon + + - name: Publish Sync Unit Test Results + uses: dorny/test-reporter@v1 + if: always() || failure() + with: + name: "Sync ${{ matrix.test-title }}" + path: ./packages/test-sync/build/**/TEST-*.xml + reporter: java-junit + list-suites: failed + list-tests: failed + fail-on-error: true + + - name: Stopping the BAAS container + if: always() + working-directory: baasaas + env: + APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + run: | + if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then + bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + fi test-ios-packages: timeout-minutes: 30 @@ -1265,6 +1320,25 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + # checkout BAAS CLI repo + - name: Checkout BAAS repo + run: | + echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token + gh repo clone 10gen/baasaas + + # Start BAAS instance in the background + # We save the container id to poll against and get the hostname info later + - name: Start Baas instance in the background + id: baas_cli_start + working-directory: baasaas + env: + APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + run: | + # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner + # curl: option --data: error encountered when reading a file + OUTPUT=$(bash cli.sh start -t foo=bar) + echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT + - name: Setup Java 11 uses: actions/setup-java@v3 with: @@ -1308,6 +1382,42 @@ jobs: list-tests: failed fail-on-error: true + # We poll the previously started BAAS container to get the hostname of the container to use with Device Farm tests + - name: Fetching the BAAS CLI hostname + id: baas_cli_poll + working-directory: baasaas + env: + APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + run: | + OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT + + - name: Run Sync tests + working-directory: packages + run: | + ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:iosTest -PincludeSdkModules=false --info --no-daemon + + - name: Publish Sync Unit Test Results + uses: dorny/test-reporter@v1 + if: always() || failure() + with: + name: "Sync ${{ matrix.test-title }}" + path: ./packages/test-sync/build/**/TEST-*.xml + reporter: java-junit + list-suites: failed + list-tests: failed + fail-on-error: true + + - name: Stopping the BAAS container + if: always() + working-directory: baasaas + env: + APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + run: | + if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then + bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + fi + # TODO Investigate why these tests seem to hang for the `run tests` step with no log output. Could it be related to the test failing, but not being picked up? test-jvm-packages: timeout-minutes: 30 @@ -1350,6 +1460,8 @@ jobs: env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | + # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner + # curl: option --data: error encountered when reading a file OUTPUT=$(bash cli.sh start -t foo=bar) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT From 0fcb4aa4dfebd2c278f9bfbab2bfd22f6a4206b0 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 19 Dec 2023 22:31:47 +0000 Subject: [PATCH 45/67] Device farm replay --- .github/workflows/pr.yml | 199 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 186 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8bbf3cc9a5..b339b8441c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -499,13 +499,8 @@ jobs: path: ./packages/build/m2-buildrepo/**/* retention-days: 1 - - build-android-packages: + build-android-packages-no-caching: runs-on: ubuntu-latest - needs: check-cache - # needs: static-analysis - if: always() && !cancelled() && needs.check-cache.outputs.packages-android-cache-hit != 'true' - steps: - name: Checkout code uses: actions/checkout@v3 @@ -549,7 +544,7 @@ jobs: run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token gh repo clone 10gen/baasaas - + # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later @@ -568,12 +563,12 @@ jobs: with: cmake-version: '3.25.2' - # TODO This Ninja version is not being used by the Android builds. Figure out why. + # TODO This Ninja version is not being used by the Android builds. Figure out why. - name: Setup ninja uses: cmelchior/setup-ninja@master with: version: '1.11.0' - + # TODO This might not work on Windows: https://github.com/hendrikmuhs/ccache-action#notes-on-windows-support - name: Install ccache uses: hendrikmuhs/ccache-action@v1.2.2 @@ -592,7 +587,7 @@ jobs: echo '#!/bin/bash\nccache clang "$@"%"' > /usr/local/bin/ccache-clang echo '#!/bin/bash\nccache clang++ "$@"%"' > /usr/local/bin/ccache-clang++ - # TODO This matches 23.2.8568313, but what happens if we a define specific ndk version in our build? + # TODO This matches 23.2.8568313, but what happens if we a define specific ndk version in our build? - name: Setup NDK uses: nttld/setup-ndk@v1 with: @@ -658,7 +653,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: packages-android-${{ needs.check-cache.outputs.version-label }} - path: ./packages/build/m2-buildrepo/**/* + path: ./packages/build/m2-buildrepo/**/* retention-days: 1 - name: Upload Android Test APK @@ -677,6 +672,184 @@ jobs: ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk + + build-android-packages: + runs-on: ubuntu-latest + needs: [check-cache, build-android-packages-no-caching] + # needs: static-analysis + if: always() && !cancelled() && needs.check-cache.outputs.packages-android-cache-hit != 'true' + +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 +# with: +# submodules: "recursive" +# +# # TODO I'm not sure this catches changes to our Config.kt, what is the impact? +# # https://github.com/actions/setup-java#caching-packages-dependencies +# - name: Setup Java 11 +# uses: actions/setup-java@v3 +# with: +# distribution: zulu +# java-version: 11 +# +# # TODO Default behavior is only caching from main/master. Unclear what the best caching strategy is for us. +# # TODO What is the rules and limits for caching on Github -> 10 GB limit, automatic evicition +# - name: Setup Gradle and task/dependency caching +# uses: gradle/gradle-build-action@v2 +# with: +# cache-read-only: false +# +# # Manually install SWIG 4.1.0 as only 4.0.2 is pre-installed +# # 4.1.0 is not available in apt-get, so use brew instead +# # https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#ubuntu-22041-lts +# # It seems to be required to manually add brew dirs to the PATH. This does not happen automatically. +# - name: Install SWIG +# run: | +# test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)" +# test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" +# test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile +# echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.profile +# brew install swig +# echo "/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH +# echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH +# +# - name: Install JSON parser +# run: brew install jq +# +# # checkout BAAS CLI repo +# - name: Checkout BAAS repo +# run: | +# echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token +# gh repo clone 10gen/baasaas +# +# +# # Start BAAS instance in the background +# # We save the container id to poll against and get the hostname info later +# - name: Start Baas instance in the background +# id: baas_cli_start +# working-directory: baasaas +# env: +# APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} +# run: | +# OUTPUT=$(bash cli.sh start) +# echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT +# +# # TODO This cmake version is not being used by the Android builds. Figure out why. +# - name: Setup cmake +# uses: jwlawson/actions-setup-cmake@v1.13 +# with: +# cmake-version: '3.25.2' +# +# # TODO This Ninja version is not being used by the Android builds. Figure out why. +# - name: Setup ninja +# uses: cmelchior/setup-ninja@master +# with: +# version: '1.11.0' +# +# # TODO This might not work on Windows: https://github.com/hendrikmuhs/ccache-action#notes-on-windows-support +# - name: Install ccache +# uses: hendrikmuhs/ccache-action@v1.2.2 +# with: +# key: 'android-package' +# max-size: '2.0G' +# +# - name: Prepend ccache executables to the PATH +# run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH +# +# # TODO See https://github.com/hendrikmuhs/ccache-action/issues/94 +# - name: Configure ccache +# run: | +# ccache --set-config="compiler_check=content" +# ccache --show-config +# echo '#!/bin/bash\nccache clang "$@"%"' > /usr/local/bin/ccache-clang +# echo '#!/bin/bash\nccache clang++ "$@"%"' > /usr/local/bin/ccache-clang++ +# +# # TODO This matches 23.2.8568313, but what happens if we a define specific ndk version in our build? +# - name: Setup NDK +# uses: nttld/setup-ndk@v1 +# with: +# ndk-version: r23c +# +# - name: Debug environment +# run: | +# env +# type cmake +# cmake --version +# type ninja +# ninja --version +# +# - name: Build Android Test Apk +# working-directory: packages +# run: ./gradlew :test-base:assembleAndroidTest -PignoreNativeLibs=true +# +# # We poll the previously started BAAS container to get the hostname of the container to use with Device Farm tests +# - name: Fetching the BAAS CLI hostname +# id: baas_cli_poll +# working-directory: baasaas +# env: +# APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} +# run: | +# OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') +# echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT +# +# - name: Build Android Sync Test Apk +# working-directory: packages +# run: ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:packageDebug :test-sync:assembleAndroidTest -PignoreNativeLibs=true +# +# - name: Build packages +# working-directory: packages +# run: ./gradlew publishCIPackages -Prealm.kotlin.targets=android -PignoreNativeLibs=true -Prealm.kotlin.mainHost=false +# +# - name: APK zipinfo +# run: zipinfo ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk +# +# # TODO Figure out naming schema and retention policy +# # We cannot use artifacts as they cannot be shared between workflows, so use cache instead. +# - name: Store build cache +# uses: actions/cache@v3 +# with: +# path: ./packages/build/m2-buildrepo +# key: packages-m2-android-sync-${{ needs.check-cache.outputs.packages-sha }} +# +# - name: Store build cache for Android Test APK +# uses: actions/cache@v3 +# with: +# path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk +# key: android-base-test-apk-key-${{ needs.check-cache.outputs.packages-sha }} +# +# - name: Store build cache for Android Sync Test APK +# uses: actions/cache@v3 +# with: +# key: android-sync-test-apk-key-${{ needs.check-cache.outputs.packages-sha }} +# path: | +# ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk +# ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk +# +# # TODO Must match naming found in include-check-cache.yml +# - name: Upload artifacts +# uses: actions/upload-artifact@v3 +# with: +# name: packages-android-${{ needs.check-cache.outputs.version-label }} +# path: ./packages/build/m2-buildrepo/**/* +# retention-days: 1 +# +# - name: Upload Android Test APK +# uses: actions/upload-artifact@v3 +# with: +# name: android-base-test-apk-${{ needs.check-cache.outputs.version-label }} +# path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk +# retention-days: 1 +# +# - name: Upload Android Sync Test APK +# uses: actions/upload-artifact@v3 +# with: +# name: android-sync-test-apk-${{ needs.check-cache.outputs.version-label }} +# retention-days: 1 +# path: | +# ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk +# ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk + # TODO: ccache is not being used by this build for some reason build-macos-x64-packages: runs-on: macos-latest @@ -1117,7 +1290,7 @@ jobs: name: AWS Device Farm timeout-minutes: 60 runs-on: ubuntu-latest - needs: [ check-cache, build-android-packages, build-jvm-packages ] + needs: [ check-cache, build-android-packages-no-caching, build-jvm-packages ] if: | always() && !cancelled() && @@ -1168,7 +1341,7 @@ jobs: - name: Stop BAAS container run: | - echo "TODO use cli.sh to stop container id: ${{ needs.build-android-packages.steps.baas_cli_start.outputs.baas_container_id }}" + echo "TODO use cli.sh to stop container id: ${{ needs.build-android-packages-no-caching.steps.baas_cli_start.outputs.baas_container_id }}" if: always() From f4b4318c86fa740e25b7806a7504e141a17e7b42 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 19 Dec 2023 22:36:01 +0000 Subject: [PATCH 46/67] adding dummy step --- .github/workflows/pr.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b339b8441c..39f49c882b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -679,11 +679,11 @@ jobs: # needs: static-analysis if: always() && !cancelled() && needs.check-cache.outputs.packages-android-cache-hit != 'true' -# steps: -# - name: Checkout code -# uses: actions/checkout@v3 -# with: -# submodules: "recursive" + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: "recursive" # # # TODO I'm not sure this catches changes to our Config.kt, what is the impact? # # https://github.com/actions/setup-java#caching-packages-dependencies From 9c03bf47ddfb9f5e2b0a76bd8b9ceb684205cac5 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 20 Dec 2023 09:35:50 +0000 Subject: [PATCH 47/67] revert change --- .github/workflows/pr.yml | 191 ++------------------------------------- 1 file changed, 9 insertions(+), 182 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 39f49c882b..969bb83d67 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -499,8 +499,13 @@ jobs: path: ./packages/build/m2-buildrepo/**/* retention-days: 1 - build-android-packages-no-caching: + + build-android-packages: runs-on: ubuntu-latest + needs: check-cache + # needs: static-analysis + if: always() && !cancelled() && needs.check-cache.outputs.packages-android-cache-hit != 'true' + steps: - name: Checkout code uses: actions/checkout@v3 @@ -544,7 +549,7 @@ jobs: run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token gh repo clone 10gen/baasaas - + # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later @@ -672,184 +677,6 @@ jobs: ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk - - build-android-packages: - runs-on: ubuntu-latest - needs: [check-cache, build-android-packages-no-caching] - # needs: static-analysis - if: always() && !cancelled() && needs.check-cache.outputs.packages-android-cache-hit != 'true' - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: "recursive" -# -# # TODO I'm not sure this catches changes to our Config.kt, what is the impact? -# # https://github.com/actions/setup-java#caching-packages-dependencies -# - name: Setup Java 11 -# uses: actions/setup-java@v3 -# with: -# distribution: zulu -# java-version: 11 -# -# # TODO Default behavior is only caching from main/master. Unclear what the best caching strategy is for us. -# # TODO What is the rules and limits for caching on Github -> 10 GB limit, automatic evicition -# - name: Setup Gradle and task/dependency caching -# uses: gradle/gradle-build-action@v2 -# with: -# cache-read-only: false -# -# # Manually install SWIG 4.1.0 as only 4.0.2 is pre-installed -# # 4.1.0 is not available in apt-get, so use brew instead -# # https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#ubuntu-22041-lts -# # It seems to be required to manually add brew dirs to the PATH. This does not happen automatically. -# - name: Install SWIG -# run: | -# test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)" -# test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" -# test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile -# echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.profile -# brew install swig -# echo "/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH -# echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH -# -# - name: Install JSON parser -# run: brew install jq -# -# # checkout BAAS CLI repo -# - name: Checkout BAAS repo -# run: | -# echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token -# gh repo clone 10gen/baasaas -# -# -# # Start BAAS instance in the background -# # We save the container id to poll against and get the hostname info later -# - name: Start Baas instance in the background -# id: baas_cli_start -# working-directory: baasaas -# env: -# APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} -# run: | -# OUTPUT=$(bash cli.sh start) -# echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT -# -# # TODO This cmake version is not being used by the Android builds. Figure out why. -# - name: Setup cmake -# uses: jwlawson/actions-setup-cmake@v1.13 -# with: -# cmake-version: '3.25.2' -# -# # TODO This Ninja version is not being used by the Android builds. Figure out why. -# - name: Setup ninja -# uses: cmelchior/setup-ninja@master -# with: -# version: '1.11.0' -# -# # TODO This might not work on Windows: https://github.com/hendrikmuhs/ccache-action#notes-on-windows-support -# - name: Install ccache -# uses: hendrikmuhs/ccache-action@v1.2.2 -# with: -# key: 'android-package' -# max-size: '2.0G' -# -# - name: Prepend ccache executables to the PATH -# run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH -# -# # TODO See https://github.com/hendrikmuhs/ccache-action/issues/94 -# - name: Configure ccache -# run: | -# ccache --set-config="compiler_check=content" -# ccache --show-config -# echo '#!/bin/bash\nccache clang "$@"%"' > /usr/local/bin/ccache-clang -# echo '#!/bin/bash\nccache clang++ "$@"%"' > /usr/local/bin/ccache-clang++ -# -# # TODO This matches 23.2.8568313, but what happens if we a define specific ndk version in our build? -# - name: Setup NDK -# uses: nttld/setup-ndk@v1 -# with: -# ndk-version: r23c -# -# - name: Debug environment -# run: | -# env -# type cmake -# cmake --version -# type ninja -# ninja --version -# -# - name: Build Android Test Apk -# working-directory: packages -# run: ./gradlew :test-base:assembleAndroidTest -PignoreNativeLibs=true -# -# # We poll the previously started BAAS container to get the hostname of the container to use with Device Farm tests -# - name: Fetching the BAAS CLI hostname -# id: baas_cli_poll -# working-directory: baasaas -# env: -# APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} -# run: | -# OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') -# echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT -# -# - name: Build Android Sync Test Apk -# working-directory: packages -# run: ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:packageDebug :test-sync:assembleAndroidTest -PignoreNativeLibs=true -# -# - name: Build packages -# working-directory: packages -# run: ./gradlew publishCIPackages -Prealm.kotlin.targets=android -PignoreNativeLibs=true -Prealm.kotlin.mainHost=false -# -# - name: APK zipinfo -# run: zipinfo ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk -# -# # TODO Figure out naming schema and retention policy -# # We cannot use artifacts as they cannot be shared between workflows, so use cache instead. -# - name: Store build cache -# uses: actions/cache@v3 -# with: -# path: ./packages/build/m2-buildrepo -# key: packages-m2-android-sync-${{ needs.check-cache.outputs.packages-sha }} -# -# - name: Store build cache for Android Test APK -# uses: actions/cache@v3 -# with: -# path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk -# key: android-base-test-apk-key-${{ needs.check-cache.outputs.packages-sha }} -# -# - name: Store build cache for Android Sync Test APK -# uses: actions/cache@v3 -# with: -# key: android-sync-test-apk-key-${{ needs.check-cache.outputs.packages-sha }} -# path: | -# ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk -# ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk -# -# # TODO Must match naming found in include-check-cache.yml -# - name: Upload artifacts -# uses: actions/upload-artifact@v3 -# with: -# name: packages-android-${{ needs.check-cache.outputs.version-label }} -# path: ./packages/build/m2-buildrepo/**/* -# retention-days: 1 -# -# - name: Upload Android Test APK -# uses: actions/upload-artifact@v3 -# with: -# name: android-base-test-apk-${{ needs.check-cache.outputs.version-label }} -# path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk -# retention-days: 1 -# -# - name: Upload Android Sync Test APK -# uses: actions/upload-artifact@v3 -# with: -# name: android-sync-test-apk-${{ needs.check-cache.outputs.version-label }} -# retention-days: 1 -# path: | -# ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk -# ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk - # TODO: ccache is not being used by this build for some reason build-macos-x64-packages: runs-on: macos-latest @@ -1290,7 +1117,7 @@ jobs: name: AWS Device Farm timeout-minutes: 60 runs-on: ubuntu-latest - needs: [ check-cache, build-android-packages-no-caching, build-jvm-packages ] + needs: [ check-cache, build-android-packages, build-jvm-packages ] if: | always() && !cancelled() && @@ -1341,7 +1168,7 @@ jobs: - name: Stop BAAS container run: | - echo "TODO use cli.sh to stop container id: ${{ needs.build-android-packages-no-caching.steps.baas_cli_start.outputs.baas_container_id }}" + echo "TODO use cli.sh to stop container id: ${{ needs.build-android-packages.steps.baas_cli_start.outputs.baas_container_id }}" if: always() From 472fb71cdbafec8b21c14c2402b8d45444f0a074 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 20 Dec 2023 10:39:25 +0000 Subject: [PATCH 48/67] separating device farm between sync and non-sync --- .github/workflows/pr.yml | 69 ++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d9c68d4f08..41bb691661 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -689,6 +689,9 @@ jobs: ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk + outputs: + baas-container-id: ${{ steps.job_b_step.outputs.baas_cli_start.baas_container_id }} + # TODO: ccache is not being used by this build for some reason build-macos-x64-packages: runs-on: macos-latest @@ -1136,11 +1139,42 @@ jobs: - name: Checkout code uses: actions/checkout@v3 -# - name: Restore Android Test APK -# uses: actions/download-artifact@v3 -# with: -# name: android-base-test-apk-${{ needs.check-cache.outputs.version-label }} -# path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk + - name: Restore Android Test APK + uses: actions/download-artifact@v3 + with: + name: android-base-test-apk-${{ needs.check-cache.outputs.version-label }} + path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + 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 + uses: ./.github/actions/run-android-device-farm-test + id: run_android_tests + with: + apk-path: ${{ github.workspace }}/packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk/test-base-debug-androidTest.apk + app-id: io.realm.testapp.test + project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} + device-pool-arn: ${{ secrets.DEVICEFARM_POOL_ARN }} + + test-android-packages-device-farm-sync: + name: AWS Device Farm Sync Tests + timeout-minutes: 60 + runs-on: ubuntu-latest + needs: [ check-cache, build-android-packages, build-jvm-packages ] + if: | + always() && + !cancelled() && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') + + steps: + - name: Checkout code + uses: actions/checkout@v3 - name: Restore Android Sync Test APK uses: actions/download-artifact@v3 @@ -1155,15 +1189,6 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_DEVICEFARM_SECRET_ACCESS_KEY }} aws-region: us-west-2 -# - name: Run the tests -# uses: ./.github/actions/run-android-device-farm-test -# id: run_android_tests -# with: -# apk-path: ${{ github.workspace }}/packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk/test-base-debug-androidTest.apk -# app-id: io.realm.testapp.test -# project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} -# device-pool-arn: ${{ secrets.DEVICEFARM_POOL_ARN }} - - name: Run the Sync tests uses: ./.github/actions/run-android-device-farm-sync-test id: run_android_tests @@ -1174,11 +1199,20 @@ jobs: project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} device-pool-arn: ${{ secrets.DEVICEFARM_POOL_ARN }} - - name: Stop BAAS container + - name: Checkout BAAS repo run: | - echo "TODO use cli.sh to stop container id: ${{ needs.build-android-packages.steps.baas_cli_start.outputs.baas_container_id }}" - if: always() + echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token + gh repo clone 10gen/baasaas + - name: Stopping the BAAS container + if: always() + working-directory: baasaas + env: + APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + run: | + if [ -n "${{ needs.build-android-packages.outputs.baas-container-id }}" ]; then + bash cli.sh stop ${{ needs.build-android-packages.outputs.baas-container-id }} + fi test-macos-packages: timeout-minutes: 30 @@ -1641,6 +1675,7 @@ jobs: test-ios-packages, test-android-packages-emulator, test-android-packages-device-farm, + test-android-packages-device-farm-sync, package-all-artifacts ] if: | From 3a04d801d8119560081f7c9bca4b4ea68eb0ea76 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 20 Dec 2023 12:22:30 +0000 Subject: [PATCH 49/67] Using correct container id --- .github/workflows/pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 41bb691661..f2cb54c2d3 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -690,7 +690,7 @@ jobs: ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk outputs: - baas-container-id: ${{ steps.job_b_step.outputs.baas_cli_start.baas_container_id }} + baas-container-id: ${{ steps.baas_cli_start.outputs.baas_container_id }} # TODO: ccache is not being used by this build for some reason build-macos-x64-packages: @@ -1200,6 +1200,7 @@ jobs: device-pool-arn: ${{ secrets.DEVICEFARM_POOL_ARN }} - name: Checkout BAAS repo + if: always() run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token gh repo clone 10gen/baasaas From 0bb0d730de0fc416dfd3a3e9ac38e4120b8dfd44 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 21 Dec 2023 10:17:41 +0000 Subject: [PATCH 50/67] Using bash shell consistently and enabling JVM windows Sync Tests --- .github/workflows/pr.yml | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f2cb54c2d3..90912b4aae 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -570,8 +570,9 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + shell: bash run: | - OUTPUT=$(bash cli.sh start) + OUTPUT=$(cli.sh start) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT # TODO This cmake version is not being used by the Android builds. Figure out why. @@ -628,8 +629,9 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + shell: bash run: | - OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + OUTPUT=$(cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Build Android Sync Test Apk @@ -1210,9 +1212,10 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + shell: bash run: | if [ -n "${{ needs.build-android-packages.outputs.baas-container-id }}" ]; then - bash cli.sh stop ${{ needs.build-android-packages.outputs.baas-container-id }} + cli.sh stop ${{ needs.build-android-packages.outputs.baas-container-id }} fi test-macos-packages: @@ -1256,10 +1259,11 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + shell: bash run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - OUTPUT=$(bash cli.sh start -t foo=bar) + OUTPUT=$(cli.sh start -t foo=bar) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 @@ -1305,8 +1309,9 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + shell: bash run: | - OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + OUTPUT=$(cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Run Sync tests @@ -1330,9 +1335,10 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + shell: bash run: | if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then - bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} fi test-ios-packages: @@ -1376,10 +1382,11 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + shell: bash run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - OUTPUT=$(bash cli.sh start -t foo=bar) + OUTPUT=$(cli.sh start -t foo=bar) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 @@ -1431,8 +1438,9 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + shell: bash run: | - OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + OUTPUT=$(cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Run Sync tests @@ -1456,9 +1464,10 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + shell: bash run: | if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then - bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} fi # TODO Investigate why these tests seem to hang for the `run tests` step with no log output. Could it be related to the test failing, but not being picked up? @@ -1502,10 +1511,11 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + shell: bash run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - OUTPUT=$(bash cli.sh start -t foo=bar) + OUTPUT=$(cli.sh start -t foo=bar) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 @@ -1548,17 +1558,16 @@ jobs: # We poll the previously started BAAS container to get the hostname of the container to use with Device Farm tests - name: Fetching the BAAS CLI hostname - if: matrix.os != 'windows-latest' id: baas_cli_poll working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + shell: bash run: | - OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + OUTPUT=$(cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Run Sync tests - if: matrix.os != 'windows-latest' working-directory: packages run: | ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:jvmTest -PincludeSdkModules=false --info --no-daemon @@ -1575,13 +1584,14 @@ jobs: fail-on-error: true - name: Stopping the BAAS container - if: always() && matrix.os != 'windows-latest' + if: always() working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} + shell: bash run: | if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then - bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} fi From 81af914659ceab514bce0292406b3e54d57fe055 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 21 Dec 2023 10:33:40 +0000 Subject: [PATCH 51/67] Prepend script with back slash --- .github/workflows/pr.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 90912b4aae..abad78c040 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -572,7 +572,7 @@ jobs: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} shell: bash run: | - OUTPUT=$(cli.sh start) + OUTPUT=$(./cli.sh start) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT # TODO This cmake version is not being used by the Android builds. Figure out why. @@ -631,7 +631,7 @@ jobs: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} shell: bash run: | - OUTPUT=$(cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + OUTPUT=$(./cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Build Android Sync Test Apk @@ -1215,7 +1215,7 @@ jobs: shell: bash run: | if [ -n "${{ needs.build-android-packages.outputs.baas-container-id }}" ]; then - cli.sh stop ${{ needs.build-android-packages.outputs.baas-container-id }} + ./cli.sh stop ${{ needs.build-android-packages.outputs.baas-container-id }} fi test-macos-packages: @@ -1263,7 +1263,7 @@ jobs: run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - OUTPUT=$(cli.sh start -t foo=bar) + OUTPUT=$(./cli.sh start -t foo=bar) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 @@ -1311,7 +1311,7 @@ jobs: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} shell: bash run: | - OUTPUT=$(cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + OUTPUT=$(./cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Run Sync tests @@ -1338,7 +1338,7 @@ jobs: shell: bash run: | if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then - cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + ./cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} fi test-ios-packages: @@ -1386,7 +1386,7 @@ jobs: run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - OUTPUT=$(cli.sh start -t foo=bar) + OUTPUT=$(./cli.sh start -t foo=bar) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 @@ -1440,7 +1440,7 @@ jobs: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} shell: bash run: | - OUTPUT=$(cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + OUTPUT=$(./cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Run Sync tests @@ -1467,7 +1467,7 @@ jobs: shell: bash run: | if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then - cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + ./cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} fi # TODO Investigate why these tests seem to hang for the `run tests` step with no log output. Could it be related to the test failing, but not being picked up? @@ -1515,7 +1515,7 @@ jobs: run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - OUTPUT=$(cli.sh start -t foo=bar) + OUTPUT=$(./cli.sh start -t foo=bar) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 @@ -1564,7 +1564,7 @@ jobs: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} shell: bash run: | - OUTPUT=$(cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + OUTPUT=$(./cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Run Sync tests @@ -1591,7 +1591,7 @@ jobs: shell: bash run: | if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then - cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + ./cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} fi From 9b7fe75128ff0f04177a13dbca8801e78c219ad4 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 21 Dec 2023 11:20:09 +0000 Subject: [PATCH 52/67] Testing windows powershell cli script --- .github/workflows/pr.yml | 62 +++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index abad78c040..47203dcd6a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -560,7 +560,7 @@ jobs: - name: Checkout BAAS repo run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas + gh repo clone 10gen/baasaas -b nh/windows_support # Start BAAS instance in the background @@ -570,9 +570,8 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} - shell: bash run: | - OUTPUT=$(./cli.sh start) + OUTPUT=$(bash cli.sh start) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT # TODO This cmake version is not being used by the Android builds. Figure out why. @@ -629,9 +628,8 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} - shell: bash run: | - OUTPUT=$(./cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Build Android Sync Test Apk @@ -1205,17 +1203,16 @@ jobs: if: always() run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas + gh repo clone 10gen/baasaas -b nh/windows_support - name: Stopping the BAAS container if: always() working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} - shell: bash run: | if [ -n "${{ needs.build-android-packages.outputs.baas-container-id }}" ]; then - ./cli.sh stop ${{ needs.build-android-packages.outputs.baas-container-id }} + bash cli.sh stop ${{ needs.build-android-packages.outputs.baas-container-id }} fi test-macos-packages: @@ -1250,7 +1247,7 @@ jobs: - name: Checkout BAAS repo run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas + gh repo clone 10gen/baasaas -b nh/windows_support # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later @@ -1259,11 +1256,10 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} - shell: bash run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - OUTPUT=$(./cli.sh start -t foo=bar) + OUTPUT=$(bash cli.sh start -t foo=bar) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 @@ -1309,9 +1305,8 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} - shell: bash run: | - OUTPUT=$(./cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Run Sync tests @@ -1335,10 +1330,9 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} - shell: bash run: | if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then - ./cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} fi test-ios-packages: @@ -1373,7 +1367,7 @@ jobs: - name: Checkout BAAS repo run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas + gh repo clone 10gen/baasaas -b nh/windows_support # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later @@ -1382,11 +1376,10 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} - shell: bash run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - OUTPUT=$(./cli.sh start -t foo=bar) + OUTPUT=$(bash cli.sh start -t foo=bar) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 @@ -1438,9 +1431,8 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} - shell: bash run: | - OUTPUT=$(./cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Run Sync tests @@ -1464,10 +1456,9 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} - shell: bash run: | if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then - ./cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} fi # TODO Investigate why these tests seem to hang for the `run tests` step with no log output. Could it be related to the test failing, but not being picked up? @@ -1501,7 +1492,7 @@ jobs: if: matrix.os != 'windows-latest' run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas + gh repo clone 10gen/baasaas -b nh/windows_support # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later @@ -1511,11 +1502,14 @@ jobs: working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} - shell: bash run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - OUTPUT=$(./cli.sh start -t foo=bar) + if [[ $RUNNER_OS == "windows-latest" ]]; then + OUTPUT=$(powershell cli.ps1 start -t foo=bar) + else + OUTPUT=$(bash cli.sh start -t foo=bar) + fi echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 @@ -1558,16 +1552,21 @@ jobs: # We poll the previously started BAAS container to get the hostname of the container to use with Device Farm tests - name: Fetching the BAAS CLI hostname + if: matrix.os != 'windows-latest' id: baas_cli_poll working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} - shell: bash run: | - OUTPUT=$(./cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + if [[ $RUNNER_OS == "windows-latest" ]]; then + OUTPUT=$(powershell cli.ps1 poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + else + OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + fi echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Run Sync tests + if: matrix.os != 'windows-latest' working-directory: packages run: | ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:jvmTest -PincludeSdkModules=false --info --no-daemon @@ -1584,14 +1583,17 @@ jobs: fail-on-error: true - name: Stopping the BAAS container - if: always() + if: always() && matrix.os != 'windows-latest' working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} - shell: bash run: | if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then - ./cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + if [[ $RUNNER_OS == "windows-latest" ]]; then + powershell cli.ps1 stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + else + bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + fi fi From ef06756ed72cd9b11fecc92295c0015644559de8 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 21 Dec 2023 11:26:27 +0000 Subject: [PATCH 53/67] Using correct syntax for clone with branch --- .github/workflows/pr.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 47203dcd6a..3731874ce2 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -560,7 +560,7 @@ jobs: - name: Checkout BAAS repo run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas -b nh/windows_support + gh repo clone 10gen/baasaas -- -b nh/windows_support # Start BAAS instance in the background @@ -1203,7 +1203,7 @@ jobs: if: always() run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas -b nh/windows_support + gh repo clone 10gen/baasaas -- -b nh/windows_support - name: Stopping the BAAS container if: always() @@ -1247,7 +1247,7 @@ jobs: - name: Checkout BAAS repo run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas -b nh/windows_support + gh repo clone 10gen/baasaas -- -b nh/windows_support # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later @@ -1367,7 +1367,7 @@ jobs: - name: Checkout BAAS repo run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas -b nh/windows_support + gh repo clone 10gen/baasaas -- -b nh/windows_support # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later @@ -1492,7 +1492,7 @@ jobs: if: matrix.os != 'windows-latest' run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas -b nh/windows_support + gh repo clone 10gen/baasaas -- -b nh/windows_support # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later From b6897bc5ba0fd13a1364e73d7712a13e0e1d984b Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 21 Dec 2023 12:39:30 +0000 Subject: [PATCH 54/67] - Removing Windows filter - Guarding against empty logcat pull from Device farm --- .../run-android-device-farm-sync-test/action.yml | 14 +++++++++----- .../run-android-device-farm-test/action.yml | 15 ++++++++++----- .github/workflows/pr.yml | 8 ++------ 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index 17071a94c2..bb85a20281 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -58,11 +58,15 @@ runs: echo "All File Artifacts:" echo $fileArtifacts $logCatArtifacts = $fileArtifacts | Where-Object { $_.Name -EQ "Logcat" } - echo "LogCat Artifacts:" - echo $logCatArtifacts - echo "::group::Logcat" - Invoke-WebRequest -Uri $logCatArtifacts[0].Url | Select-Object -Expand RawContent - echo "::endgroup::" + if ($logCatArtifacts) { + echo "LogCat Artifacts:" + echo $logCatArtifacts + echo "::group::Logcat" + Invoke-WebRequest -Uri $logCatArtifacts[0].Url | Select-Object -Expand RawContent + echo "::endgroup::" + } else { + Write-Warning "No logCatArtifacts found." + } shell: pwsh if: always() name: Device Farm Output diff --git a/.github/actions/run-android-device-farm-test/action.yml b/.github/actions/run-android-device-farm-test/action.yml index 084001cb46..a29794eaa4 100644 --- a/.github/actions/run-android-device-farm-test/action.yml +++ b/.github/actions/run-android-device-farm-test/action.yml @@ -53,11 +53,16 @@ runs: echo "All File Artifacts:" echo $fileArtifacts $logCatArtifacts = $fileArtifacts | Where-Object { $_.Name -EQ "Logcat" } - echo "LogCat Artifacts:" - echo $logCatArtifacts - echo "::group::Logcat" - Invoke-WebRequest -Uri $logCatArtifacts[0].Url | Select-Object -Expand RawContent - echo "::endgroup::" + if ($logCatArtifacts) { + echo "LogCat Artifacts:" + echo $logCatArtifacts + echo "::group::Logcat" + Invoke-WebRequest -Uri $logCatArtifacts[0].Url | Select-Object -Expand RawContent + echo "::endgroup::" + } else { + Write-Warning "No logCatArtifacts found." + } + shell: pwsh if: always() name: Device Farm Output diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 3731874ce2..fca6964150 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1489,7 +1489,6 @@ jobs: # checkout BAAS CLI repo - name: Checkout BAAS repo - if: matrix.os != 'windows-latest' run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token gh repo clone 10gen/baasaas -- -b nh/windows_support @@ -1497,7 +1496,6 @@ jobs: # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later - name: Start Baas instance in the background - if: matrix.os != 'windows-latest' id: baas_cli_start working-directory: baasaas env: @@ -1552,7 +1550,6 @@ jobs: # We poll the previously started BAAS container to get the hostname of the container to use with Device Farm tests - name: Fetching the BAAS CLI hostname - if: matrix.os != 'windows-latest' id: baas_cli_poll working-directory: baasaas env: @@ -1566,14 +1563,13 @@ jobs: echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Run Sync tests - if: matrix.os != 'windows-latest' working-directory: packages run: | ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:jvmTest -PincludeSdkModules=false --info --no-daemon - name: Publish Sync Unit Test Results uses: dorny/test-reporter@v1 - if: ${{ !cancelled() && matrix.os != 'windows-latest' }} + if: ${{ !cancelled() }} with: name: "Sync - ${{ matrix.test-title }}" path: ./packages/test-sync/build/**/TEST-*.xml @@ -1583,7 +1579,7 @@ jobs: fail-on-error: true - name: Stopping the BAAS container - if: always() && matrix.os != 'windows-latest' + if: always() working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} From 3e9038a447c4378c602727079ac8f1e38e0d5649 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 21 Dec 2023 13:14:49 +0000 Subject: [PATCH 55/67] GHA syntax --- .github/workflows/pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index fca6964150..18b8225922 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1503,7 +1503,7 @@ jobs: run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - if [[ $RUNNER_OS == "windows-latest" ]]; then + if [ "${{ matrix.os }}" == "windows-latest" ]; then OUTPUT=$(powershell cli.ps1 start -t foo=bar) else OUTPUT=$(bash cli.sh start -t foo=bar) @@ -1555,7 +1555,7 @@ jobs: env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - if [[ $RUNNER_OS == "windows-latest" ]]; then + if [ "${{ matrix.os }}" != "windows-latest" ]; then OUTPUT=$(powershell cli.ps1 poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') else OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') @@ -1585,7 +1585,7 @@ jobs: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then - if [[ $RUNNER_OS == "windows-latest" ]]; then + if [ "${{ matrix.os }}" != "windows-latest" ]; then powershell cli.ps1 stop ${{ steps.baas_cli_start.outputs.baas_container_id }} else bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} From 02c3e5cd349796ba2e990423b2bed58c77359d51 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 21 Dec 2023 14:54:41 +0000 Subject: [PATCH 56/67] Fixing syntax --- .github/workflows/pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 18b8225922..903742693a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1503,7 +1503,7 @@ jobs: run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - if [ "${{ matrix.os }}" == "windows-latest" ]; then + if [ "${{ matrix.os }}" = "windows-latest" ]; then OUTPUT=$(powershell cli.ps1 start -t foo=bar) else OUTPUT=$(bash cli.sh start -t foo=bar) @@ -1555,7 +1555,7 @@ jobs: env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - if [ "${{ matrix.os }}" != "windows-latest" ]; then + if [ "${{ matrix.os }}" = "windows-latest" ]; then OUTPUT=$(powershell cli.ps1 poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') else OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') @@ -1585,7 +1585,7 @@ jobs: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then - if [ "${{ matrix.os }}" != "windows-latest" ]; then + if [ "${{ matrix.os }}" = "windows-latest" ]; then powershell cli.ps1 stop ${{ steps.baas_cli_start.outputs.baas_container_id }} else bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} From c872563bd37e41ead3964165f6962ddf3fc869d5 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 21 Dec 2023 15:14:23 +0000 Subject: [PATCH 57/67] test --- .github/workflows/pr.yml | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 903742693a..e8efd4d547 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1468,10 +1468,10 @@ jobs: matrix: os: [macos-latest, ubuntu-latest, windows-latest] # TODO Should we also test om MacOS arm64? include: - - os: macos-latest - test-title: Unit Test Results - Base JVM MacOS x64 - - os: ubuntu-latest - test-title: Unit Test Results - Base JVM Linux +# - os: macos-latest +# test-title: Unit Test Results - Base JVM MacOS x64 +# - os: ubuntu-latest +# test-title: Unit Test Results - Base JVM Linux - os: windows-latest test-title: Unit Test Results - Base JVM Windows @@ -1503,11 +1503,7 @@ jobs: run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - if [ "${{ matrix.os }}" = "windows-latest" ]; then - OUTPUT=$(powershell cli.ps1 start -t foo=bar) - else - OUTPUT=$(bash cli.sh start -t foo=bar) - fi + OUTPUT=$(powershell cli.ps1 start -t foo=bar) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 @@ -1555,11 +1551,7 @@ jobs: env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - if [ "${{ matrix.os }}" = "windows-latest" ]; then - OUTPUT=$(powershell cli.ps1 poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') - else - OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') - fi + OUTPUT=$(powershell cli.ps1 poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Run Sync tests @@ -1584,13 +1576,7 @@ jobs: env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then - if [ "${{ matrix.os }}" = "windows-latest" ]; then - powershell cli.ps1 stop ${{ steps.baas_cli_start.outputs.baas_container_id }} - else - bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} - fi - fi + powershell cli.ps1 stop ${{ steps.baas_cli_start.outputs.baas_container_id }} package-all-artifacts: From 1d6e0d6b27ead8b60b3bbefda4a884959f8a5904 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 22 Dec 2023 10:05:33 +0000 Subject: [PATCH 58/67] Rever changes --- .github/workflows/pr.yml | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index e8efd4d547..f2cb54c2d3 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -560,7 +560,7 @@ jobs: - name: Checkout BAAS repo run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas -- -b nh/windows_support + gh repo clone 10gen/baasaas # Start BAAS instance in the background @@ -1203,7 +1203,7 @@ jobs: if: always() run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas -- -b nh/windows_support + gh repo clone 10gen/baasaas - name: Stopping the BAAS container if: always() @@ -1247,7 +1247,7 @@ jobs: - name: Checkout BAAS repo run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas -- -b nh/windows_support + gh repo clone 10gen/baasaas # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later @@ -1367,7 +1367,7 @@ jobs: - name: Checkout BAAS repo run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas -- -b nh/windows_support + gh repo clone 10gen/baasaas # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later @@ -1468,10 +1468,10 @@ jobs: matrix: os: [macos-latest, ubuntu-latest, windows-latest] # TODO Should we also test om MacOS arm64? include: -# - os: macos-latest -# test-title: Unit Test Results - Base JVM MacOS x64 -# - os: ubuntu-latest -# test-title: Unit Test Results - Base JVM Linux + - os: macos-latest + test-title: Unit Test Results - Base JVM MacOS x64 + - os: ubuntu-latest + test-title: Unit Test Results - Base JVM Linux - os: windows-latest test-title: Unit Test Results - Base JVM Windows @@ -1489,13 +1489,15 @@ jobs: # checkout BAAS CLI repo - name: Checkout BAAS repo + if: matrix.os != 'windows-latest' run: | echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token - gh repo clone 10gen/baasaas -- -b nh/windows_support + gh repo clone 10gen/baasaas # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later - name: Start Baas instance in the background + if: matrix.os != 'windows-latest' id: baas_cli_start working-directory: baasaas env: @@ -1503,7 +1505,7 @@ jobs: run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - OUTPUT=$(powershell cli.ps1 start -t foo=bar) + OUTPUT=$(bash cli.sh start -t foo=bar) echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 @@ -1546,22 +1548,24 @@ jobs: # We poll the previously started BAAS container to get the hostname of the container to use with Device Farm tests - name: Fetching the BAAS CLI hostname + if: matrix.os != 'windows-latest' id: baas_cli_poll working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - OUTPUT=$(powershell cli.ps1 poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') + OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl') echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT - name: Run Sync tests + if: matrix.os != 'windows-latest' working-directory: packages run: | ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:jvmTest -PincludeSdkModules=false --info --no-daemon - name: Publish Sync Unit Test Results uses: dorny/test-reporter@v1 - if: ${{ !cancelled() }} + if: ${{ !cancelled() && matrix.os != 'windows-latest' }} with: name: "Sync - ${{ matrix.test-title }}" path: ./packages/test-sync/build/**/TEST-*.xml @@ -1571,12 +1575,14 @@ jobs: fail-on-error: true - name: Stopping the BAAS container - if: always() + if: always() && matrix.os != 'windows-latest' working-directory: baasaas env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - powershell cli.ps1 stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + if [ -n "${{ steps.baas_cli_start.outputs.baas_container_id }}" ]; then + bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} + fi package-all-artifacts: From 9f9cf12434ef5646f1f3090a265d539636ccff25 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 22 Dec 2023 10:52:25 +0000 Subject: [PATCH 59/67] fixing auxiliary apps syntax --- .github/actions/run-android-device-farm-sync-test/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index bb85a20281..f8f640fed4 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -26,7 +26,7 @@ runs: project_arn: ${{ inputs.project-arn }} device_pool_arn: ${{ inputs.device-pool-arn }} app_file: ${{ inputs.apk-path }} - app_auxiliary_file: ${{ inputs.apk-auxiliary-path }} + app_auxiliary_files: [${{ inputs.apk-auxiliary-path }}] app_type: ANDROID_APP test_type: APPIUM_PYTHON test_package_file: https://github.com/realm/aws-devicefarm-sample-data/releases/download/0.3/sample_env_python3.zip From c59c32a7455dab62f7c5489da7b56278110cf0d9 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 22 Dec 2023 12:23:57 +0000 Subject: [PATCH 60/67] Using sequence --- .github/actions/run-android-device-farm-sync-test/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index f8f640fed4..2ef3b8fe51 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -26,7 +26,8 @@ runs: project_arn: ${{ inputs.project-arn }} device_pool_arn: ${{ inputs.device-pool-arn }} app_file: ${{ inputs.apk-path }} - app_auxiliary_files: [${{ inputs.apk-auxiliary-path }}] + app_auxiliary_files: | + - ${{ inputs.apk-auxiliary-path }} app_type: ANDROID_APP test_type: APPIUM_PYTHON test_package_file: https://github.com/realm/aws-devicefarm-sample-data/releases/download/0.3/sample_env_python3.zip From da627e98ce7bfe4aeb61df6c06c918911d8ebbd4 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 22 Dec 2023 21:40:42 +0000 Subject: [PATCH 61/67] fixing auxiliary apps syntax --- .github/actions/run-android-device-farm-sync-test/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml index 2ef3b8fe51..edc5494fdf 100644 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ b/.github/actions/run-android-device-farm-sync-test/action.yml @@ -26,8 +26,7 @@ runs: project_arn: ${{ inputs.project-arn }} device_pool_arn: ${{ inputs.device-pool-arn }} app_file: ${{ inputs.apk-path }} - app_auxiliary_files: | - - ${{ inputs.apk-auxiliary-path }} + app_auxiliary_files: ${{ inputs.apk-auxiliary-path }} app_type: ANDROID_APP test_type: APPIUM_PYTHON test_package_file: https://github.com/realm/aws-devicefarm-sample-data/releases/download/0.3/sample_env_python3.zip From e6e785cf8cc8ea309561beefbd6a8a8ccdfa1090 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 9 Jan 2024 15:47:26 +0000 Subject: [PATCH 62/67] Using common device farm action for Sync and non-Sync tests --- .../actions/run-android-device-farm-test/action.yml | 12 ++++++++++-- .github/workflows/pr.yml | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/actions/run-android-device-farm-test/action.yml b/.github/actions/run-android-device-farm-test/action.yml index a29794eaa4..09b371254b 100644 --- a/.github/actions/run-android-device-farm-test/action.yml +++ b/.github/actions/run-android-device-farm-test/action.yml @@ -2,7 +2,12 @@ name: 'Run Android tests on Device Farm' inputs: apk-path: required: true + apk-auxiliary-path: + description: 'Install additional APKs needed for the tests' + default: '' + required: false app-id: + description: 'The test runner class to use' required: true project-arn: required: true @@ -17,12 +22,14 @@ runs: using: "composite" steps: - name: Run the tests - uses: realm/aws-devicefarm/test-application@7b9a91236c456c97e28d384c9e476035d5ea686b + uses: nhachicha/aws-devicefarm/test-application@master + id: run-tests with: project_arn: ${{ inputs.project-arn }} device_pool_arn: ${{ inputs.device-pool-arn }} app_file: ${{ inputs.apk-path }} + app_auxiliary_files: ${{ inputs.apk-auxiliary-path }} app_type: ANDROID_APP test_type: APPIUM_PYTHON test_package_file: https://github.com/realm/aws-devicefarm-sample-data/releases/download/0.3/sample_env_python3.zip @@ -38,7 +45,8 @@ runs: - export PYTHON_VERSION=3 test: commands: - - adb shell am instrument -w -r io.realm.testapp.test/androidx.test.runner.AndroidJUnitRunner | egrep 'OK \([0-9]+ test[s]?\)' + - adb shell pm list packages | grep realm + - adb shell am instrument -w -r ${{ inputs.app-id }}/androidx.test.runner.AndroidJUnitRunner | egrep 'OK \([0-9]+ test[s]?\)' - run: | Install-Module -Name AWSPowerShell -Force diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f2cb54c2d3..dcac8bc71c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1190,7 +1190,7 @@ jobs: aws-region: us-west-2 - name: Run the Sync tests - uses: ./.github/actions/run-android-device-farm-sync-test + uses: ./.github/actions/run-android-device-farm-test id: run_android_tests with: apk-path: ${{ github.workspace }}/packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk From ba24644ef4a0f3551d07b0c09c116fc9b9d687d9 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 9 Jan 2024 15:54:16 +0000 Subject: [PATCH 63/67] Adding changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebee13f301..283354d6c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ ### Internal * Update to Ktor 2.3.4. * Updated to CMake 3.27.7 +* Adding Sync tests via Github Action ## 1.13.1-SNAPSHOT (YYYY-MM-DD) From c9c32f3186298222d6160e184acd40e0894d86fa Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 9 Jan 2024 23:50:01 +0000 Subject: [PATCH 64/67] Parsing BAAS instance id properly --- .github/workflows/pr.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index dcac8bc71c..54b80566f5 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -571,7 +571,7 @@ jobs: env: APIKEY: ${{ secrets.BAAS_CLI_API_KEY }} run: | - OUTPUT=$(bash cli.sh start) + OUTPUT=$(bash cli.sh start | jq -r '.id') echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT # TODO This cmake version is not being used by the Android builds. Figure out why. @@ -1259,7 +1259,7 @@ jobs: run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - OUTPUT=$(bash cli.sh start -t foo=bar) + OUTPUT=$(bash cli.sh start -t foo=bar | jq -r '.id') echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 @@ -1379,7 +1379,7 @@ jobs: run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - OUTPUT=$(bash cli.sh start -t foo=bar) + OUTPUT=$(bash cli.sh start | jq -r '.id') echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 @@ -1505,7 +1505,7 @@ jobs: run: | # Adding a dummy tag (foo=bar) to avoid the following issue on macos-runner # curl: option --data: error encountered when reading a file - OUTPUT=$(bash cli.sh start -t foo=bar) + OUTPUT=$(bash cli.sh start | jq -r '.id') echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 From 85f6e1e14b9e55da012035c66664124f4fbd92de Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 10 Jan 2024 00:38:16 +0000 Subject: [PATCH 65/67] Fixing Android Build Sync APK test flag --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index aaa7128e5d..c17930d7de 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -634,7 +634,7 @@ jobs: - name: Build Android Sync Test Apk working-directory: packages - run: ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:packageDebug :test-sync:assembleAndroidTest -PignoreNativeLibs=true + run: ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:packageDebug :test-sync:assembleAndroidTest -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false - name: Build packages working-directory: packages From f823ff5cca6b0acbab5145eb2e5f5a9720d8e605 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 10 Jan 2024 01:42:23 +0000 Subject: [PATCH 66/67] Remove unused device farm sync test for Android (using common device farm action) --- .../action.yml | 72 ------------------- 1 file changed, 72 deletions(-) delete mode 100644 .github/actions/run-android-device-farm-sync-test/action.yml diff --git a/.github/actions/run-android-device-farm-sync-test/action.yml b/.github/actions/run-android-device-farm-sync-test/action.yml deleted file mode 100644 index edc5494fdf..0000000000 --- a/.github/actions/run-android-device-farm-sync-test/action.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: 'Run Android tests on Device Farm' -inputs: - apk-path: - required: true - apk-auxiliary-path: - required: true - app-id: - required: true - project-arn: - required: true - device-pool-arn: - required: true - arguments: - default: _ -outputs: - test-results-path: - value: ${{ steps.get-test-results.outputs.results-path }} -runs: - using: "composite" - steps: - - name: Run the tests - uses: nhachicha/aws-devicefarm/test-application@master - - id: run-tests - with: - project_arn: ${{ inputs.project-arn }} - device_pool_arn: ${{ inputs.device-pool-arn }} - app_file: ${{ inputs.apk-path }} - app_auxiliary_files: ${{ inputs.apk-auxiliary-path }} - app_type: ANDROID_APP - test_type: APPIUM_PYTHON - test_package_file: https://github.com/realm/aws-devicefarm-sample-data/releases/download/0.3/sample_env_python3.zip - test_package_type: APPIUM_PYTHON_TEST_PACKAGE - test_spec_file: test_spec-${{ inputs.app-id }}.yaml - test_spec_type: APPIUM_PYTHON_TEST_SPEC - remote_src: true - test_spec: | - version: 0.1 - phases: - install: - commands: - - export PYTHON_VERSION=3 - test: - commands: - - adb shell pm list packages | grep realm - - adb shell am instrument -w -r io.realm.sync.testapp.test/androidx.test.runner.AndroidJUnitRunner | egrep 'OK \([0-9]+ test[s]?\)' - - - run: | - Install-Module -Name AWSPowerShell -Force - echo "::group::Data" - echo (ConvertFrom-Json '${{ steps.run-tests.outputs.data }}' | ConvertTo-Json) - echo "::endgroup::" - Import-Module AWSPowerShell - $runs = Get-DFRunList -Arn ${{ inputs.project-arn }} - $jobs = Get-DFJobList -Arn $runs[0].Arn - $suites = Get-DFSuiteList -Arn $jobs[0].Arn - $fileArtifacts = Get-DFArtifactList -Arn $suites[1].Arn -Type File - echo "All File Artifacts:" - echo $fileArtifacts - $logCatArtifacts = $fileArtifacts | Where-Object { $_.Name -EQ "Logcat" } - if ($logCatArtifacts) { - echo "LogCat Artifacts:" - echo $logCatArtifacts - echo "::group::Logcat" - Invoke-WebRequest -Uri $logCatArtifacts[0].Url | Select-Object -Expand RawContent - echo "::endgroup::" - } else { - Write-Warning "No logCatArtifacts found." - } - shell: pwsh - if: always() - name: Device Farm Output From a4288a1d1d607b774f20f2db0dcec6e69e3c24b4 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 10 Jan 2024 09:44:47 +0000 Subject: [PATCH 67/67] Update .github/workflows/pr.yml Co-authored-by: Christian Melchior --- .github/workflows/pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index c17930d7de..50b9ab37c6 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -562,7 +562,6 @@ jobs: echo ${{ secrets.BAAS_CLI }} | gh auth login --with-token gh repo clone 10gen/baasaas - # Start BAAS instance in the background # We save the container id to poll against and get the hostname info later - name: Start Baas instance in the background