From 09124a1fd615f31e75d2550c2e6dd5ad9d64322a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Thu, 22 Feb 2024 14:21:49 +0100 Subject: [PATCH 01/36] Update to Swig 4.2.0 --- CHANGELOG.md | 1 + CONTRIBUTING.md | 2 +- packages/jni-swig-stub/realm.i | 72 ++++++++++++++++++++++------------ 3 files changed, 50 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 835afb0f19..debcab8205 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ * Updated to CMake 3.27.7 * Updated to Realm Core 13.26.0, commit 5533505d18fda93a7a971d58a191db5005583c92. * Adding Sync tests via Github Action. +* Updated to Swig 4.2.0. ## 1.13.1-SNAPSHOT (YYYY-MM-DD) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4a83a4d590..0cd3db7f53 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,7 @@ We welcomes all contributions! The only requirement we have is that, like many o ### Prerequisites -- Swig 4.1.0 or above. On Mac this can be installed using Homebrew: `brew install swig`. +- Swig 4.2.0 or above. On Mac this can be installed using Homebrew: `brew install swig`. - Ccache. On Mac this can be installed using Homebrew: `brew install ccache`. - CMake 3.18.1 or above. Can be installed through the Android SDK Manager. - Java 11. diff --git a/packages/jni-swig-stub/realm.i b/packages/jni-swig-stub/realm.i index fcaae087eb..bbbad4dcbd 100644 --- a/packages/jni-swig-stub/realm.i +++ b/packages/jni-swig-stub/realm.i @@ -283,13 +283,13 @@ typedef jstring realm_string_t; } %typemap(out) (realm_string_t) "$result = to_jstring(jenv, StringData{$1.data, $1.size});" +// Type map to allow passing void* as Long %typemap(jstype) void* "long" %typemap(javain) void* "$javainput" %typemap(javadirectorin) void* "$1" %typemap(javaout) void* { -return $jnicall; + return $jnicall; } - // Reuse above type maps on other pointers too %apply void* { realm_t*, realm_config_t*, realm_schema_t*, realm_object_t* , realm_query_t*, realm_results_t*, realm_notification_token_t*, realm_object_changes_t*, @@ -346,6 +346,9 @@ import static io.realm.kotlin.internal.interop.realm_errno_e.*; // Array wrappers to allow building (continuous allocated) arrays of the corresponding types from // JVM %include "carrays.i" +// Workaround for updated Swig behavior with 4.2.0 +// https://github.com/swig/swig/commit/ecaa052f3d319834a66aaa07047be3662e5e52e2#diff-cd2fcc891412baae0fc46479c0870cbdd18133d06d68dcd216be8a37ecf77b37R10 +%apply int { size_t nelements, size_t index } %array_functions(realm_class_info_t, classArray); %array_functions(realm_property_info_t, propertyArray); %array_functions(realm_property_info_t*, propertyArrayArray); @@ -355,9 +358,9 @@ import static io.realm.kotlin.internal.interop.realm_errno_e.*; %array_functions(realm_query_arg_t, queryArgArray); %array_functions(realm_user_identity_t, identityArray); %array_functions(realm_app_user_apikey_t, apiKeyArray); - -// Work around issues with realm_size_t on Windows https://jira.mongodb.org/browse/RKOTLIN-332 -%apply int64_t[] { size_t* }; +// Workaround for updated Swig behavior with 4.2.0 +// https://github.com/swig/swig/commit/ecaa052f3d319834a66aaa07047be3662e5e52e2#diff-cd2fcc891412baae0fc46479c0870cbdd18133d06d68dcd216be8a37ecf77b37R10 +%clear size_t nelements, size_t index; // bool output parameter %apply bool* OUTPUT { bool* out_found, bool* did_create, bool* did_delete_realm, bool* out_inserted, @@ -367,30 +370,51 @@ import static io.realm.kotlin.internal.interop.realm_errno_e.*; // uint64_t output parameter for realm_get_num_versions %apply int64_t* OUTPUT { uint64_t* out_versions_count }; -// Enable passing uint8_t* parameters for realm_config_get_encryption_key and realm_config_set_encryption_key as Byte[] -%apply int8_t[] {uint8_t *key}; -%apply int8_t[] {uint8_t *out_key}; -%apply int8_t[] {const uint8_t* data}; - -// Enable passing uint8_t [64] parameter for realm_sync_client_config_set_metadata_encryption_key as Byte[] -%apply int8_t[] {uint8_t [64]}; - -// Enable passing uint8_t [2] parameter for realm_decimal128 as Long[] -%apply int64_t[] {uint64_t w[2]}; - -%typemap(out) uint64_t w[2] %{ - $result = SWIG_JavaArrayOutLonglong(jenv, (long long *)result, 2); +// Enable passing uint8_t* as byte[] +%apply int8_t[] {uint8_t*}; // +%typemap(in) uint8_t* (jbyte *jarr) %{ + if(!SWIG_JavaArrayInSchar(jenv, &jarr, (signed char **)&$1, $input)) return $null; %} - -%typemap(freearg) const uint8_t* data; -%typemap(out) const uint8_t* data %{ +%typemap(out) uint8_t* %{ $result = SWIG_JavaArrayOutSchar(jenv, (signed char *)result, arg1->size); %} +%typemap(argout) uint8_t* %{ +SWIG_JavaArrayArgoutSchar(jenv, jarr$argnum, (signed char *)$1, $input); +%} +%typemap(freearg) uint8_t*; + +// Reuse above typemap for passing uint8_t[64] parameter for realm_sync_client_config_set_metadata_encryption_key as Byte[] +%apply uint8_t* {uint8_t [64]}; -// Enable passing output argument pointers as long[] +// Enable passing void** as long[] %apply int64_t[] {void **}; -%apply void** {realm_object_t**, realm_list_t**, size_t*, realm_class_key_t*, - realm_property_key_t*, realm_user_t**, realm_set_t**, realm_results_t**}; +%typemap(in) void ** (jlong *jarr) %{ + if(!SWIG_JavaArrayInLonglong(jenv, &jarr, (long long **)&$1, $input)) return $null; +%} +%typemap(out) void ** %{ + $result = SWIG_JavaArrayOutLonglong(jenv, (long long *)result, arg1->size); +%} +%typemap(argout) void ** %{ + SWIG_JavaArrayArgoutLonglong(jenv, jarr$argnum, (long long *)$1, $input); +%} +%typemap(freearg) void**; + +// Reuse above typemap for void** (from apply int64_t[]) {void **}) to pass various pointer types as +// long[] +%apply void** {realm_object_t**, realm_list_t**, realm_class_key_t*, size_t*, +realm_property_key_t*, realm_user_t**, realm_set_t**, realm_results_t**}; + +// Enable passing uint64_t [2] parameter for realm_decimal128 as Long[] +%apply int64_t[] {uint64_t w[2]}; +%typemap(in) uint64_t w[2] (jlong *jarr) %{ +if(!SWIG_JavaArrayInLonglong(jenv, &jarr, (long long **)&$1, $input)) return $null; +%} +%typemap(argout) uint64_t w[2] %{ +SWIG_JavaArrayArgoutLonglong(jenv, jarr$argnum, (long long *)$1, $input); +%} +%typemap(out) uint64_t w[2] %{ +$result = SWIG_JavaArrayOutLonglong(jenv, (long long *)result, 2); +%} %apply uint32_t[] {realm_class_key_t*}; From b11f2e48f3494008e1c6a48f74b4e693f380cc69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Thu, 22 Feb 2024 15:18:02 +0100 Subject: [PATCH 02/36] Clean up build-android-package node before building --- .github/workflows/pr.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 928b50cfee..d204b2a262 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -498,6 +498,11 @@ jobs: needs.check-cache.outputs.android-test-sync-apk-cache-hit != 'true') steps: + - name: Remove unnecessary files + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + - name: Checkout code uses: actions/checkout@v3 with: From 4bb0c0c8b18e12d1de6aa689e63dd6dbf8fd080e Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 22 Feb 2024 15:40:20 +0000 Subject: [PATCH 03/36] GHA adding dependency for iOS test --- .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 928b50cfee..618d79d565 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1307,7 +1307,7 @@ jobs: runs-on: ${{ matrix.os }} # TODO Unclear why MacOS needs the metadata package when the Android Tests do not # Disable macos-arm for now as the host needs to have the Android SDK installed even though it isn't really using it. - needs: [check-cache, build-ios-x64-packages, build-kotlin-metadata-package] # , build-ios-arm64-packages] + needs: [check-cache, build-ios-x64-packages, build-kotlin-metadata-package, build-macos-x64-packages] # , build-ios-arm64-packages] if: | always() && !cancelled() && From f58b79e62634760461c4577af0cf9b84137845c2 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 22 Feb 2024 15:54:53 +0000 Subject: [PATCH 04/36] test release (staging to Sonatype) --- .github/workflows/include-deploy-release.yml | 142 +++++++++++++++++++ .github/workflows/pr.yml | 25 +++- buildSrc/src/main/kotlin/Config.kt | 2 +- 3 files changed, 167 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/include-deploy-release.yml diff --git a/.github/workflows/include-deploy-release.yml b/.github/workflows/include-deploy-release.yml new file mode 100644 index 0000000000..b135d7fb1d --- /dev/null +++ b/.github/workflows/include-deploy-release.yml @@ -0,0 +1,142 @@ +name: Deploy release + +on: + workflow_call: + inputs: + version-label: + required: true + type: string + + packages-sha-label: + required: true + type: string + +jobs: + deploy: + runs-on: macos-latest + name: Deploy release + +#TODO release script needs s3cmd + steps: + - name: git checkout + uses: actions/checkout@v3 + with: + submodules: "recursive" + + - name: Setup Java 11 + uses: actions/setup-java@v3 + with: + distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} + java-version: ${{ vars.VERSION_JAVA }} + + - name: Setup Gradle and task/dependency caching + uses: gradle/gradle-build-action@v2 + with: + cache-read-only: false + + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1.13 + with: + cmake-version: ${{ vars.VERSION_CMAKE }} + + - name: Setup ninja + uses: cmelchior/setup-ninja@master + with: + version: ${{ vars.VERSION_NINJA }} + + - name: Install ccache + uses: hendrikmuhs/ccache-action@v1.2.2 + with: + key: 'jvm-package' + max-size: '2.0G' + + - name: Prepend ccache executables to the PATH + run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH + + # 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 + + # We cannot use artifacts as they cannot be shared between workflows, so use cache instead. + - name: Setup build cache + uses: actions/cache@v3 + with: + path: ./packages/build/m2-buildrepo + key: packages-m2-jvm-sync-${{ inputs.packages-sha-label }} + + - name: Restore Linux JNI lib + uses: actions/download-artifact@v3 + with: + name: jni-linux-lib-${{ inputs.version-label }} + path: ./packages/cinterop/build/realmLinuxBuild + + - name: Restore Windows JNI lib + uses: actions/download-artifact@v3 + with: + name: jni-windows-lib-${{ inputs.version-label }} + path: ./packages/cinterop/build/realmWindowsBuild/Release + + - name: Restore MacOS JNI lib + uses: actions/download-artifact@v3 + with: + name: jni-macos-lib-${{ inputs.version-label }} + path: ./packages/cinterop/build/realmMacOsBuild + + - name: Restore m2-buildrepo + uses: actions/download-artifact@v3 + with: + name: all-packages-${{ inputs.version-label }} + path: ./packages/build/m2-buildrepo + + # - name: Publish release to Maven Central + # env: + # GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY_BASE_64 }} + # GPG_PASS_PHRASE: ${{ secrets.GPG_PASS_PHRASE }} + # MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }} + # MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + # working-directory: packages + # run: | + # ./gradlew -Prealm.kotlin.targets=iosArm64,iosX64,jvm,macosX64,macosArm64,android,metadata,compilerPlugin,gradlePlugin \ + # -Prealm.kotlin.buildRealmCore=false \ + # -Prealm.kotlin.copyNativeJvmLibs=linux,windows,macos \ + # -Prealm.kotlin.mainHost=true \ + # -PsignBuild=true \ + # -PsignSecretRingFileKotlin="$GPG_SIGNING_KEY" \ + # -PsignPasswordKotlin="$GPG_PASS_PHRASE" \ + # -PossrhUsername="$MAVEN_CENTRAL_USER" \ + # -PossrhPassword='$MAVEN_CENTRAL_PASSWORD' \ + # publishToSonatype + + - name: Publish release to Maven Central Legacy + env: + GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY_BASE_64 }} + GPG_PASS_PHRASE: ${{ secrets.GPG_PASS_PHRASE }} + MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + REALM_S3_ACCESS_KEY: ${{ secrets.REALM_S3_ACCESS_KEY_BASE }} + REALM_S3_SECRET_KEY: ${{ secrets.REALM_S3_SECRET_KEY }} + DOCS_S3_ACCESS_KEY: ${{ secrets.DOCS_S3_ACCESS_KEY }} + DOCS_S3_SECRET_KEY: ${{ secrets.DOCS_S3_SECRET_KEY }} + SLACK_URL_RELEASE: ${{ secrets.SLACK_URL_RELEASE }} + SLACK_URL_CI: ${{ secrets.SLACK_URL_CI }} + GRADLE_PORTAL_KEY: ${{ secrets.GRADLE_PORTAL_KEY }} + GRADLE_PORTAL_SECRET: ${{ secrets.GRADLE_PORTAL_SECRET }} + run: | + set +x + sh ./tools/publish_release.sh "$MAVEN_CENTRAL_USER" "$MAVEN_CENTRAL_PASSWORD" \ + "$REALM_S3_ACCESS_KEY" "$REALM_S3_SECRET_KEY" \ + "$DOCS_S3_ACCESS_KEY" "$DOCS_S3_SECRET_KEY" \ + "$SLACK_URL_RELEASE" "$SLACK_URL_CI" \ + "$GRADLE_PORTAL_KEY" "$GRADLE_PORTAL_SECRET" \ + '-PsignBuild=true -PsignSecretRingFileKotlin="$GPG_SIGNING_KEY" -PsignPasswordKotlin=$GPG_PASS_PHRASE' + diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a7c503c9da..c0a077565f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -498,7 +498,7 @@ jobs: needs.check-cache.outputs.android-test-sync-apk-cache-hit != 'true') steps: - - name: Remove unnecessary files + - name: Remove unnecessary files run: | sudo rm -rf /usr/share/dotnet sudo rm -rf "$AGENT_TOOLSDIRECTORY" @@ -1649,3 +1649,26 @@ jobs: secrets: inherit with: version-label: ${{ needs.check-cache.outputs.version-label }} + + + deploy-release: + uses: ./.github/workflows/include-deploy-release.yml + needs: [ + check-cache, + static-analysis, + # integration-tests, + # test-jvm-packages, + # test-macos-packages, + # test-ios-packages, + # test-android-packages-emulator, + # test-android-packages-device-farm, + # test-android-packages-device-farm-sync, + package-all-artifacts + ] + if: | + always() && + !cancelled() + secrets: inherit + with: + version-label: ${{ needs.check-cache.outputs.version-label }} + packages-sha-label: ${{ needs.check-cache.outputs.packages-sha }} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index a9735d8935..fdad4fbf8c 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -62,7 +62,7 @@ val HOST_OS: OperatingSystem = findHostOs() object Realm { val ciBuild = (System.getenv("JENKINS_HOME") != null || System.getenv("CI") != null) - const val version = "1.14.0-SNAPSHOT" + const val version = "0.0.1" const val group = "io.realm.kotlin" const val projectUrl = "https://realm.io" const val pluginPortalId = "io.realm.kotlin" From d957d08e2feaf4fe1b6a7835f5409dff14ac7e15 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 22 Feb 2024 17:16:50 +0000 Subject: [PATCH 05/36] Install dep for realpath --- .github/workflows/pr.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index c0a077565f..9f4bd45c9c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -432,6 +432,9 @@ jobs: key: 'jvm-package' max-size: '2.0G' + - name: Install coreutils + run: brew install coreutils + - name: Prepend ccache executables to the PATH run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH From 45b89863b0abf39312d0cc798f9f8c57fe6a0c2d Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 22 Feb 2024 17:44:52 +0000 Subject: [PATCH 06/36] fix --- .github/workflows/include-deploy-release.yml | 3 +++ .github/workflows/pr.yml | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/include-deploy-release.yml b/.github/workflows/include-deploy-release.yml index b135d7fb1d..af2c968926 100644 --- a/.github/workflows/include-deploy-release.yml +++ b/.github/workflows/include-deploy-release.yml @@ -50,6 +50,9 @@ jobs: key: 'jvm-package' max-size: '2.0G' + - name: Install coreutils + run: brew install coreutils + - name: Prepend ccache executables to the PATH run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9f4bd45c9c..c0a077565f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -432,9 +432,6 @@ jobs: key: 'jvm-package' max-size: '2.0G' - - name: Install coreutils - run: brew install coreutils - - name: Prepend ccache executables to the PATH run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH From 15fe2d5ce5074b7ca0acfb7210a4e049aca7d913 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 23 Feb 2024 00:15:59 +0000 Subject: [PATCH 07/36] test --- tools/publish_release.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/publish_release.sh b/tools/publish_release.sh index a27818fbcd..b5998d17ac 100644 --- a/tools/publish_release.sh +++ b/tools/publish_release.sh @@ -166,14 +166,14 @@ notify_slack_channels() { # Run Release steps ######################################\ -check_env -verify_release_preconditions -verify_changelog +# check_env +# verify_release_preconditions +# verify_changelog if [ "$1" != "verify" ]; then - create_javadoc + # create_javadoc publish_artifacts - upload_debug_symbols - upload_dokka + # upload_debug_symbols + # upload_dokka notify_slack_channels fi From 3ec50d43d84874dd78705d098692d02cf082974c Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 23 Feb 2024 10:45:58 +0000 Subject: [PATCH 08/36] Passing argument properly --- .github/workflows/include-deploy-release.yml | 12 ++++++------ tools/publish_release.sh | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/include-deploy-release.yml b/.github/workflows/include-deploy-release.yml index af2c968926..cb25e59178 100644 --- a/.github/workflows/include-deploy-release.yml +++ b/.github/workflows/include-deploy-release.yml @@ -136,10 +136,10 @@ jobs: GRADLE_PORTAL_SECRET: ${{ secrets.GRADLE_PORTAL_SECRET }} run: | set +x - sh ./tools/publish_release.sh "$MAVEN_CENTRAL_USER" "$MAVEN_CENTRAL_PASSWORD" \ - "$REALM_S3_ACCESS_KEY" "$REALM_S3_SECRET_KEY" \ - "$DOCS_S3_ACCESS_KEY" "$DOCS_S3_SECRET_KEY" \ - "$SLACK_URL_RELEASE" "$SLACK_URL_CI" \ - "$GRADLE_PORTAL_KEY" "$GRADLE_PORTAL_SECRET" \ - '-PsignBuild=true -PsignSecretRingFileKotlin="$GPG_SIGNING_KEY" -PsignPasswordKotlin=$GPG_PASS_PHRASE' + sh ./tools/publish_release.sh "${{ secrets.MAVEN_CENTRAL_USER }}" "${{ secrets.MAVEN_CENTRAL_PASSWORD }}" \ + "${{ secrets.REALM_S3_ACCESS_KEY_BASE }}" "${{ secrets.REALM_S3_SECRET_KEY }}" \ + "${{ secrets.DOCS_S3_ACCESS_KEY }}" "${{ secrets.DOCS_S3_SECRET_KEY }}" \ + "${{ secrets.SLACK_URL_RELEASE }}" "${{ secrets.SLACK_URL_CI }}" \ + "${{ secrets.GRADLE_PORTAL_KEY }}" "${{ secrets.GRADLE_PORTAL_SECRET }}" \ + '-PsignBuild=true -PsignSecretRingFileKotlin="${{ secrets.GPG_SIGNING_KEY_BASE_64 }}" -PsignPasswordKotlin=${{ secrets.GPG_PASS_PHRASE }}' diff --git a/tools/publish_release.sh b/tools/publish_release.sh index b5998d17ac..62cebde0d8 100644 --- a/tools/publish_release.sh +++ b/tools/publish_release.sh @@ -48,6 +48,7 @@ SLACK_WEBHOOK_JAVA_CI_URL="$8" GRADLE_PORTAL_KEY="$9" GRADLE_PORTAL_SECRET="${10}" GRADLE_BUILD_PARAMS="${11}" +echo $MAVEN_CENTRAL_USER abort_release() { # Reporting failures to #realm-java-team-ci is done from Jenkins From c2ba602c6ca259f2b0505b867ef3bfdf89e2c9f5 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 27 Feb 2024 11:00:37 +0000 Subject: [PATCH 09/36] Publish only the artifacts --- tools/publish_release.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/publish_release.sh b/tools/publish_release.sh index 62cebde0d8..90c8de0fbd 100644 --- a/tools/publish_release.sh +++ b/tools/publish_release.sh @@ -116,9 +116,10 @@ create_javadoc() { publish_artifacts() { echo "Releasing on MavenCentral" cd $REALM_KOTLIN_PATH/packages - eval "./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository $GRADLE_BUILD_PARAMS -PossrhUsername=$MAVEN_CENTRAL_USER -PossrhPassword=$MAVEN_CENTRAL_KEY" - echo "Releasing on Gradle Plugin Portal" - eval "./gradlew :gradle-plugin:publishPlugin $GRADLE_BUILD_PARAMS -PgeneratePluginArtifactMarker=true -Pgradle.publish.key=$GRADLE_PORTAL_KEY -Pgradle.publish.secret=$GRADLE_PORTAL_SECRET" + # eval "./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository $GRADLE_BUILD_PARAMS -PossrhUsername=$MAVEN_CENTRAL_USER -PossrhPassword=$MAVEN_CENTRAL_KEY" + eval "./gradlew publishToSonatype $GRADLE_BUILD_PARAMS -PossrhUsername=$MAVEN_CENTRAL_USER -PossrhPassword=$MAVEN_CENTRAL_KEY" + # echo "Releasing on Gradle Plugin Portal" + # eval "./gradlew :gradle-plugin:publishPlugin $GRADLE_BUILD_PARAMS -PgeneratePluginArtifactMarker=true -Pgradle.publish.key=$GRADLE_PORTAL_KEY -Pgradle.publish.secret=$GRADLE_PORTAL_SECRET" cd $HERE } @@ -176,5 +177,5 @@ if [ "$1" != "verify" ]; then publish_artifacts # upload_debug_symbols # upload_dokka - notify_slack_channels + # notify_slack_channels fi From ee61cd3a200b2a715eb006bfff1f7631378261ee Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 27 Feb 2024 14:38:31 +0000 Subject: [PATCH 10/36] Testing release --- .github/workflows/pr.yml | 1278 +++++++++++++++++++------------------- 1 file changed, 639 insertions(+), 639 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index fbc3e5501d..df6530f3d5 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -914,634 +914,634 @@ jobs: # TODO Compare speed between emulator and Device Farm # TODO We should be able to move this into a reusable work-flow - test-android-packages-emulator: - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - type: [base, sync] - include: - - type: base - test-title: Unit Test Results - Android Base (Emulator) - - type: sync - test-title: Unit Test Results - Android Sync (Emulator) + # test-android-packages-emulator: + # timeout-minutes: 60 + # strategy: + # fail-fast: false + # matrix: + # type: [base, sync] + # include: + # - type: base + # test-title: Unit Test Results - Android Base (Emulator) + # - type: sync + # test-title: Unit Test Results - Android Sync (Emulator) - runs-on: macos-latest - needs: [check-cache, build-android-packages, build-jvm-packages, build-kotlin-metadata-package] - if: | - always() && - !cancelled() && - !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: "recursive" - - # checkout BAAS CLI repo - - name: Checkout BAAS repo - if: matrix.type == 'sync' - 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 - if: matrix.type == 'sync' - 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 | jq -r '.id') - echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - - - name: Setup Java 11 - uses: actions/setup-java@v3 - with: - distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} - java-version: ${{ vars.VERSION_JAVA }} - - - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 - with: - cache-read-only: false - - - name: Restore Kotlin metadata artifacts - uses: actions/download-artifact@v3 - with: - name: packages-metadata-${{ needs.check-cache.outputs.version-label }} - path: ./packages/build/m2-buildrepo - - - name: Restore m2-buildrepo (Android) - uses: actions/download-artifact@v3 - with: - name: packages-android-${{ needs.check-cache.outputs.version-label }} - path: ./packages/build/m2-buildrepo - - - name: Restore m2-buildrepo (JVM) - uses: actions/download-artifact@v3 - with: - name: packages-jvm-${{ needs.check-cache.outputs.version-label }} - path: ./packages/build/m2-buildrepo - - # 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 - if: matrix.type == 'sync' - 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 - - # TODO This action does not support using `\` to split multiline scripts. - - name: Run Integration Tests - env: - SSH_AUTH_SOCK: /tmp/ssh_agent.sock - uses: reactivecircus/android-emulator-runner@v2 - with: - emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - disable-animations: true - api-level: ${{ vars.VERSION_ANDROID_EMULATOR_API_LEVEL }} # Must be 30 to support aosp_atd - target: default - arch: x86_64 - disk-size: 4096M - ram-size: 2048M - heap-size: 1024M - channel: canary - script: | - adb logcat -c - adb logcat > logcat.txt & - cd packages && ./gradlew :test-${{ matrix.type }}:connectedCheck -PsyncUsePlatformNetworking=true -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} -PincludeSdkModules=false --info --no-daemon - - - name: Archive LogCat data - uses: actions/upload-artifact@v3 - if: always() || failure() - with: - name: logcat-${{ matrix.type }}-emulator.txt - path: logcat.txt - retention-days: 1 - - - name: Publish Unit Test Results - uses: dorny/test-reporter@v1 - if: always() || failure() - with: - name: ${{ matrix.test-title }} - path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml - reporter: java-junit - list-suites: failed - list-tests: failed - fail-on-error: true - - - name: Stopping the BAAS container - if: always() && matrix.type == 'sync' - 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 + # runs-on: macos-latest + # needs: [check-cache, build-android-packages, build-jvm-packages, build-kotlin-metadata-package] + # if: | + # always() && + # !cancelled() && + # !contains(needs.*.result, 'failure') && + # !contains(needs.*.result, 'cancelled') + + # steps: + # - name: Checkout code + # uses: actions/checkout@v3 + # with: + # submodules: "recursive" + + # # checkout BAAS CLI repo + # - name: Checkout BAAS repo + # if: matrix.type == 'sync' + # 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 + # if: matrix.type == 'sync' + # 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 | jq -r '.id') + # echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT + + # - name: Setup Java 11 + # uses: actions/setup-java@v3 + # with: + # distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} + # java-version: ${{ vars.VERSION_JAVA }} + + # - name: Setup Gradle and task/dependency caching + # uses: gradle/gradle-build-action@v2 + # with: + # cache-read-only: false + + # - name: Restore Kotlin metadata artifacts + # uses: actions/download-artifact@v3 + # with: + # name: packages-metadata-${{ needs.check-cache.outputs.version-label }} + # path: ./packages/build/m2-buildrepo + + # - name: Restore m2-buildrepo (Android) + # uses: actions/download-artifact@v3 + # with: + # name: packages-android-${{ needs.check-cache.outputs.version-label }} + # path: ./packages/build/m2-buildrepo + + # - name: Restore m2-buildrepo (JVM) + # uses: actions/download-artifact@v3 + # with: + # name: packages-jvm-${{ needs.check-cache.outputs.version-label }} + # path: ./packages/build/m2-buildrepo + + # # 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 + # if: matrix.type == 'sync' + # 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 + + # # TODO This action does not support using `\` to split multiline scripts. + # - name: Run Integration Tests + # env: + # SSH_AUTH_SOCK: /tmp/ssh_agent.sock + # uses: reactivecircus/android-emulator-runner@v2 + # with: + # emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + # disable-animations: true + # api-level: ${{ vars.VERSION_ANDROID_EMULATOR_API_LEVEL }} # Must be 30 to support aosp_atd + # target: default + # arch: x86_64 + # disk-size: 4096M + # ram-size: 2048M + # heap-size: 1024M + # channel: canary + # script: | + # adb logcat -c + # adb logcat > logcat.txt & + # cd packages && ./gradlew :test-${{ matrix.type }}:connectedCheck -PsyncUsePlatformNetworking=true -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} -PincludeSdkModules=false --info --no-daemon + + # - name: Archive LogCat data + # uses: actions/upload-artifact@v3 + # if: always() || failure() + # with: + # name: logcat-${{ matrix.type }}-emulator.txt + # path: logcat.txt + # retention-days: 1 + + # - name: Publish Unit Test Results + # uses: dorny/test-reporter@v1 + # if: always() || failure() + # with: + # name: ${{ matrix.test-title }} + # path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml + # reporter: java-junit + # list-suites: failed + # list-tests: failed + # fail-on-error: true + + # - name: Stopping the BAAS container + # if: always() && matrix.type == 'sync' + # 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 # Disable device farm test for Base, because running two in parallel seems to interfer somehow - test-android-packages-device-farm: - name: AWS Device Farm - timeout-minutes: 60 - runs-on: ubuntu-latest - needs: [ check-cache, build-android-packages, build-jvm-packages ] - if: | - false && - always() && - !cancelled() && - !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') - - steps: - - 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 - - - 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 - app-id: io.realm.testapp - 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 - - # 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 | jq -r '.id') - echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - - - 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/ - - - 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 - - # 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 the Sync tests - 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 - apk-auxiliary-path: ${{ github.workspace }}/packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk - baas_url: ${{ steps.baas_cli_poll.outputs.baas_container_hostname }} - app-id: io.realm.sync.testapp.test - project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} - device-pool-arn: ${{ secrets.DEVICEFARM_POOL_ARN }} - - - 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-macos-packages: - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - os: [macos-latest] # , macos-arm] - type: [base, sync] - include: - - os: macos-latest - type: base - os-id: macos - package-prefix: macos-x64 - test-title: Unit Test Results - MacOS x64 Base - - os: macos-latest - type: sync - os-id: macos - package-prefix: macos-x64 - test-title: Unit Test Results - MacOS x64 Sync - # - os: macos-arm - # package-prefix: macos-arm64 - # test-title: Results - MacOS arm64 Base + # test-android-packages-device-farm: + # name: AWS Device Farm + # timeout-minutes: 60 + # runs-on: ubuntu-latest + # needs: [ check-cache, build-android-packages, build-jvm-packages ] + # if: | + # false && + # always() && + # !cancelled() && + # !contains(needs.*.result, 'failure') && + # !contains(needs.*.result, 'cancelled') + + # steps: + # - 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 + + # - 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 + # app-id: io.realm.testapp + # 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 + + # # 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 | jq -r '.id') + # echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT + + # - 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/ + + # - 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 + + # # 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 the Sync tests + # 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 + # apk-auxiliary-path: ${{ github.workspace }}/packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk + # baas_url: ${{ steps.baas_cli_poll.outputs.baas_container_hostname }} + # app-id: io.realm.sync.testapp.test + # project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} + # device-pool-arn: ${{ secrets.DEVICEFARM_POOL_ARN }} + + # - 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-macos-packages: + # timeout-minutes: 60 + # strategy: + # fail-fast: false + # matrix: + # os: [macos-latest] # , macos-arm] + # type: [base, sync] + # include: + # - os: macos-latest + # type: base + # os-id: macos + # package-prefix: macos-x64 + # test-title: Unit Test Results - MacOS x64 Base + # - os: macos-latest + # type: sync + # os-id: macos + # package-prefix: macos-x64 + # test-title: Unit Test Results - MacOS x64 Sync + # # - os: macos-arm + # # package-prefix: macos-arm64 + # # test-title: Results - MacOS arm64 Base - runs-on: ${{ matrix.os }} - # TODO Unclear why MacOS needs the metadata package when the Android Tests do not - # Disable macos-arm for now as the host needs to have the Android SDK installed even though it isn't really using it. - needs: [check-cache, build-macos-x64-packages, build-kotlin-metadata-package] #, build-macos-arm64-packages] - if: | - always() && - !cancelled() && - !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - # checkout BAAS CLI repo - - name: Checkout BAAS repo - if: matrix.type == 'sync' - 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 - if: matrix.type == 'sync' - 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 | jq -r '.id') - echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - - - name: Setup Java 11 - uses: actions/setup-java@v3 - with: - distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} - java-version: ${{ vars.VERSION_JAVA }} - - - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 - with: - cache-read-only: false - - - name: Restore m2-buildrepo - uses: actions/download-artifact@v3 - with: - name: packages-${{ matrix.package-prefix }}-${{ needs.check-cache.outputs.version-label }} - path: ./packages/build/m2-buildrepo - - - name: Restore Kotlin metadata artifacts - uses: actions/download-artifact@v3 - with: - name: packages-metadata-${{ needs.check-cache.outputs.version-label }} - path: ./packages/build/m2-buildrepo - - - # 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 - if: matrix.type == 'sync' - 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 tests - working-directory: packages - run: > - ./gradlew :test-${{ matrix.type }}:macosTest - -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} - -PincludeSdkModules=false - --info --no-daemon - - - name: Publish Unit Test Results - uses: dorny/test-reporter@v1 - if: always() || failure() - with: - name: ${{ matrix.test-title }} - path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml - reporter: java-junit - list-suites: failed - list-tests: failed - fail-on-error: true - - - name: Stopping the BAAS container - if: always() && matrix.type == 'sync' - 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: 60 - strategy: - fail-fast: false - matrix: - os: [macos-latest] # , macos-arm] - type: [base, sync] - include: - - os: macos-latest - type: base - package-prefix: x64 - test-title: Unit Test Results - iOS x64 Base - test-task: iosTest - - os: macos-latest - type: sync - package-prefix: x64 - test-title: Unit Test Results - iOS x64 Sync - test-task: iosTest - # - os: macos-arm - # package-prefix: macos-arm64 - # test-title: Results - MacOS arm64 Base + # runs-on: ${{ matrix.os }} + # # TODO Unclear why MacOS needs the metadata package when the Android Tests do not + # # Disable macos-arm for now as the host needs to have the Android SDK installed even though it isn't really using it. + # needs: [check-cache, build-macos-x64-packages, build-kotlin-metadata-package] #, build-macos-arm64-packages] + # if: | + # always() && + # !cancelled() && + # !contains(needs.*.result, 'failure') && + # !contains(needs.*.result, 'cancelled') + + # steps: + # - name: Checkout code + # uses: actions/checkout@v3 + + # # checkout BAAS CLI repo + # - name: Checkout BAAS repo + # if: matrix.type == 'sync' + # 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 + # if: matrix.type == 'sync' + # 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 | jq -r '.id') + # echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT + + # - name: Setup Java 11 + # uses: actions/setup-java@v3 + # with: + # distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} + # java-version: ${{ vars.VERSION_JAVA }} + + # - name: Setup Gradle and task/dependency caching + # uses: gradle/gradle-build-action@v2 + # with: + # cache-read-only: false + + # - name: Restore m2-buildrepo + # uses: actions/download-artifact@v3 + # with: + # name: packages-${{ matrix.package-prefix }}-${{ needs.check-cache.outputs.version-label }} + # path: ./packages/build/m2-buildrepo + + # - name: Restore Kotlin metadata artifacts + # uses: actions/download-artifact@v3 + # with: + # name: packages-metadata-${{ needs.check-cache.outputs.version-label }} + # path: ./packages/build/m2-buildrepo + + + # # 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 + # if: matrix.type == 'sync' + # 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 tests + # working-directory: packages + # run: > + # ./gradlew :test-${{ matrix.type }}:macosTest + # -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} + # -PincludeSdkModules=false + # --info --no-daemon + + # - name: Publish Unit Test Results + # uses: dorny/test-reporter@v1 + # if: always() || failure() + # with: + # name: ${{ matrix.test-title }} + # path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml + # reporter: java-junit + # list-suites: failed + # list-tests: failed + # fail-on-error: true + + # - name: Stopping the BAAS container + # if: always() && matrix.type == 'sync' + # 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: 60 + # strategy: + # fail-fast: false + # matrix: + # os: [macos-latest] # , macos-arm] + # type: [base, sync] + # include: + # - os: macos-latest + # type: base + # package-prefix: x64 + # test-title: Unit Test Results - iOS x64 Base + # test-task: iosTest + # - os: macos-latest + # type: sync + # package-prefix: x64 + # test-title: Unit Test Results - iOS x64 Sync + # test-task: iosTest + # # - os: macos-arm + # # package-prefix: macos-arm64 + # # test-title: Results - MacOS arm64 Base - runs-on: ${{ matrix.os }} - # TODO Unclear why MacOS needs the metadata package when the Android Tests do not - # Disable macos-arm for now as the host needs to have the Android SDK installed even though it isn't really using it. - needs: [check-cache, build-ios-x64-packages, build-kotlin-metadata-package, build-macos-x64-packages] # , build-ios-arm64-packages] - if: | - always() && - !cancelled() && - !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - # checkout BAAS CLI repo - - name: Checkout BAAS repo - if: matrix.type == 'sync' - 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 - if: matrix.type == 'sync' - 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 | jq -r '.id') - echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - - - name: Setup Java 11 - uses: actions/setup-java@v3 - with: - distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} - java-version: ${{ vars.VERSION_JAVA }} - - - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 - with: - cache-read-only: false - - - name: Restore m2-buildrepo (ios) - uses: actions/download-artifact@v3 - with: - name: packages-ios-${{ matrix.package-prefix }}-${{ needs.check-cache.outputs.version-label }} - path: ./packages/build/m2-buildrepo - - - name: Restore Kotlin metadata artifacts - uses: actions/download-artifact@v3 - with: - name: packages-metadata-${{ needs.check-cache.outputs.version-label }} - path: ./packages/build/m2-buildrepo - - - # 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 - if: matrix.type == 'sync' - 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 - - # App names are limited to 32 characters, so the appNamePrefix should not exceed 22 characters. - - name: Run tests - working-directory: packages - run: > - ./gradlew :test-${{ matrix.type }}:${{ matrix.test-task }} - -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} - -PincludeSdkModules=false - --info --no-daemon - - - name: Publish Unit Test Results - uses: dorny/test-reporter@v1 - if: always() || failure() - with: - name: ${{ matrix.test-title }} - path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml - reporter: java-junit - list-suites: failed - list-tests: failed - fail-on-error: true - - - name: Stopping the BAAS container - if: always() && matrix.type == 'sync' - 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-jvm-packages: - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] # TODO Should we also test om MacOS arm64? - type: [base, sync] - include: - - os: macos-latest - os-id: mac - type: base - test-title: Unit Test Results - Base JVM MacOS x64 - - os: ubuntu-latest - os-id: ubu - type: base - test-title: Unit Test Results - Base JVM Linux - - os: windows-latest - os-id: win - type: base - test-title: Unit Test Results - Base JVM Windows - - os: macos-latest - os-id: mac - type: sync - test-title: Unit Test Results - Sync JVM MacOS x64 - - os: ubuntu-latest - os-id: ubu - type: sync - test-title: Unit Test Results - Sync JVM Linux - exclude: - # Do not run Windows Sync Tests, because the bash script for - # starting the BAAS container doesn not work on Windows. - - os: windows-latest - #os-id: win - type: sync - #test-title: Unit Test Results - Sync JVM Windows - - runs-on: ${{ matrix.os }} - needs: [check-cache, build-jvm-packages, build-kotlin-metadata-package] - if: | - always() && - !cancelled() && - !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - # checkout BAAS CLI repo - - name: Checkout BAAS repo - if: matrix.type == 'sync' - 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 - if: matrix.type == 'sync' - 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 | jq -r '.id') - echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - - - name: Setup Java 11 - uses: actions/setup-java@v3 - with: - distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} - java-version: ${{ vars.VERSION_JAVA }} - - - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 - with: - cache-read-only: false - - - name: Restore Kotlin metadata artifacts - uses: actions/download-artifact@v3 - with: - name: packages-metadata-${{ needs.check-cache.outputs.version-label }} - path: ./packages/build/m2-buildrepo - - - name: Restore m2-buildrepo - uses: actions/download-artifact@v3 - with: - name: packages-jvm-${{ needs.check-cache.outputs.version-label }} - path: ./packages/build/m2-buildrepo - - # 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 - if: matrix.type == 'sync' - 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 - - # App names are limited to 32 characters, so the appNamePrefix should not exceed 22 characters. - - name: Run tests - working-directory: packages - run: > - ./gradlew :test-${{ matrix.type }}:jvmTest - -PsyncUsePlatformNetworking=true - -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} - -PincludeSdkModules=false - --info --no-daemon - - - name: Publish Unit Test Results - uses: dorny/test-reporter@v1 - if: always() || failure() - with: - name: ${{ matrix.test-title }} - path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml - reporter: java-junit - list-suites: failed - list-tests: failed - fail-on-error: true - - - name: Stopping the BAAS container - if: always() && matrix.type == 'sync' - 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 + # runs-on: ${{ matrix.os }} + # # TODO Unclear why MacOS needs the metadata package when the Android Tests do not + # # Disable macos-arm for now as the host needs to have the Android SDK installed even though it isn't really using it. + # needs: [check-cache, build-ios-x64-packages, build-kotlin-metadata-package, build-macos-x64-packages] # , build-ios-arm64-packages] + # if: | + # always() && + # !cancelled() && + # !contains(needs.*.result, 'failure') && + # !contains(needs.*.result, 'cancelled') + + # steps: + # - name: Checkout code + # uses: actions/checkout@v3 + + # # checkout BAAS CLI repo + # - name: Checkout BAAS repo + # if: matrix.type == 'sync' + # 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 + # if: matrix.type == 'sync' + # 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 | jq -r '.id') + # echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT + + # - name: Setup Java 11 + # uses: actions/setup-java@v3 + # with: + # distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} + # java-version: ${{ vars.VERSION_JAVA }} + + # - name: Setup Gradle and task/dependency caching + # uses: gradle/gradle-build-action@v2 + # with: + # cache-read-only: false + + # - name: Restore m2-buildrepo (ios) + # uses: actions/download-artifact@v3 + # with: + # name: packages-ios-${{ matrix.package-prefix }}-${{ needs.check-cache.outputs.version-label }} + # path: ./packages/build/m2-buildrepo + + # - name: Restore Kotlin metadata artifacts + # uses: actions/download-artifact@v3 + # with: + # name: packages-metadata-${{ needs.check-cache.outputs.version-label }} + # path: ./packages/build/m2-buildrepo + + + # # 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 + # if: matrix.type == 'sync' + # 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 + + # # App names are limited to 32 characters, so the appNamePrefix should not exceed 22 characters. + # - name: Run tests + # working-directory: packages + # run: > + # ./gradlew :test-${{ matrix.type }}:${{ matrix.test-task }} + # -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} + # -PincludeSdkModules=false + # --info --no-daemon + + # - name: Publish Unit Test Results + # uses: dorny/test-reporter@v1 + # if: always() || failure() + # with: + # name: ${{ matrix.test-title }} + # path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml + # reporter: java-junit + # list-suites: failed + # list-tests: failed + # fail-on-error: true + + # - name: Stopping the BAAS container + # if: always() && matrix.type == 'sync' + # 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-jvm-packages: + # timeout-minutes: 60 + # strategy: + # fail-fast: false + # matrix: + # os: [macos-latest, ubuntu-latest, windows-latest] # TODO Should we also test om MacOS arm64? + # type: [base, sync] + # include: + # - os: macos-latest + # os-id: mac + # type: base + # test-title: Unit Test Results - Base JVM MacOS x64 + # - os: ubuntu-latest + # os-id: ubu + # type: base + # test-title: Unit Test Results - Base JVM Linux + # - os: windows-latest + # os-id: win + # type: base + # test-title: Unit Test Results - Base JVM Windows + # - os: macos-latest + # os-id: mac + # type: sync + # test-title: Unit Test Results - Sync JVM MacOS x64 + # - os: ubuntu-latest + # os-id: ubu + # type: sync + # test-title: Unit Test Results - Sync JVM Linux + # exclude: + # # Do not run Windows Sync Tests, because the bash script for + # # starting the BAAS container doesn not work on Windows. + # - os: windows-latest + # #os-id: win + # type: sync + # #test-title: Unit Test Results - Sync JVM Windows + + # runs-on: ${{ matrix.os }} + # needs: [check-cache, build-jvm-packages, build-kotlin-metadata-package] + # if: | + # always() && + # !cancelled() && + # !contains(needs.*.result, 'failure') && + # !contains(needs.*.result, 'cancelled') + + # steps: + # - name: Checkout code + # uses: actions/checkout@v3 + + # # checkout BAAS CLI repo + # - name: Checkout BAAS repo + # if: matrix.type == 'sync' + # 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 + # if: matrix.type == 'sync' + # 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 | jq -r '.id') + # echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT + + # - name: Setup Java 11 + # uses: actions/setup-java@v3 + # with: + # distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} + # java-version: ${{ vars.VERSION_JAVA }} + + # - name: Setup Gradle and task/dependency caching + # uses: gradle/gradle-build-action@v2 + # with: + # cache-read-only: false + + # - name: Restore Kotlin metadata artifacts + # uses: actions/download-artifact@v3 + # with: + # name: packages-metadata-${{ needs.check-cache.outputs.version-label }} + # path: ./packages/build/m2-buildrepo + + # - name: Restore m2-buildrepo + # uses: actions/download-artifact@v3 + # with: + # name: packages-jvm-${{ needs.check-cache.outputs.version-label }} + # path: ./packages/build/m2-buildrepo + + # # 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 + # if: matrix.type == 'sync' + # 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 + + # # App names are limited to 32 characters, so the appNamePrefix should not exceed 22 characters. + # - name: Run tests + # working-directory: packages + # run: > + # ./gradlew :test-${{ matrix.type }}:jvmTest + # -PsyncUsePlatformNetworking=true + # -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} + # -PincludeSdkModules=false + # --info --no-daemon + + # - name: Publish Unit Test Results + # uses: dorny/test-reporter@v1 + # if: always() || failure() + # with: + # name: ${{ matrix.test-title }} + # path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml + # reporter: java-junit + # list-suites: failed + # list-tests: failed + # fail-on-error: true + + # - name: Stopping the BAAS container + # if: always() && matrix.type == 'sync' + # 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 package-all-artifacts: runs-on: ubuntu-latest @@ -1607,29 +1607,29 @@ jobs: path: ./packages/build/m2-buildrepo retention-days: 7 - integration-tests: - uses: ./.github/workflows/include-integration-tests.yml - needs: [check-cache, package-all-artifacts] - if: | - always() && - !cancelled() && - !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') - with: - version-label: ${{ needs.check-cache.outputs.version-label }} + # integration-tests: + # uses: ./.github/workflows/include-integration-tests.yml + # needs: [check-cache, package-all-artifacts] + # if: | + # always() && + # !cancelled() && + # !contains(needs.*.result, 'failure') && + # !contains(needs.*.result, 'cancelled') + # with: + # version-label: ${{ needs.check-cache.outputs.version-label }} deploy-snapshot: uses: ./.github/workflows/include-deploy-snapshot.yml needs: [ check-cache, static-analysis, - integration-tests, - test-jvm-packages, - test-macos-packages, - test-ios-packages, - test-android-packages-emulator, + # integration-tests, + # test-jvm-packages, + # test-macos-packages, + # test-ios-packages, + # test-android-packages-emulator, # test-android-packages-device-farm, - test-android-packages-device-farm-sync, + # test-android-packages-device-farm-sync, package-all-artifacts ] if: | From be39ffa0a5b87c026b755f9b4a60566ecd74b123 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 27 Feb 2024 16:39:36 +0000 Subject: [PATCH 11/36] Debugging --- .github/workflows/include-deploy-release.yml | 4 ++-- tools/publish_release.sh | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/include-deploy-release.yml b/.github/workflows/include-deploy-release.yml index cb25e59178..e61405c830 100644 --- a/.github/workflows/include-deploy-release.yml +++ b/.github/workflows/include-deploy-release.yml @@ -126,8 +126,8 @@ jobs: GPG_PASS_PHRASE: ${{ secrets.GPG_PASS_PHRASE }} MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }} MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} - REALM_S3_ACCESS_KEY: ${{ secrets.REALM_S3_ACCESS_KEY_BASE }} - REALM_S3_SECRET_KEY: ${{ secrets.REALM_S3_SECRET_KEY }} + REALM_S3_ACCESS_KEY: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} + REALM_S3_SECRET_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} DOCS_S3_ACCESS_KEY: ${{ secrets.DOCS_S3_ACCESS_KEY }} DOCS_S3_SECRET_KEY: ${{ secrets.DOCS_S3_SECRET_KEY }} SLACK_URL_RELEASE: ${{ secrets.SLACK_URL_RELEASE }} diff --git a/tools/publish_release.sh b/tools/publish_release.sh index 90c8de0fbd..40789f261c 100644 --- a/tools/publish_release.sh +++ b/tools/publish_release.sh @@ -48,7 +48,23 @@ SLACK_WEBHOOK_JAVA_CI_URL="$8" GRADLE_PORTAL_KEY="$9" GRADLE_PORTAL_SECRET="${10}" GRADLE_BUILD_PARAMS="${11}" -echo $MAVEN_CENTRAL_USER + +echo "MAVEN_CENTRAL_USER hash=`echo $MAVEN_CENTRAL_USER | md5`" +echo "MAVEN_CENTRAL_KEY hash=`echo $MAVEN_CENTRAL_KEY | md5`" + +echo "REALM_S3_ACCESS_KEY hash=`echo $REALM_S3_ACCESS_KEY | md5`" +echo "REALM_S3_SECRET_KEY hash=`echo $REALM_S3_SECRET_KEY | md5`" + +echo "DOCS_S3_ACCESS_KEY hash=`echo $DOCS_S3_ACCESS_KEY | md5`" +echo "DOCS_S3_SECRET_KEY hash=`echo $DOCS_S3_SECRET_KEY | md5`" + +echo "SLACK_WEBHOOK_RELEASES_URL hash=`echo $SLACK_WEBHOOK_RELEASES_URL | md5`" +echo "SLACK_WEBHOOK_JAVA_CI_URL hash=`echo $SLACK_WEBHOOK_JAVA_CI_URL | md5`" + +echo "GRADLE_PORTAL_KEY hash=`echo $GRADLE_PORTAL_KEY | md5`" +echo "GRADLE_PORTAL_SECRET hash=`echo $GRADLE_PORTAL_SECRET | md5`" +echo "GRADLE_BUILD_PARAMS hash=`echo $GRADLE_BUILD_PARAMS | md5`" + abort_release() { # Reporting failures to #realm-java-team-ci is done from Jenkins From 1af080fe11677c601ee4d499da13020330b609b1 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 27 Feb 2024 16:52:17 +0000 Subject: [PATCH 12/36] Fix IOCTL --- .github/workflows/include-deploy-release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/include-deploy-release.yml b/.github/workflows/include-deploy-release.yml index e61405c830..e0d4b66a2c 100644 --- a/.github/workflows/include-deploy-release.yml +++ b/.github/workflows/include-deploy-release.yml @@ -134,8 +134,11 @@ jobs: SLACK_URL_CI: ${{ secrets.SLACK_URL_CI }} GRADLE_PORTAL_KEY: ${{ secrets.GRADLE_PORTAL_KEY }} GRADLE_PORTAL_SECRET: ${{ secrets.GRADLE_PORTAL_SECRET }} + GPG_TTY: $(tty) + run: | set +x + export GPG_TTY=$(tty) sh ./tools/publish_release.sh "${{ secrets.MAVEN_CENTRAL_USER }}" "${{ secrets.MAVEN_CENTRAL_PASSWORD }}" \ "${{ secrets.REALM_S3_ACCESS_KEY_BASE }}" "${{ secrets.REALM_S3_SECRET_KEY }}" \ "${{ secrets.DOCS_S3_ACCESS_KEY }}" "${{ secrets.DOCS_S3_SECRET_KEY }}" \ From 24c8b5814975628a803a6668156b751146bcde5c Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 28 Feb 2024 00:21:53 +0000 Subject: [PATCH 13/36] debug --- tools/publish_release.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tools/publish_release.sh b/tools/publish_release.sh index 40789f261c..99265fc01e 100644 --- a/tools/publish_release.sh +++ b/tools/publish_release.sh @@ -65,7 +65,26 @@ echo "GRADLE_PORTAL_KEY hash=`echo $GRADLE_PORTAL_KEY | md5`" echo "GRADLE_PORTAL_SECRET hash=`echo $GRADLE_PORTAL_SECRET | md5`" echo "GRADLE_BUILD_PARAMS hash=`echo $GRADLE_BUILD_PARAMS | md5`" - +echo "debugging MAVEN_CENTRAL_USER" +for (( i=0; i<${#MAVEN_CENTRAL_USER}; i++ )); do + printf "%c" "${MAVEN_CENTRAL_USER:i:1}" +done +echo + +echo "debugging MAVEN_CENTRAL_KEY" +for (( i=0; i<${#MAVEN_CENTRAL_KEY}; i++ )); do + printf "%c" "${MAVEN_CENTRAL_KEY:i:1}" +done +echo + + +echo "debugging GRADLE_BUILD_PARAMS" +for (( i=0; i<${#GRADLE_BUILD_PARAMS}; i++ )); do + printf "%c" "${GRADLE_BUILD_PARAMS:i:1}" +done +echo + +exit 0 abort_release() { # Reporting failures to #realm-java-team-ci is done from Jenkins exit 1 From 5bdc1f576609b33cf5365b2ec3ecabc04176594c Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 28 Feb 2024 10:52:15 +0000 Subject: [PATCH 14/36] debug --- tools/publish_release.sh | 44 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/tools/publish_release.sh b/tools/publish_release.sh index 99265fc01e..f492dc1a08 100644 --- a/tools/publish_release.sh +++ b/tools/publish_release.sh @@ -67,23 +67,61 @@ echo "GRADLE_BUILD_PARAMS hash=`echo $GRADLE_BUILD_PARAMS | md5`" echo "debugging MAVEN_CENTRAL_USER" for (( i=0; i<${#MAVEN_CENTRAL_USER}; i++ )); do - printf "%c" "${MAVEN_CENTRAL_USER:i:1}" + echo "${MAVEN_CENTRAL_USER:i:1}" done echo echo "debugging MAVEN_CENTRAL_KEY" for (( i=0; i<${#MAVEN_CENTRAL_KEY}; i++ )); do - printf "%c" "${MAVEN_CENTRAL_KEY:i:1}" + echo "${MAVEN_CENTRAL_KEY:i:1}" done echo +echo "debugging REALM_S3_ACCESS_KEY" +for (( i=0; i<${#REALM_S3_ACCESS_KEY}; i++ )); do + echo "${:i:1}" +done +echo + +echo "debugging REALM_S3_SECRET_KEY" +for (( i=0; i<${#REALM_S3_SECRET_KEY}; i++ )); do + echo "${:i:1}" +done +echo + +echo "debugging DOCS_S3_ACCESS_KEY" +for (( i=0; i<${#DOCS_S3_ACCESS_KEY}; i++ )); do + echo "${:i:1}" +done +echo + +echo "debugging DOCS_S3_SECRET_KEY" +for (( i=0; i<${#DOCS_S3_SECRET_KEY}; i++ )); do + echo "${:i:1}" +done +echo + +echo "debugging GRADLE_PORTAL_KEY" +for (( i=0; i<${#GRADLE_PORTAL_KEY}; i++ )); do + echo "${:i:1}" +done +echo + +echo "debugging GRADLE_PORTAL_SECRET" +for (( i=0; i<${#GRADLE_PORTAL_SECRET}; i++ )); do + echo "${:i:1}" +done +echo + echo "debugging GRADLE_BUILD_PARAMS" for (( i=0; i<${#GRADLE_BUILD_PARAMS}; i++ )); do - printf "%c" "${GRADLE_BUILD_PARAMS:i:1}" + echo "${GRADLE_BUILD_PARAMS:i:1}" done echo + + exit 0 abort_release() { # Reporting failures to #realm-java-team-ci is done from Jenkins From 878a302a974584f83546ecec95a4db64ab6d2a08 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 28 Feb 2024 11:11:17 +0000 Subject: [PATCH 15/36] fix script --- tools/publish_release.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/publish_release.sh b/tools/publish_release.sh index f492dc1a08..7044b8f303 100644 --- a/tools/publish_release.sh +++ b/tools/publish_release.sh @@ -80,37 +80,37 @@ echo echo "debugging REALM_S3_ACCESS_KEY" for (( i=0; i<${#REALM_S3_ACCESS_KEY}; i++ )); do - echo "${:i:1}" + echo "${REALM_S3_ACCESS_KEY:i:1}" done echo echo "debugging REALM_S3_SECRET_KEY" for (( i=0; i<${#REALM_S3_SECRET_KEY}; i++ )); do - echo "${:i:1}" + echo "${REALM_S3_SECRET_KEY:i:1}" done echo echo "debugging DOCS_S3_ACCESS_KEY" for (( i=0; i<${#DOCS_S3_ACCESS_KEY}; i++ )); do - echo "${:i:1}" + echo "${DOCS_S3_ACCESS_KEY:i:1}" done echo echo "debugging DOCS_S3_SECRET_KEY" for (( i=0; i<${#DOCS_S3_SECRET_KEY}; i++ )); do - echo "${:i:1}" + echo "${DOCS_S3_SECRET_KEY:i:1}" done echo echo "debugging GRADLE_PORTAL_KEY" for (( i=0; i<${#GRADLE_PORTAL_KEY}; i++ )); do - echo "${:i:1}" + echo "${GRADLE_PORTAL_KEY:i:1}" done echo echo "debugging GRADLE_PORTAL_SECRET" for (( i=0; i<${#GRADLE_PORTAL_SECRET}; i++ )); do - echo "${:i:1}" + echo "${GRADLE_PORTAL_SECRET:i:1}" done echo From 338356aa02cb2331e22168813ab50dfdd23b6692 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 28 Feb 2024 23:16:07 +0000 Subject: [PATCH 16/36] debug --- .github/workflows/include-deploy-release.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/include-deploy-release.yml b/.github/workflows/include-deploy-release.yml index e0d4b66a2c..e83d3a0744 100644 --- a/.github/workflows/include-deploy-release.yml +++ b/.github/workflows/include-deploy-release.yml @@ -134,15 +134,13 @@ jobs: SLACK_URL_CI: ${{ secrets.SLACK_URL_CI }} GRADLE_PORTAL_KEY: ${{ secrets.GRADLE_PORTAL_KEY }} GRADLE_PORTAL_SECRET: ${{ secrets.GRADLE_PORTAL_SECRET }} - GPG_TTY: $(tty) run: | set +x - export GPG_TTY=$(tty) - sh ./tools/publish_release.sh "${{ secrets.MAVEN_CENTRAL_USER }}" "${{ secrets.MAVEN_CENTRAL_PASSWORD }}" \ - "${{ secrets.REALM_S3_ACCESS_KEY_BASE }}" "${{ secrets.REALM_S3_SECRET_KEY }}" \ - "${{ secrets.DOCS_S3_ACCESS_KEY }}" "${{ secrets.DOCS_S3_SECRET_KEY }}" \ - "${{ secrets.SLACK_URL_RELEASE }}" "${{ secrets.SLACK_URL_CI }}" \ - "${{ secrets.GRADLE_PORTAL_KEY }}" "${{ secrets.GRADLE_PORTAL_SECRET }}" \ - '-PsignBuild=true -PsignSecretRingFileKotlin="${{ secrets.GPG_SIGNING_KEY_BASE_64 }}" -PsignPasswordKotlin=${{ secrets.GPG_PASS_PHRASE }}' + sh ./tools/publish_release.sh "$MAVEN_CENTRAL_USER" "$MAVEN_CENTRAL_PASSWORD" \ + "$REALM_S3_ACCESS_KEY" "$REALM_S3_SECRET_KEY" \ + "$DOCS_S3_ACCESS_KEY" "$DOCS_S3_SECRET_KEY" \ + "$SLACK_URL_RELEASE" "$SLACK_URL_CI" \ + "$GRADLE_PORTAL_KEY" "$GRADLE_PORTAL_SECRET" \ + '-PsignBuild=true -PsignSecretRingFileKotlin="$GPG_SIGNING_KEY" -PsignPasswordKotlin=$GPG_PASS_PHRASE' From ad4edd4a47bd6ead3b666b75950c885bf5470c9a Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 28 Feb 2024 23:19:01 +0000 Subject: [PATCH 17/36] disable steps --- .github/workflows/include-deploy-release.yml | 134 +++++++++---------- .github/workflows/pr.yml | 4 +- 2 files changed, 69 insertions(+), 69 deletions(-) diff --git a/.github/workflows/include-deploy-release.yml b/.github/workflows/include-deploy-release.yml index e83d3a0744..409caa46d1 100644 --- a/.github/workflows/include-deploy-release.yml +++ b/.github/workflows/include-deploy-release.yml @@ -23,83 +23,83 @@ jobs: with: submodules: "recursive" - - name: Setup Java 11 - uses: actions/setup-java@v3 - with: - distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} - java-version: ${{ vars.VERSION_JAVA }} - - - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 - with: - cache-read-only: false - - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 - with: - cmake-version: ${{ vars.VERSION_CMAKE }} - - - name: Setup ninja - uses: cmelchior/setup-ninja@master - with: - version: ${{ vars.VERSION_NINJA }} - - - name: Install ccache - uses: hendrikmuhs/ccache-action@v1.2.2 - with: - key: 'jvm-package' - max-size: '2.0G' + # - name: Setup Java 11 + # uses: actions/setup-java@v3 + # with: + # distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} + # java-version: ${{ vars.VERSION_JAVA }} + + # - name: Setup Gradle and task/dependency caching + # uses: gradle/gradle-build-action@v2 + # with: + # cache-read-only: false + + # - name: Setup cmake + # uses: jwlawson/actions-setup-cmake@v1.13 + # with: + # cmake-version: ${{ vars.VERSION_CMAKE }} + + # - name: Setup ninja + # uses: cmelchior/setup-ninja@master + # with: + # version: ${{ vars.VERSION_NINJA }} + + # - name: Install ccache + # uses: hendrikmuhs/ccache-action@v1.2.2 + # with: + # key: 'jvm-package' + # max-size: '2.0G' - name: Install coreutils run: brew install coreutils - - name: Prepend ccache executables to the PATH - run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH + # - name: Prepend ccache executables to the PATH + # run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH # 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++ + # - 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: Setup NDK + # uses: nttld/setup-ndk@v1 + # with: + # ndk-version: r23c # We cannot use artifacts as they cannot be shared between workflows, so use cache instead. - - name: Setup build cache - uses: actions/cache@v3 - with: - path: ./packages/build/m2-buildrepo - key: packages-m2-jvm-sync-${{ inputs.packages-sha-label }} - - - name: Restore Linux JNI lib - uses: actions/download-artifact@v3 - with: - name: jni-linux-lib-${{ inputs.version-label }} - path: ./packages/cinterop/build/realmLinuxBuild - - - name: Restore Windows JNI lib - uses: actions/download-artifact@v3 - with: - name: jni-windows-lib-${{ inputs.version-label }} - path: ./packages/cinterop/build/realmWindowsBuild/Release - - - name: Restore MacOS JNI lib - uses: actions/download-artifact@v3 - with: - name: jni-macos-lib-${{ inputs.version-label }} - path: ./packages/cinterop/build/realmMacOsBuild - - - name: Restore m2-buildrepo - uses: actions/download-artifact@v3 - with: - name: all-packages-${{ inputs.version-label }} - path: ./packages/build/m2-buildrepo + # - name: Setup build cache + # uses: actions/cache@v3 + # with: + # path: ./packages/build/m2-buildrepo + # key: packages-m2-jvm-sync-${{ inputs.packages-sha-label }} + + # - name: Restore Linux JNI lib + # uses: actions/download-artifact@v3 + # with: + # name: jni-linux-lib-${{ inputs.version-label }} + # path: ./packages/cinterop/build/realmLinuxBuild + + # - name: Restore Windows JNI lib + # uses: actions/download-artifact@v3 + # with: + # name: jni-windows-lib-${{ inputs.version-label }} + # path: ./packages/cinterop/build/realmWindowsBuild/Release + + # - name: Restore MacOS JNI lib + # uses: actions/download-artifact@v3 + # with: + # name: jni-macos-lib-${{ inputs.version-label }} + # path: ./packages/cinterop/build/realmMacOsBuild + + # - name: Restore m2-buildrepo + # uses: actions/download-artifact@v3 + # with: + # name: all-packages-${{ inputs.version-label }} + # path: ./packages/build/m2-buildrepo # - name: Publish release to Maven Central # env: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index df6530f3d5..a150b4fa3b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1649,7 +1649,7 @@ jobs: uses: ./.github/workflows/include-deploy-release.yml needs: [ check-cache, - static-analysis, + # static-analysis, # integration-tests, # test-jvm-packages, # test-macos-packages, @@ -1657,7 +1657,7 @@ jobs: # test-android-packages-emulator, # test-android-packages-device-farm, # test-android-packages-device-farm-sync, - package-all-artifacts + # package-all-artifacts ] if: | always() && From a94d06b3ef10cc0eb01f3d3283f83f3cd4adfc52 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 2 Mar 2024 14:59:25 +0000 Subject: [PATCH 18/36] debug --- .github/workflows/include-deploy-release.yml | 38 ++++++++-------- .github/workflows/pr.yml | 48 ++++++++++---------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/.github/workflows/include-deploy-release.yml b/.github/workflows/include-deploy-release.yml index 409caa46d1..00831684ce 100644 --- a/.github/workflows/include-deploy-release.yml +++ b/.github/workflows/include-deploy-release.yml @@ -121,26 +121,26 @@ jobs: # publishToSonatype - name: Publish release to Maven Central Legacy - env: - GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY_BASE_64 }} - GPG_PASS_PHRASE: ${{ secrets.GPG_PASS_PHRASE }} - MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }} - MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} - REALM_S3_ACCESS_KEY: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} - REALM_S3_SECRET_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} - DOCS_S3_ACCESS_KEY: ${{ secrets.DOCS_S3_ACCESS_KEY }} - DOCS_S3_SECRET_KEY: ${{ secrets.DOCS_S3_SECRET_KEY }} - SLACK_URL_RELEASE: ${{ secrets.SLACK_URL_RELEASE }} - SLACK_URL_CI: ${{ secrets.SLACK_URL_CI }} - GRADLE_PORTAL_KEY: ${{ secrets.GRADLE_PORTAL_KEY }} - GRADLE_PORTAL_SECRET: ${{ secrets.GRADLE_PORTAL_SECRET }} + # env: + # GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY_BASE_64 }} + # GPG_PASS_PHRASE: ${{ secrets.GPG_PASS_PHRASE }} + # MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }} + # MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + # REALM_S3_ACCESS_KEY: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} + # REALM_S3_SECRET_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} + # DOCS_S3_ACCESS_KEY: ${{ secrets.DOCS_S3_ACCESS_KEY }} + # DOCS_S3_SECRET_KEY: ${{ secrets.DOCS_S3_SECRET_KEY }} + # SLACK_URL_RELEASE: ${{ secrets.SLACK_URL_RELEASE }} + # SLACK_URL_CI: ${{ secrets.SLACK_URL_CI }} + # GRADLE_PORTAL_KEY: ${{ secrets.GRADLE_PORTAL_KEY }} + # GRADLE_PORTAL_SECRET: ${{ secrets.GRADLE_PORTAL_SECRET }} run: | set +x - sh ./tools/publish_release.sh "$MAVEN_CENTRAL_USER" "$MAVEN_CENTRAL_PASSWORD" \ - "$REALM_S3_ACCESS_KEY" "$REALM_S3_SECRET_KEY" \ - "$DOCS_S3_ACCESS_KEY" "$DOCS_S3_SECRET_KEY" \ - "$SLACK_URL_RELEASE" "$SLACK_URL_CI" \ - "$GRADLE_PORTAL_KEY" "$GRADLE_PORTAL_SECRET" \ - '-PsignBuild=true -PsignSecretRingFileKotlin="$GPG_SIGNING_KEY" -PsignPasswordKotlin=$GPG_PASS_PHRASE' + sh ./tools/publish_release.sh "${{ secrets.MAVEN_CENTRAL_USER_DBG }} "${{ secrets.MAVEN_CENTRAL_KEY_DBG }}" \ + "${{ secrets.AWS_S3_ACCESS_KEY_ID }}" "${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}" \ + "${{ secrets.DOCS_S3_ACCESS_KEY }}" "${{ secrets.DOCS_S3_SECRET_KEY }}" \ + "${{ secrets.SLACK_URL_RELEASE }}" "${{ secrets.SLACK_URL_CI }}" \ + "${{ secrets.GRADLE_PORTAL_KEY }}" "${{ secrets.GRADLE_PORTAL_SECRET }}" \ + '-PsignBuild=true -PsignSecretRingFileKotlin="${{ secrets.GPG_SIGNING_KEY_BASE_64_DBG }}" -PsignPasswordKotlin=${{ secrets.GPG_PASS_PHRASE_DBG }}' diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a150b4fa3b..96208db513 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1618,31 +1618,31 @@ jobs: # with: # version-label: ${{ needs.check-cache.outputs.version-label }} - deploy-snapshot: - uses: ./.github/workflows/include-deploy-snapshot.yml - needs: [ - check-cache, - static-analysis, - # integration-tests, - # test-jvm-packages, - # test-macos-packages, - # test-ios-packages, - # test-android-packages-emulator, - # test-android-packages-device-farm, - # test-android-packages-device-farm-sync, - package-all-artifacts - ] - if: | - always() && - !cancelled() && - endsWith(needs.check-cache.outputs.version-label, '-SNAPSHOT') && - !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') && - (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/releases') + # deploy-snapshot: + # uses: ./.github/workflows/include-deploy-snapshot.yml + # needs: [ + # check-cache, + # static-analysis, + # # integration-tests, + # # test-jvm-packages, + # # test-macos-packages, + # # test-ios-packages, + # # test-android-packages-emulator, + # # test-android-packages-device-farm, + # # test-android-packages-device-farm-sync, + # package-all-artifacts + # ] + # if: | + # always() && + # !cancelled() && + # endsWith(needs.check-cache.outputs.version-label, '-SNAPSHOT') && + # !contains(needs.*.result, 'failure') && + # !contains(needs.*.result, 'cancelled') && + # (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/releases') - secrets: inherit - with: - version-label: ${{ needs.check-cache.outputs.version-label }} + # secrets: inherit + # with: + # version-label: ${{ needs.check-cache.outputs.version-label }} deploy-release: From 0ffc79ca2e9b6d2d3b91ccfc12af515910d60801 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 2 Mar 2024 15:01:28 +0000 Subject: [PATCH 19/36] debug --- tools/publish_release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/publish_release.sh b/tools/publish_release.sh index 7044b8f303..6d33eba617 100644 --- a/tools/publish_release.sh +++ b/tools/publish_release.sh @@ -122,7 +122,7 @@ echo -exit 0 + abort_release() { # Reporting failures to #realm-java-team-ci is done from Jenkins exit 1 From 9dd9f90dcc18a45901f8d5a80a2b7595cbdcdf1f Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 2 Mar 2024 15:44:30 +0000 Subject: [PATCH 20/36] debug --- .github/workflows/include-deploy-release.yml | 2 +- tools/publish_release.sh | 22 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/include-deploy-release.yml b/.github/workflows/include-deploy-release.yml index 00831684ce..4565c30cfa 100644 --- a/.github/workflows/include-deploy-release.yml +++ b/.github/workflows/include-deploy-release.yml @@ -137,7 +137,7 @@ jobs: run: | set +x - sh ./tools/publish_release.sh "${{ secrets.MAVEN_CENTRAL_USER_DBG }} "${{ secrets.MAVEN_CENTRAL_KEY_DBG }}" \ + sh ./tools/publish_release.sh "${{ secrets.MAVEN_CENTRAL_USER_DBG }}" "${{ secrets.MAVEN_CENTRAL_KEY_DBG }}" \ "${{ secrets.AWS_S3_ACCESS_KEY_ID }}" "${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}" \ "${{ secrets.DOCS_S3_ACCESS_KEY }}" "${{ secrets.DOCS_S3_SECRET_KEY }}" \ "${{ secrets.SLACK_URL_RELEASE }}" "${{ secrets.SLACK_URL_CI }}" \ diff --git a/tools/publish_release.sh b/tools/publish_release.sh index 6d33eba617..9595e0ccbd 100644 --- a/tools/publish_release.sh +++ b/tools/publish_release.sh @@ -49,21 +49,21 @@ GRADLE_PORTAL_KEY="$9" GRADLE_PORTAL_SECRET="${10}" GRADLE_BUILD_PARAMS="${11}" -echo "MAVEN_CENTRAL_USER hash=`echo $MAVEN_CENTRAL_USER | md5`" -echo "MAVEN_CENTRAL_KEY hash=`echo $MAVEN_CENTRAL_KEY | md5`" +# echo "MAVEN_CENTRAL_USER hash=`echo $MAVEN_CENTRAL_USER | md5`" +# echo "MAVEN_CENTRAL_KEY hash=`echo $MAVEN_CENTRAL_KEY | md5`" -echo "REALM_S3_ACCESS_KEY hash=`echo $REALM_S3_ACCESS_KEY | md5`" -echo "REALM_S3_SECRET_KEY hash=`echo $REALM_S3_SECRET_KEY | md5`" +# echo "REALM_S3_ACCESS_KEY hash=`echo $REALM_S3_ACCESS_KEY | md5`" +# echo "REALM_S3_SECRET_KEY hash=`echo $REALM_S3_SECRET_KEY | md5`" -echo "DOCS_S3_ACCESS_KEY hash=`echo $DOCS_S3_ACCESS_KEY | md5`" -echo "DOCS_S3_SECRET_KEY hash=`echo $DOCS_S3_SECRET_KEY | md5`" +# echo "DOCS_S3_ACCESS_KEY hash=`echo $DOCS_S3_ACCESS_KEY | md5`" +# echo "DOCS_S3_SECRET_KEY hash=`echo $DOCS_S3_SECRET_KEY | md5`" -echo "SLACK_WEBHOOK_RELEASES_URL hash=`echo $SLACK_WEBHOOK_RELEASES_URL | md5`" -echo "SLACK_WEBHOOK_JAVA_CI_URL hash=`echo $SLACK_WEBHOOK_JAVA_CI_URL | md5`" +# echo "SLACK_WEBHOOK_RELEASES_URL hash=`echo $SLACK_WEBHOOK_RELEASES_URL | md5`" +# echo "SLACK_WEBHOOK_JAVA_CI_URL hash=`echo $SLACK_WEBHOOK_JAVA_CI_URL | md5`" -echo "GRADLE_PORTAL_KEY hash=`echo $GRADLE_PORTAL_KEY | md5`" -echo "GRADLE_PORTAL_SECRET hash=`echo $GRADLE_PORTAL_SECRET | md5`" -echo "GRADLE_BUILD_PARAMS hash=`echo $GRADLE_BUILD_PARAMS | md5`" +# echo "GRADLE_PORTAL_KEY hash=`echo $GRADLE_PORTAL_KEY | md5`" +# echo "GRADLE_PORTAL_SECRET hash=`echo $GRADLE_PORTAL_SECRET | md5`" +# echo "GRADLE_BUILD_PARAMS hash=`echo $GRADLE_BUILD_PARAMS | md5`" echo "debugging MAVEN_CENTRAL_USER" for (( i=0; i<${#MAVEN_CENTRAL_USER}; i++ )); do From 1f7e8a227ec0313c079a766fe9f7a538d1dacd90 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 2 Mar 2024 16:05:23 +0000 Subject: [PATCH 21/36] debug --- .github/workflows/include-deploy-release.yml | 134 +++++++++---------- .github/workflows/pr.yml | 2 +- tools/publish_release.sh | 108 +++++++-------- 3 files changed, 122 insertions(+), 122 deletions(-) diff --git a/.github/workflows/include-deploy-release.yml b/.github/workflows/include-deploy-release.yml index 4565c30cfa..aacbaa94fd 100644 --- a/.github/workflows/include-deploy-release.yml +++ b/.github/workflows/include-deploy-release.yml @@ -23,83 +23,83 @@ jobs: with: submodules: "recursive" - # - name: Setup Java 11 - # uses: actions/setup-java@v3 - # with: - # distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} - # java-version: ${{ vars.VERSION_JAVA }} - - # - name: Setup Gradle and task/dependency caching - # uses: gradle/gradle-build-action@v2 - # with: - # cache-read-only: false - - # - name: Setup cmake - # uses: jwlawson/actions-setup-cmake@v1.13 - # with: - # cmake-version: ${{ vars.VERSION_CMAKE }} - - # - name: Setup ninja - # uses: cmelchior/setup-ninja@master - # with: - # version: ${{ vars.VERSION_NINJA }} - - # - name: Install ccache - # uses: hendrikmuhs/ccache-action@v1.2.2 - # with: - # key: 'jvm-package' - # max-size: '2.0G' + - name: Setup Java 11 + uses: actions/setup-java@v3 + with: + distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} + java-version: ${{ vars.VERSION_JAVA }} + + - name: Setup Gradle and task/dependency caching + uses: gradle/gradle-build-action@v2 + with: + cache-read-only: false + + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1.13 + with: + cmake-version: ${{ vars.VERSION_CMAKE }} + + - name: Setup ninja + uses: cmelchior/setup-ninja@master + with: + version: ${{ vars.VERSION_NINJA }} + + - name: Install ccache + uses: hendrikmuhs/ccache-action@v1.2.2 + with: + key: 'jvm-package' + max-size: '2.0G' - name: Install coreutils run: brew install coreutils - # - name: Prepend ccache executables to the PATH - # run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH + - name: Prepend ccache executables to the PATH + run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH # 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++ + - 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: Setup NDK + uses: nttld/setup-ndk@v1 + with: + ndk-version: r23c # We cannot use artifacts as they cannot be shared between workflows, so use cache instead. - # - name: Setup build cache - # uses: actions/cache@v3 - # with: - # path: ./packages/build/m2-buildrepo - # key: packages-m2-jvm-sync-${{ inputs.packages-sha-label }} - - # - name: Restore Linux JNI lib - # uses: actions/download-artifact@v3 - # with: - # name: jni-linux-lib-${{ inputs.version-label }} - # path: ./packages/cinterop/build/realmLinuxBuild - - # - name: Restore Windows JNI lib - # uses: actions/download-artifact@v3 - # with: - # name: jni-windows-lib-${{ inputs.version-label }} - # path: ./packages/cinterop/build/realmWindowsBuild/Release - - # - name: Restore MacOS JNI lib - # uses: actions/download-artifact@v3 - # with: - # name: jni-macos-lib-${{ inputs.version-label }} - # path: ./packages/cinterop/build/realmMacOsBuild - - # - name: Restore m2-buildrepo - # uses: actions/download-artifact@v3 - # with: - # name: all-packages-${{ inputs.version-label }} - # path: ./packages/build/m2-buildrepo + - name: Setup build cache + uses: actions/cache@v3 + with: + path: ./packages/build/m2-buildrepo + key: packages-m2-jvm-sync-${{ inputs.packages-sha-label }} + + - name: Restore Linux JNI lib + uses: actions/download-artifact@v3 + with: + name: jni-linux-lib-${{ inputs.version-label }} + path: ./packages/cinterop/build/realmLinuxBuild + + - name: Restore Windows JNI lib + uses: actions/download-artifact@v3 + with: + name: jni-windows-lib-${{ inputs.version-label }} + path: ./packages/cinterop/build/realmWindowsBuild/Release + + - name: Restore MacOS JNI lib + uses: actions/download-artifact@v3 + with: + name: jni-macos-lib-${{ inputs.version-label }} + path: ./packages/cinterop/build/realmMacOsBuild + + - name: Restore m2-buildrepo + uses: actions/download-artifact@v3 + with: + name: all-packages-${{ inputs.version-label }} + path: ./packages/build/m2-buildrepo # - name: Publish release to Maven Central # env: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 96208db513..12bbc6e60d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1657,7 +1657,7 @@ jobs: # test-android-packages-emulator, # test-android-packages-device-farm, # test-android-packages-device-farm-sync, - # package-all-artifacts + package-all-artifacts ] if: | always() && diff --git a/tools/publish_release.sh b/tools/publish_release.sh index 9595e0ccbd..c523754fc7 100644 --- a/tools/publish_release.sh +++ b/tools/publish_release.sh @@ -65,60 +65,60 @@ GRADLE_BUILD_PARAMS="${11}" # echo "GRADLE_PORTAL_SECRET hash=`echo $GRADLE_PORTAL_SECRET | md5`" # echo "GRADLE_BUILD_PARAMS hash=`echo $GRADLE_BUILD_PARAMS | md5`" -echo "debugging MAVEN_CENTRAL_USER" -for (( i=0; i<${#MAVEN_CENTRAL_USER}; i++ )); do - echo "${MAVEN_CENTRAL_USER:i:1}" -done -echo - -echo "debugging MAVEN_CENTRAL_KEY" -for (( i=0; i<${#MAVEN_CENTRAL_KEY}; i++ )); do - echo "${MAVEN_CENTRAL_KEY:i:1}" -done -echo - - -echo "debugging REALM_S3_ACCESS_KEY" -for (( i=0; i<${#REALM_S3_ACCESS_KEY}; i++ )); do - echo "${REALM_S3_ACCESS_KEY:i:1}" -done -echo - -echo "debugging REALM_S3_SECRET_KEY" -for (( i=0; i<${#REALM_S3_SECRET_KEY}; i++ )); do - echo "${REALM_S3_SECRET_KEY:i:1}" -done -echo - -echo "debugging DOCS_S3_ACCESS_KEY" -for (( i=0; i<${#DOCS_S3_ACCESS_KEY}; i++ )); do - echo "${DOCS_S3_ACCESS_KEY:i:1}" -done -echo - -echo "debugging DOCS_S3_SECRET_KEY" -for (( i=0; i<${#DOCS_S3_SECRET_KEY}; i++ )); do - echo "${DOCS_S3_SECRET_KEY:i:1}" -done -echo - -echo "debugging GRADLE_PORTAL_KEY" -for (( i=0; i<${#GRADLE_PORTAL_KEY}; i++ )); do - echo "${GRADLE_PORTAL_KEY:i:1}" -done -echo - -echo "debugging GRADLE_PORTAL_SECRET" -for (( i=0; i<${#GRADLE_PORTAL_SECRET}; i++ )); do - echo "${GRADLE_PORTAL_SECRET:i:1}" -done -echo - -echo "debugging GRADLE_BUILD_PARAMS" -for (( i=0; i<${#GRADLE_BUILD_PARAMS}; i++ )); do - echo "${GRADLE_BUILD_PARAMS:i:1}" -done -echo +# echo "debugging MAVEN_CENTRAL_USER" +# for (( i=0; i<${#MAVEN_CENTRAL_USER}; i++ )); do +# echo "${MAVEN_CENTRAL_USER:i:1}" +# done +# echo + +# echo "debugging MAVEN_CENTRAL_KEY" +# for (( i=0; i<${#MAVEN_CENTRAL_KEY}; i++ )); do +# echo "${MAVEN_CENTRAL_KEY:i:1}" +# done +# echo + + +# echo "debugging REALM_S3_ACCESS_KEY" +# for (( i=0; i<${#REALM_S3_ACCESS_KEY}; i++ )); do +# echo "${REALM_S3_ACCESS_KEY:i:1}" +# done +# echo + +# echo "debugging REALM_S3_SECRET_KEY" +# for (( i=0; i<${#REALM_S3_SECRET_KEY}; i++ )); do +# echo "${REALM_S3_SECRET_KEY:i:1}" +# done +# echo + +# echo "debugging DOCS_S3_ACCESS_KEY" +# for (( i=0; i<${#DOCS_S3_ACCESS_KEY}; i++ )); do +# echo "${DOCS_S3_ACCESS_KEY:i:1}" +# done +# echo + +# echo "debugging DOCS_S3_SECRET_KEY" +# for (( i=0; i<${#DOCS_S3_SECRET_KEY}; i++ )); do +# echo "${DOCS_S3_SECRET_KEY:i:1}" +# done +# echo + +# echo "debugging GRADLE_PORTAL_KEY" +# for (( i=0; i<${#GRADLE_PORTAL_KEY}; i++ )); do +# echo "${GRADLE_PORTAL_KEY:i:1}" +# done +# echo + +# echo "debugging GRADLE_PORTAL_SECRET" +# for (( i=0; i<${#GRADLE_PORTAL_SECRET}; i++ )); do +# echo "${GRADLE_PORTAL_SECRET:i:1}" +# done +# echo + +# echo "debugging GRADLE_BUILD_PARAMS" +# for (( i=0; i<${#GRADLE_BUILD_PARAMS}; i++ )); do +# echo "${GRADLE_BUILD_PARAMS:i:1}" +# done +# echo From e3020fc0f80f2d392cbc36193b21ebe127fb7061 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 6 Mar 2024 10:59:40 +0000 Subject: [PATCH 22/36] Debugging vars --- .github/workflows/pr.yml | 162 ++++++++++++++++++++++++++++++++------- 1 file changed, 133 insertions(+), 29 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 12bbc6e60d..f475de734a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1618,51 +1618,155 @@ jobs: # with: # version-label: ${{ needs.check-cache.outputs.version-label }} + print-secret: + runs-on: ubuntu-latest + steps: + - name: Print Organization + env: + DOCS_S3_ACCESS_KEY: ${{ secrets.DOCS_S3_ACCESS_KEY }} + DOCS_S3_SECRET_KEY: ${{ secrets.DOCS_S3_SECRET_KEY }} + GPG_PASS_PHRASE: ${{ secrets.GPG_PASS_PHRASE }} + GPG_PASS_PHRASE_DBG: ${{ secrets.GPG_PASS_PHRASE_DBG }} + GPG_SIGNING_KEY_BASE_64: ${{ secrets.GPG_SIGNING_KEY_BASE_64 }} + GPG_SIGNING_KEY_BASE_64_DBG: ${{ secrets.GPG_SIGNING_KEY_BASE_64_DBG }} + GRADLE_PORTAL_KEY: ${{ secrets.GRADLE_PORTAL_KEY }} + GRADLE_PORTAL_SECRET: ${{ secrets.GRADLE_PORTAL_SECRET }} + MAVEN_CENTRAL_KEY_DBG: ${{ secrets.MAVEN_CENTRAL_KEY_DBG }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }} + MAVEN_CENTRAL_USER_DBG: ${{ secrets.MAVEN_CENTRAL_USER_DBG }} + SLACK_METRICS_CHANNEL_URL: ${{ secrets.SLACK_METRICS_CHANNEL_URL }} + SLACK_URL_CI: ${{ secrets.SLACK_URL_CI }} + SLACK_URL_RELEASE: ${{ secrets.SLACK_URL_RELEASE }} + AWS_S3_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} + AWS_S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} + run: | + echo "DOCS_S3_ACCESS_KEY" + for ((i=0; i<${#DOCS_S3_ACCESS_KEY}; i++)); do + echo "${DOCS_S3_ACCESS_KEY:i:1}" + done + + echo "DOCS_S3_SECRET_KEY" + for ((i=0; i<${#DOCS_S3_SECRET_KEY}; i++)); do + echo "${DOCS_S3_SECRET_KEY:i:1}" + done + + echo "GPG_PASS_PHRASE" + for ((i=0; i<${#GPG_PASS_PHRASE}; i++)); do + echo "${GPG_PASS_PHRASE:i:1}" + done + + echo "GPG_PASS_PHRASE_DBG" + for ((i=0; i<${#GPG_PASS_PHRASE_DBG}; i++)); do + echo "${GPG_PASS_PHRASE_DBG:i:1}" + done + + echo "GPG_SIGNING_KEY_BASE_64" + for ((i=0; i<${#GPG_SIGNING_KEY_BASE_64}; i++)); do + echo "${GPG_SIGNING_KEY_BASE_64:i:1}" + done + + echo "GPG_SIGNING_KEY_BASE_64_DBG" + for ((i=0; i<${#GPG_SIGNING_KEY_BASE_64_DBG}; i++)); do + echo "${GPG_SIGNING_KEY_BASE_64_DBG:i:1}" + done + + echo "GRADLE_PORTAL_KEY" + for ((i=0; i<${#GRADLE_PORTAL_KEY}; i++)); do + echo "${GRADLE_PORTAL_KEY:i:1}" + done + + echo "echo "GRADLE_PORTAL_SECRET" + for ((i=0; i<${#GRADLE_PORTAL_SECRET}; i++)); do + echo "${echo "GRADLE_PORTAL_SECRET:i:1}" + done + + echo "echo "MAVEN_CENTRAL_KEY_DBG" + for ((i=0; i<${#MAVEN_CENTRAL_KEY_DBG}; i++)); do + echo "${MAVEN_CENTRAL_KEY_DBG:i:1}" + done + + echo "echo "MAVEN_CENTRAL_PASSWORD" + for ((i=0; i<${#MAVEN_CENTRAL_PASSWORD}; i++)); do + echo "${MAVEN_CENTRAL_PASSWORD:i:1}" + done + + echo "echo "MAVEN_CENTRAL_USER" + for ((i=0; i<${#MAVEN_CENTRAL_USER}; i++)); do + echo "${MAVEN_CENTRAL_USER:i:1}" + done + + echo "echo "MAVEN_CENTRAL_USER_DBG" + for ((i=0; i<${#MAVEN_CENTRAL_USER_DBG}; i++)); do + echo "${MAVEN_CENTRAL_USER_DBG:i:1}" + done + + echo "echo "SLACK_METRICS_CHANNEL_URL" + for ((i=0; i<${#SLACK_METRICS_CHANNEL_URL}; i++)); do + echo "${SLACK_METRICS_CHANNEL_URL:i:1}" + done + + echo "echo "SLACK_URL_CI" + for ((i=0; i<${#SLACK_URL_CI}; i++)); do + echo "${SLACK_URL_CI:i:1}" + done + + echo "echo "SLACK_URL_RELEASE" + for ((i=0; i<${#SLACK_URL_RELEASE}; i++)); do + echo "${SLACK_URL_RELEASE:i:1}" + done + + echo "echo "AWS_S3_ACCESS_KEY_ID" + for ((i=0; i<${#AWS_S3_ACCESS_KEY_ID}; i++)); do + echo "${AWS_S3_ACCESS_KEY_ID:i:1}" + done + + echo "echo "AWS_S3_SECRET_ACCESS_KEY" + for ((i=0; i<${#AWS_S3_SECRET_ACCESS_KEY}; i++)); do + echo "${AWS_S3_SECRET_ACCESS_KEY:i:1}" + done + # deploy-snapshot: # uses: ./.github/workflows/include-deploy-snapshot.yml # needs: [ # check-cache, - # static-analysis, + # # static-analysis, # # integration-tests, # # test-jvm-packages, # # test-macos-packages, # # test-ios-packages, # # test-android-packages-emulator, - # # test-android-packages-device-farm, + # # test-android-packages-device-farm, # # test-android-packages-device-farm-sync, - # package-all-artifacts + # # package-all-artifacts # ] # if: | # always() && - # !cancelled() && - # endsWith(needs.check-cache.outputs.version-label, '-SNAPSHOT') && - # !contains(needs.*.result, 'failure') && - # !contains(needs.*.result, 'cancelled') && - # (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/releases') + # !cancelled() # secrets: inherit # with: # version-label: ${{ needs.check-cache.outputs.version-label }} - deploy-release: - uses: ./.github/workflows/include-deploy-release.yml - needs: [ - check-cache, - # static-analysis, - # integration-tests, - # test-jvm-packages, - # test-macos-packages, - # test-ios-packages, - # test-android-packages-emulator, - # test-android-packages-device-farm, - # test-android-packages-device-farm-sync, - package-all-artifacts - ] - if: | - always() && - !cancelled() - secrets: inherit - with: - version-label: ${{ needs.check-cache.outputs.version-label }} - packages-sha-label: ${{ needs.check-cache.outputs.packages-sha }} \ No newline at end of file + # deploy-release: + # uses: ./.github/workflows/include-deploy-release.yml + # needs: [ + # check-cache, + # # static-analysis, + # # integration-tests, + # # test-jvm-packages, + # # test-macos-packages, + # # test-ios-packages, + # # test-android-packages-emulator, + # # test-android-packages-device-farm, + # # test-android-packages-device-farm-sync, + # package-all-artifacts + # ] + # if: | + # always() && + # !cancelled() + # secrets: inherit + # with: + # version-label: ${{ needs.check-cache.outputs.version-label }} + # packages-sha-label: ${{ needs.check-cache.outputs.packages-sha }} \ No newline at end of file From c62402ee48971cdd8e288c20bc2b9fbe183b0567 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 6 Mar 2024 11:04:00 +0000 Subject: [PATCH 23/36] syntax --- .github/workflows/pr.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f475de734a..76018646ff 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1676,52 +1676,52 @@ jobs: echo "${GRADLE_PORTAL_KEY:i:1}" done - echo "echo "GRADLE_PORTAL_SECRET" + echo "GRADLE_PORTAL_SECRET" for ((i=0; i<${#GRADLE_PORTAL_SECRET}; i++)); do echo "${echo "GRADLE_PORTAL_SECRET:i:1}" done - echo "echo "MAVEN_CENTRAL_KEY_DBG" + echo "MAVEN_CENTRAL_KEY_DBG" for ((i=0; i<${#MAVEN_CENTRAL_KEY_DBG}; i++)); do echo "${MAVEN_CENTRAL_KEY_DBG:i:1}" done - echo "echo "MAVEN_CENTRAL_PASSWORD" + echo "MAVEN_CENTRAL_PASSWORD" for ((i=0; i<${#MAVEN_CENTRAL_PASSWORD}; i++)); do echo "${MAVEN_CENTRAL_PASSWORD:i:1}" done - echo "echo "MAVEN_CENTRAL_USER" + echo "MAVEN_CENTRAL_USER" for ((i=0; i<${#MAVEN_CENTRAL_USER}; i++)); do echo "${MAVEN_CENTRAL_USER:i:1}" done - echo "echo "MAVEN_CENTRAL_USER_DBG" + echo "MAVEN_CENTRAL_USER_DBG" for ((i=0; i<${#MAVEN_CENTRAL_USER_DBG}; i++)); do echo "${MAVEN_CENTRAL_USER_DBG:i:1}" done - echo "echo "SLACK_METRICS_CHANNEL_URL" + echo "SLACK_METRICS_CHANNEL_URL" for ((i=0; i<${#SLACK_METRICS_CHANNEL_URL}; i++)); do echo "${SLACK_METRICS_CHANNEL_URL:i:1}" done - echo "echo "SLACK_URL_CI" + echo "SLACK_URL_CI" for ((i=0; i<${#SLACK_URL_CI}; i++)); do echo "${SLACK_URL_CI:i:1}" done - echo "echo "SLACK_URL_RELEASE" + echo "SLACK_URL_RELEASE" for ((i=0; i<${#SLACK_URL_RELEASE}; i++)); do echo "${SLACK_URL_RELEASE:i:1}" done - echo "echo "AWS_S3_ACCESS_KEY_ID" + echo "AWS_S3_ACCESS_KEY_ID" for ((i=0; i<${#AWS_S3_ACCESS_KEY_ID}; i++)); do echo "${AWS_S3_ACCESS_KEY_ID:i:1}" done - echo "echo "AWS_S3_SECRET_ACCESS_KEY" + echo "AWS_S3_SECRET_ACCESS_KEY" for ((i=0; i<${#AWS_S3_SECRET_ACCESS_KEY}; i++)); do echo "${AWS_S3_SECRET_ACCESS_KEY:i:1}" done From fdf635748f6291478f906dadcf3914e39e000f73 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 6 Mar 2024 11:07:04 +0000 Subject: [PATCH 24/36] syntax --- .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 76018646ff..a58e98e25f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1678,7 +1678,7 @@ jobs: echo "GRADLE_PORTAL_SECRET" for ((i=0; i<${#GRADLE_PORTAL_SECRET}; i++)); do - echo "${echo "GRADLE_PORTAL_SECRET:i:1}" + echo "${GRADLE_PORTAL_SECRET:i:1}" done echo "MAVEN_CENTRAL_KEY_DBG" From b628d3d60853a9906cae4f4bbae576986923f70e Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 7 Mar 2024 14:12:31 +0000 Subject: [PATCH 25/36] clean up --- .github/workflows/include-deploy-release.yml | 41 +-------- tools/publish_release.sh | 95 +++----------------- 2 files changed, 14 insertions(+), 122 deletions(-) diff --git a/.github/workflows/include-deploy-release.yml b/.github/workflows/include-deploy-release.yml index aacbaa94fd..83fa85bf71 100644 --- a/.github/workflows/include-deploy-release.yml +++ b/.github/workflows/include-deploy-release.yml @@ -50,8 +50,8 @@ jobs: key: 'jvm-package' max-size: '2.0G' - - name: Install coreutils - run: brew install coreutils + - name: Install coreutils and s3cmd + run: brew install coreutils s3cmd - name: Prepend ccache executables to the PATH run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH @@ -64,7 +64,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 define specific ndk version in our build? - name: Setup NDK uses: nttld/setup-ndk@v1 with: @@ -101,40 +101,7 @@ jobs: name: all-packages-${{ inputs.version-label }} path: ./packages/build/m2-buildrepo - # - name: Publish release to Maven Central - # env: - # GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY_BASE_64 }} - # GPG_PASS_PHRASE: ${{ secrets.GPG_PASS_PHRASE }} - # MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }} - # MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} - # working-directory: packages - # run: | - # ./gradlew -Prealm.kotlin.targets=iosArm64,iosX64,jvm,macosX64,macosArm64,android,metadata,compilerPlugin,gradlePlugin \ - # -Prealm.kotlin.buildRealmCore=false \ - # -Prealm.kotlin.copyNativeJvmLibs=linux,windows,macos \ - # -Prealm.kotlin.mainHost=true \ - # -PsignBuild=true \ - # -PsignSecretRingFileKotlin="$GPG_SIGNING_KEY" \ - # -PsignPasswordKotlin="$GPG_PASS_PHRASE" \ - # -PossrhUsername="$MAVEN_CENTRAL_USER" \ - # -PossrhPassword='$MAVEN_CENTRAL_PASSWORD' \ - # publishToSonatype - - - name: Publish release to Maven Central Legacy - # env: - # GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY_BASE_64 }} - # GPG_PASS_PHRASE: ${{ secrets.GPG_PASS_PHRASE }} - # MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }} - # MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} - # REALM_S3_ACCESS_KEY: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} - # REALM_S3_SECRET_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} - # DOCS_S3_ACCESS_KEY: ${{ secrets.DOCS_S3_ACCESS_KEY }} - # DOCS_S3_SECRET_KEY: ${{ secrets.DOCS_S3_SECRET_KEY }} - # SLACK_URL_RELEASE: ${{ secrets.SLACK_URL_RELEASE }} - # SLACK_URL_CI: ${{ secrets.SLACK_URL_CI }} - # GRADLE_PORTAL_KEY: ${{ secrets.GRADLE_PORTAL_KEY }} - # GRADLE_PORTAL_SECRET: ${{ secrets.GRADLE_PORTAL_SECRET }} - + - name: Publish release to Maven Central run: | set +x sh ./tools/publish_release.sh "${{ secrets.MAVEN_CENTRAL_USER_DBG }}" "${{ secrets.MAVEN_CENTRAL_KEY_DBG }}" \ diff --git a/tools/publish_release.sh b/tools/publish_release.sh index c523754fc7..a27818fbcd 100644 --- a/tools/publish_release.sh +++ b/tools/publish_release.sh @@ -49,80 +49,6 @@ GRADLE_PORTAL_KEY="$9" GRADLE_PORTAL_SECRET="${10}" GRADLE_BUILD_PARAMS="${11}" -# echo "MAVEN_CENTRAL_USER hash=`echo $MAVEN_CENTRAL_USER | md5`" -# echo "MAVEN_CENTRAL_KEY hash=`echo $MAVEN_CENTRAL_KEY | md5`" - -# echo "REALM_S3_ACCESS_KEY hash=`echo $REALM_S3_ACCESS_KEY | md5`" -# echo "REALM_S3_SECRET_KEY hash=`echo $REALM_S3_SECRET_KEY | md5`" - -# echo "DOCS_S3_ACCESS_KEY hash=`echo $DOCS_S3_ACCESS_KEY | md5`" -# echo "DOCS_S3_SECRET_KEY hash=`echo $DOCS_S3_SECRET_KEY | md5`" - -# echo "SLACK_WEBHOOK_RELEASES_URL hash=`echo $SLACK_WEBHOOK_RELEASES_URL | md5`" -# echo "SLACK_WEBHOOK_JAVA_CI_URL hash=`echo $SLACK_WEBHOOK_JAVA_CI_URL | md5`" - -# echo "GRADLE_PORTAL_KEY hash=`echo $GRADLE_PORTAL_KEY | md5`" -# echo "GRADLE_PORTAL_SECRET hash=`echo $GRADLE_PORTAL_SECRET | md5`" -# echo "GRADLE_BUILD_PARAMS hash=`echo $GRADLE_BUILD_PARAMS | md5`" - -# echo "debugging MAVEN_CENTRAL_USER" -# for (( i=0; i<${#MAVEN_CENTRAL_USER}; i++ )); do -# echo "${MAVEN_CENTRAL_USER:i:1}" -# done -# echo - -# echo "debugging MAVEN_CENTRAL_KEY" -# for (( i=0; i<${#MAVEN_CENTRAL_KEY}; i++ )); do -# echo "${MAVEN_CENTRAL_KEY:i:1}" -# done -# echo - - -# echo "debugging REALM_S3_ACCESS_KEY" -# for (( i=0; i<${#REALM_S3_ACCESS_KEY}; i++ )); do -# echo "${REALM_S3_ACCESS_KEY:i:1}" -# done -# echo - -# echo "debugging REALM_S3_SECRET_KEY" -# for (( i=0; i<${#REALM_S3_SECRET_KEY}; i++ )); do -# echo "${REALM_S3_SECRET_KEY:i:1}" -# done -# echo - -# echo "debugging DOCS_S3_ACCESS_KEY" -# for (( i=0; i<${#DOCS_S3_ACCESS_KEY}; i++ )); do -# echo "${DOCS_S3_ACCESS_KEY:i:1}" -# done -# echo - -# echo "debugging DOCS_S3_SECRET_KEY" -# for (( i=0; i<${#DOCS_S3_SECRET_KEY}; i++ )); do -# echo "${DOCS_S3_SECRET_KEY:i:1}" -# done -# echo - -# echo "debugging GRADLE_PORTAL_KEY" -# for (( i=0; i<${#GRADLE_PORTAL_KEY}; i++ )); do -# echo "${GRADLE_PORTAL_KEY:i:1}" -# done -# echo - -# echo "debugging GRADLE_PORTAL_SECRET" -# for (( i=0; i<${#GRADLE_PORTAL_SECRET}; i++ )); do -# echo "${GRADLE_PORTAL_SECRET:i:1}" -# done -# echo - -# echo "debugging GRADLE_BUILD_PARAMS" -# for (( i=0; i<${#GRADLE_BUILD_PARAMS}; i++ )); do -# echo "${GRADLE_BUILD_PARAMS:i:1}" -# done -# echo - - - - abort_release() { # Reporting failures to #realm-java-team-ci is done from Jenkins exit 1 @@ -189,10 +115,9 @@ create_javadoc() { publish_artifacts() { echo "Releasing on MavenCentral" cd $REALM_KOTLIN_PATH/packages - # eval "./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository $GRADLE_BUILD_PARAMS -PossrhUsername=$MAVEN_CENTRAL_USER -PossrhPassword=$MAVEN_CENTRAL_KEY" - eval "./gradlew publishToSonatype $GRADLE_BUILD_PARAMS -PossrhUsername=$MAVEN_CENTRAL_USER -PossrhPassword=$MAVEN_CENTRAL_KEY" - # echo "Releasing on Gradle Plugin Portal" - # eval "./gradlew :gradle-plugin:publishPlugin $GRADLE_BUILD_PARAMS -PgeneratePluginArtifactMarker=true -Pgradle.publish.key=$GRADLE_PORTAL_KEY -Pgradle.publish.secret=$GRADLE_PORTAL_SECRET" + eval "./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository $GRADLE_BUILD_PARAMS -PossrhUsername=$MAVEN_CENTRAL_USER -PossrhPassword=$MAVEN_CENTRAL_KEY" + echo "Releasing on Gradle Plugin Portal" + eval "./gradlew :gradle-plugin:publishPlugin $GRADLE_BUILD_PARAMS -PgeneratePluginArtifactMarker=true -Pgradle.publish.key=$GRADLE_PORTAL_KEY -Pgradle.publish.secret=$GRADLE_PORTAL_SECRET" cd $HERE } @@ -241,14 +166,14 @@ notify_slack_channels() { # Run Release steps ######################################\ -# check_env -# verify_release_preconditions -# verify_changelog +check_env +verify_release_preconditions +verify_changelog if [ "$1" != "verify" ]; then - # create_javadoc + create_javadoc publish_artifacts - # upload_debug_symbols - # upload_dokka - # notify_slack_channels + upload_debug_symbols + upload_dokka + notify_slack_channels fi From de4081bf282fcc7068eeb4e8ccb77f0986e08437 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 7 Mar 2024 15:26:26 +0000 Subject: [PATCH 26/36] Conditional trigger for release --- .github/workflows/include-deploy-release.yml | 19 +- .github/workflows/pr.yml | 1509 +++++++++--------- 2 files changed, 732 insertions(+), 796 deletions(-) diff --git a/.github/workflows/include-deploy-release.yml b/.github/workflows/include-deploy-release.yml index 83fa85bf71..80bf6cddb4 100644 --- a/.github/workflows/include-deploy-release.yml +++ b/.github/workflows/include-deploy-release.yml @@ -16,7 +16,6 @@ jobs: runs-on: macos-latest name: Deploy release -#TODO release script needs s3cmd steps: - name: git checkout uses: actions/checkout@v3 @@ -101,13 +100,13 @@ jobs: name: all-packages-${{ inputs.version-label }} path: ./packages/build/m2-buildrepo - - name: Publish release to Maven Central - run: | - set +x - sh ./tools/publish_release.sh "${{ secrets.MAVEN_CENTRAL_USER_DBG }}" "${{ secrets.MAVEN_CENTRAL_KEY_DBG }}" \ - "${{ secrets.AWS_S3_ACCESS_KEY_ID }}" "${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}" \ - "${{ secrets.DOCS_S3_ACCESS_KEY }}" "${{ secrets.DOCS_S3_SECRET_KEY }}" \ - "${{ secrets.SLACK_URL_RELEASE }}" "${{ secrets.SLACK_URL_CI }}" \ - "${{ secrets.GRADLE_PORTAL_KEY }}" "${{ secrets.GRADLE_PORTAL_SECRET }}" \ - '-PsignBuild=true -PsignSecretRingFileKotlin="${{ secrets.GPG_SIGNING_KEY_BASE_64_DBG }}" -PsignPasswordKotlin=${{ secrets.GPG_PASS_PHRASE_DBG }}' + # - name: Publish release to Maven Central + # run: | + # set +x + # sh ./tools/publish_release.sh "${{ secrets.MAVEN_CENTRAL_USER_DBG }}" "${{ secrets.MAVEN_CENTRAL_KEY_DBG }}" \ + # "${{ secrets.AWS_S3_ACCESS_KEY_ID }}" "${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}" \ + # "${{ secrets.DOCS_S3_ACCESS_KEY }}" "${{ secrets.DOCS_S3_SECRET_KEY }}" \ + # "${{ secrets.SLACK_URL_RELEASE }}" "${{ secrets.SLACK_URL_CI }}" \ + # "${{ secrets.GRADLE_PORTAL_KEY }}" "${{ secrets.GRADLE_PORTAL_SECRET }}" \ + # '-PsignBuild=true -PsignSecretRingFileKotlin="${{ secrets.GPG_SIGNING_KEY_BASE_64_DBG }}" -PsignPasswordKotlin=${{ secrets.GPG_PASS_PHRASE_DBG }}' diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a58e98e25f..ca5340d317 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -15,6 +15,7 @@ concurrency: env: REALM_DISABLE_ANALYTICS: true + REALM_PRINT_ANALYTICS: true CMAKE_C_COMPILER: /usr/local/bin/ccache-clang CMAKE_CXX_COMPILER: /usr/local/bin/ccache-clang++ # Workflow environment variables are not available in Job if statements: https://github.com/actions/runner/issues/1661 @@ -227,9 +228,9 @@ jobs: runs-on: macos-latest needs: [check-cache, build-jni-swig-stub] if: | - always() && - !cancelled() && - !contains(needs.*.result, 'failure') && + always() && + !cancelled() && + !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && needs.check-cache.outputs.jni-windows-lib-cache-hit != 'true' @@ -914,634 +915,634 @@ jobs: # TODO Compare speed between emulator and Device Farm # TODO We should be able to move this into a reusable work-flow - # test-android-packages-emulator: - # timeout-minutes: 60 - # strategy: - # fail-fast: false - # matrix: - # type: [base, sync] - # include: - # - type: base - # test-title: Unit Test Results - Android Base (Emulator) - # - type: sync - # test-title: Unit Test Results - Android Sync (Emulator) + test-android-packages-emulator: + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + type: [base, sync] + include: + - type: base + test-title: Unit Test Results - Android Base (Emulator) + - type: sync + test-title: Unit Test Results - Android Sync (Emulator) - # runs-on: macos-latest - # needs: [check-cache, build-android-packages, build-jvm-packages, build-kotlin-metadata-package] - # if: | - # always() && - # !cancelled() && - # !contains(needs.*.result, 'failure') && - # !contains(needs.*.result, 'cancelled') - - # steps: - # - name: Checkout code - # uses: actions/checkout@v3 - # with: - # submodules: "recursive" - - # # checkout BAAS CLI repo - # - name: Checkout BAAS repo - # if: matrix.type == 'sync' - # 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 - # if: matrix.type == 'sync' - # 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 | jq -r '.id') - # echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - - # - name: Setup Java 11 - # uses: actions/setup-java@v3 - # with: - # distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} - # java-version: ${{ vars.VERSION_JAVA }} - - # - name: Setup Gradle and task/dependency caching - # uses: gradle/gradle-build-action@v2 - # with: - # cache-read-only: false - - # - name: Restore Kotlin metadata artifacts - # uses: actions/download-artifact@v3 - # with: - # name: packages-metadata-${{ needs.check-cache.outputs.version-label }} - # path: ./packages/build/m2-buildrepo - - # - name: Restore m2-buildrepo (Android) - # uses: actions/download-artifact@v3 - # with: - # name: packages-android-${{ needs.check-cache.outputs.version-label }} - # path: ./packages/build/m2-buildrepo - - # - name: Restore m2-buildrepo (JVM) - # uses: actions/download-artifact@v3 - # with: - # name: packages-jvm-${{ needs.check-cache.outputs.version-label }} - # path: ./packages/build/m2-buildrepo - - # # 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 - # if: matrix.type == 'sync' - # 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 - - # # TODO This action does not support using `\` to split multiline scripts. - # - name: Run Integration Tests - # env: - # SSH_AUTH_SOCK: /tmp/ssh_agent.sock - # uses: reactivecircus/android-emulator-runner@v2 - # with: - # emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - # disable-animations: true - # api-level: ${{ vars.VERSION_ANDROID_EMULATOR_API_LEVEL }} # Must be 30 to support aosp_atd - # target: default - # arch: x86_64 - # disk-size: 4096M - # ram-size: 2048M - # heap-size: 1024M - # channel: canary - # script: | - # adb logcat -c - # adb logcat > logcat.txt & - # cd packages && ./gradlew :test-${{ matrix.type }}:connectedCheck -PsyncUsePlatformNetworking=true -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} -PincludeSdkModules=false --info --no-daemon - - # - name: Archive LogCat data - # uses: actions/upload-artifact@v3 - # if: always() || failure() - # with: - # name: logcat-${{ matrix.type }}-emulator.txt - # path: logcat.txt - # retention-days: 1 - - # - name: Publish Unit Test Results - # uses: dorny/test-reporter@v1 - # if: always() || failure() - # with: - # name: ${{ matrix.test-title }} - # path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml - # reporter: java-junit - # list-suites: failed - # list-tests: failed - # fail-on-error: true - - # - name: Stopping the BAAS container - # if: always() && matrix.type == 'sync' - # 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 + runs-on: macos-latest + needs: [check-cache, build-android-packages, build-jvm-packages, build-kotlin-metadata-package] + if: | + always() && + !cancelled() && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: "recursive" + + # checkout BAAS CLI repo + - name: Checkout BAAS repo + if: matrix.type == 'sync' + 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 + if: matrix.type == 'sync' + 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 | jq -r '.id') + echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT + + - name: Setup Java 11 + uses: actions/setup-java@v3 + with: + distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} + java-version: ${{ vars.VERSION_JAVA }} + + - name: Setup Gradle and task/dependency caching + uses: gradle/gradle-build-action@v2 + with: + cache-read-only: false + + - name: Restore Kotlin metadata artifacts + uses: actions/download-artifact@v3 + with: + name: packages-metadata-${{ needs.check-cache.outputs.version-label }} + path: ./packages/build/m2-buildrepo + + - name: Restore m2-buildrepo (Android) + uses: actions/download-artifact@v3 + with: + name: packages-android-${{ needs.check-cache.outputs.version-label }} + path: ./packages/build/m2-buildrepo + + - name: Restore m2-buildrepo (JVM) + uses: actions/download-artifact@v3 + with: + name: packages-jvm-${{ needs.check-cache.outputs.version-label }} + path: ./packages/build/m2-buildrepo + + # 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 + if: matrix.type == 'sync' + 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 + + # TODO This action does not support using `\` to split multiline scripts. + - name: Run Integration Tests + env: + SSH_AUTH_SOCK: /tmp/ssh_agent.sock + uses: reactivecircus/android-emulator-runner@v2 + with: + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + api-level: ${{ vars.VERSION_ANDROID_EMULATOR_API_LEVEL }} # Must be 30 to support aosp_atd + target: default + arch: x86_64 + disk-size: 4096M + ram-size: 2048M + heap-size: 1024M + channel: canary + script: | + adb logcat -c + adb logcat > logcat.txt & + cd packages && ./gradlew :test-${{ matrix.type }}:connectedCheck -PsyncUsePlatformNetworking=true -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} -PincludeSdkModules=false --info --no-daemon + + - name: Archive LogCat data + uses: actions/upload-artifact@v3 + if: always() || failure() + with: + name: logcat-${{ matrix.type }}-emulator.txt + path: logcat.txt + retention-days: 1 + + - name: Publish Unit Test Results + uses: dorny/test-reporter@v1 + if: always() || failure() + with: + name: ${{ matrix.test-title }} + path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml + reporter: java-junit + list-suites: failed + list-tests: failed + fail-on-error: true + + - name: Stopping the BAAS container + if: always() && matrix.type == 'sync' + 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 # Disable device farm test for Base, because running two in parallel seems to interfer somehow - # test-android-packages-device-farm: - # name: AWS Device Farm - # timeout-minutes: 60 - # runs-on: ubuntu-latest - # needs: [ check-cache, build-android-packages, build-jvm-packages ] - # if: | - # false && - # always() && - # !cancelled() && - # !contains(needs.*.result, 'failure') && - # !contains(needs.*.result, 'cancelled') - - # steps: - # - 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 - - # - 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 - # app-id: io.realm.testapp - # 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 - - # # 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 | jq -r '.id') - # echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - - # - 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/ - - # - 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 - - # # 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 the Sync tests - # 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 - # apk-auxiliary-path: ${{ github.workspace }}/packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk - # baas_url: ${{ steps.baas_cli_poll.outputs.baas_container_hostname }} - # app-id: io.realm.sync.testapp.test - # project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} - # device-pool-arn: ${{ secrets.DEVICEFARM_POOL_ARN }} - - # - 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-macos-packages: - # timeout-minutes: 60 - # strategy: - # fail-fast: false - # matrix: - # os: [macos-latest] # , macos-arm] - # type: [base, sync] - # include: - # - os: macos-latest - # type: base - # os-id: macos - # package-prefix: macos-x64 - # test-title: Unit Test Results - MacOS x64 Base - # - os: macos-latest - # type: sync - # os-id: macos - # package-prefix: macos-x64 - # test-title: Unit Test Results - MacOS x64 Sync - # # - os: macos-arm - # # package-prefix: macos-arm64 - # # test-title: Results - MacOS arm64 Base + test-android-packages-device-farm: + name: AWS Device Farm + timeout-minutes: 60 + runs-on: ubuntu-latest + needs: [ check-cache, build-android-packages, build-jvm-packages ] + if: | + false && + always() && + !cancelled() && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') + + steps: + - 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 + + - 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 + app-id: io.realm.testapp + 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 + + # 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 | jq -r '.id') + echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT + + - 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/ + + - 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 + + # 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 the Sync tests + 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 + apk-auxiliary-path: ${{ github.workspace }}/packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk + baas_url: ${{ steps.baas_cli_poll.outputs.baas_container_hostname }} + app-id: io.realm.sync.testapp.test + project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} + device-pool-arn: ${{ secrets.DEVICEFARM_POOL_ARN }} + + - 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-macos-packages: + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + os: [macos-latest] # , macos-arm] + type: [base, sync] + include: + - os: macos-latest + type: base + os-id: macos + package-prefix: macos-x64 + test-title: Unit Test Results - MacOS x64 Base + - os: macos-latest + type: sync + os-id: macos + package-prefix: macos-x64 + test-title: Unit Test Results - MacOS x64 Sync + # - os: macos-arm + # package-prefix: macos-arm64 + # test-title: Results - MacOS arm64 Base - # runs-on: ${{ matrix.os }} - # # TODO Unclear why MacOS needs the metadata package when the Android Tests do not - # # Disable macos-arm for now as the host needs to have the Android SDK installed even though it isn't really using it. - # needs: [check-cache, build-macos-x64-packages, build-kotlin-metadata-package] #, build-macos-arm64-packages] - # if: | - # always() && - # !cancelled() && - # !contains(needs.*.result, 'failure') && - # !contains(needs.*.result, 'cancelled') - - # steps: - # - name: Checkout code - # uses: actions/checkout@v3 - - # # checkout BAAS CLI repo - # - name: Checkout BAAS repo - # if: matrix.type == 'sync' - # 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 - # if: matrix.type == 'sync' - # 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 | jq -r '.id') - # echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - - # - name: Setup Java 11 - # uses: actions/setup-java@v3 - # with: - # distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} - # java-version: ${{ vars.VERSION_JAVA }} - - # - name: Setup Gradle and task/dependency caching - # uses: gradle/gradle-build-action@v2 - # with: - # cache-read-only: false - - # - name: Restore m2-buildrepo - # uses: actions/download-artifact@v3 - # with: - # name: packages-${{ matrix.package-prefix }}-${{ needs.check-cache.outputs.version-label }} - # path: ./packages/build/m2-buildrepo - - # - name: Restore Kotlin metadata artifacts - # uses: actions/download-artifact@v3 - # with: - # name: packages-metadata-${{ needs.check-cache.outputs.version-label }} - # path: ./packages/build/m2-buildrepo - - - # # 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 - # if: matrix.type == 'sync' - # 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 tests - # working-directory: packages - # run: > - # ./gradlew :test-${{ matrix.type }}:macosTest - # -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} - # -PincludeSdkModules=false - # --info --no-daemon - - # - name: Publish Unit Test Results - # uses: dorny/test-reporter@v1 - # if: always() || failure() - # with: - # name: ${{ matrix.test-title }} - # path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml - # reporter: java-junit - # list-suites: failed - # list-tests: failed - # fail-on-error: true - - # - name: Stopping the BAAS container - # if: always() && matrix.type == 'sync' - # 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: 60 - # strategy: - # fail-fast: false - # matrix: - # os: [macos-latest] # , macos-arm] - # type: [base, sync] - # include: - # - os: macos-latest - # type: base - # package-prefix: x64 - # test-title: Unit Test Results - iOS x64 Base - # test-task: iosTest - # - os: macos-latest - # type: sync - # package-prefix: x64 - # test-title: Unit Test Results - iOS x64 Sync - # test-task: iosTest - # # - os: macos-arm - # # package-prefix: macos-arm64 - # # test-title: Results - MacOS arm64 Base + runs-on: ${{ matrix.os }} + # TODO Unclear why MacOS needs the metadata package when the Android Tests do not + # Disable macos-arm for now as the host needs to have the Android SDK installed even though it isn't really using it. + needs: [check-cache, build-macos-x64-packages, build-kotlin-metadata-package] #, build-macos-arm64-packages] + if: | + always() && + !cancelled() && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + # checkout BAAS CLI repo + - name: Checkout BAAS repo + if: matrix.type == 'sync' + 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 + if: matrix.type == 'sync' + 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 | jq -r '.id') + echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT + + - name: Setup Java 11 + uses: actions/setup-java@v3 + with: + distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} + java-version: ${{ vars.VERSION_JAVA }} + + - name: Setup Gradle and task/dependency caching + uses: gradle/gradle-build-action@v2 + with: + cache-read-only: false + + - name: Restore m2-buildrepo + uses: actions/download-artifact@v3 + with: + name: packages-${{ matrix.package-prefix }}-${{ needs.check-cache.outputs.version-label }} + path: ./packages/build/m2-buildrepo + + - name: Restore Kotlin metadata artifacts + uses: actions/download-artifact@v3 + with: + name: packages-metadata-${{ needs.check-cache.outputs.version-label }} + path: ./packages/build/m2-buildrepo + + + # 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 + if: matrix.type == 'sync' + 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 tests + working-directory: packages + run: > + ./gradlew :test-${{ matrix.type }}:macosTest + -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} + -PincludeSdkModules=false + --info --no-daemon + + - name: Publish Unit Test Results + uses: dorny/test-reporter@v1 + if: always() || failure() + with: + name: ${{ matrix.test-title }} + path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml + reporter: java-junit + list-suites: failed + list-tests: failed + fail-on-error: true + + - name: Stopping the BAAS container + if: always() && matrix.type == 'sync' + 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: 60 + strategy: + fail-fast: false + matrix: + os: [macos-latest] # , macos-arm] + type: [base, sync] + include: + - os: macos-latest + type: base + package-prefix: x64 + test-title: Unit Test Results - iOS x64 Base + test-task: iosTest + - os: macos-latest + type: sync + package-prefix: x64 + test-title: Unit Test Results - iOS x64 Sync + test-task: iosTest + # - os: macos-arm + # package-prefix: macos-arm64 + # test-title: Results - MacOS arm64 Base - # runs-on: ${{ matrix.os }} - # # TODO Unclear why MacOS needs the metadata package when the Android Tests do not - # # Disable macos-arm for now as the host needs to have the Android SDK installed even though it isn't really using it. - # needs: [check-cache, build-ios-x64-packages, build-kotlin-metadata-package, build-macos-x64-packages] # , build-ios-arm64-packages] - # if: | - # always() && - # !cancelled() && - # !contains(needs.*.result, 'failure') && - # !contains(needs.*.result, 'cancelled') - - # steps: - # - name: Checkout code - # uses: actions/checkout@v3 - - # # checkout BAAS CLI repo - # - name: Checkout BAAS repo - # if: matrix.type == 'sync' - # 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 - # if: matrix.type == 'sync' - # 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 | jq -r '.id') - # echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - - # - name: Setup Java 11 - # uses: actions/setup-java@v3 - # with: - # distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} - # java-version: ${{ vars.VERSION_JAVA }} - - # - name: Setup Gradle and task/dependency caching - # uses: gradle/gradle-build-action@v2 - # with: - # cache-read-only: false - - # - name: Restore m2-buildrepo (ios) - # uses: actions/download-artifact@v3 - # with: - # name: packages-ios-${{ matrix.package-prefix }}-${{ needs.check-cache.outputs.version-label }} - # path: ./packages/build/m2-buildrepo - - # - name: Restore Kotlin metadata artifacts - # uses: actions/download-artifact@v3 - # with: - # name: packages-metadata-${{ needs.check-cache.outputs.version-label }} - # path: ./packages/build/m2-buildrepo - - - # # 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 - # if: matrix.type == 'sync' - # 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 - - # # App names are limited to 32 characters, so the appNamePrefix should not exceed 22 characters. - # - name: Run tests - # working-directory: packages - # run: > - # ./gradlew :test-${{ matrix.type }}:${{ matrix.test-task }} - # -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} - # -PincludeSdkModules=false - # --info --no-daemon - - # - name: Publish Unit Test Results - # uses: dorny/test-reporter@v1 - # if: always() || failure() - # with: - # name: ${{ matrix.test-title }} - # path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml - # reporter: java-junit - # list-suites: failed - # list-tests: failed - # fail-on-error: true - - # - name: Stopping the BAAS container - # if: always() && matrix.type == 'sync' - # 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-jvm-packages: - # timeout-minutes: 60 - # strategy: - # fail-fast: false - # matrix: - # os: [macos-latest, ubuntu-latest, windows-latest] # TODO Should we also test om MacOS arm64? - # type: [base, sync] - # include: - # - os: macos-latest - # os-id: mac - # type: base - # test-title: Unit Test Results - Base JVM MacOS x64 - # - os: ubuntu-latest - # os-id: ubu - # type: base - # test-title: Unit Test Results - Base JVM Linux - # - os: windows-latest - # os-id: win - # type: base - # test-title: Unit Test Results - Base JVM Windows - # - os: macos-latest - # os-id: mac - # type: sync - # test-title: Unit Test Results - Sync JVM MacOS x64 - # - os: ubuntu-latest - # os-id: ubu - # type: sync - # test-title: Unit Test Results - Sync JVM Linux - # exclude: - # # Do not run Windows Sync Tests, because the bash script for - # # starting the BAAS container doesn not work on Windows. - # - os: windows-latest - # #os-id: win - # type: sync - # #test-title: Unit Test Results - Sync JVM Windows - - # runs-on: ${{ matrix.os }} - # needs: [check-cache, build-jvm-packages, build-kotlin-metadata-package] - # if: | - # always() && - # !cancelled() && - # !contains(needs.*.result, 'failure') && - # !contains(needs.*.result, 'cancelled') - - # steps: - # - name: Checkout code - # uses: actions/checkout@v3 - - # # checkout BAAS CLI repo - # - name: Checkout BAAS repo - # if: matrix.type == 'sync' - # 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 - # if: matrix.type == 'sync' - # 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 | jq -r '.id') - # echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - - # - name: Setup Java 11 - # uses: actions/setup-java@v3 - # with: - # distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} - # java-version: ${{ vars.VERSION_JAVA }} - - # - name: Setup Gradle and task/dependency caching - # uses: gradle/gradle-build-action@v2 - # with: - # cache-read-only: false - - # - name: Restore Kotlin metadata artifacts - # uses: actions/download-artifact@v3 - # with: - # name: packages-metadata-${{ needs.check-cache.outputs.version-label }} - # path: ./packages/build/m2-buildrepo - - # - name: Restore m2-buildrepo - # uses: actions/download-artifact@v3 - # with: - # name: packages-jvm-${{ needs.check-cache.outputs.version-label }} - # path: ./packages/build/m2-buildrepo - - # # 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 - # if: matrix.type == 'sync' - # 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 - - # # App names are limited to 32 characters, so the appNamePrefix should not exceed 22 characters. - # - name: Run tests - # working-directory: packages - # run: > - # ./gradlew :test-${{ matrix.type }}:jvmTest - # -PsyncUsePlatformNetworking=true - # -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} - # -PincludeSdkModules=false - # --info --no-daemon - - # - name: Publish Unit Test Results - # uses: dorny/test-reporter@v1 - # if: always() || failure() - # with: - # name: ${{ matrix.test-title }} - # path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml - # reporter: java-junit - # list-suites: failed - # list-tests: failed - # fail-on-error: true - - # - name: Stopping the BAAS container - # if: always() && matrix.type == 'sync' - # 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 + runs-on: ${{ matrix.os }} + # TODO Unclear why MacOS needs the metadata package when the Android Tests do not + # Disable macos-arm for now as the host needs to have the Android SDK installed even though it isn't really using it. + needs: [check-cache, build-ios-x64-packages, build-kotlin-metadata-package] # , build-ios-arm64-packages] + if: | + always() && + !cancelled() && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + # checkout BAAS CLI repo + - name: Checkout BAAS repo + if: matrix.type == 'sync' + 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 + if: matrix.type == 'sync' + 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 | jq -r '.id') + echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT + + - name: Setup Java 11 + uses: actions/setup-java@v3 + with: + distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} + java-version: ${{ vars.VERSION_JAVA }} + + - name: Setup Gradle and task/dependency caching + uses: gradle/gradle-build-action@v2 + with: + cache-read-only: false + + - name: Restore m2-buildrepo (ios) + uses: actions/download-artifact@v3 + with: + name: packages-ios-${{ matrix.package-prefix }}-${{ needs.check-cache.outputs.version-label }} + path: ./packages/build/m2-buildrepo + + - name: Restore Kotlin metadata artifacts + uses: actions/download-artifact@v3 + with: + name: packages-metadata-${{ needs.check-cache.outputs.version-label }} + path: ./packages/build/m2-buildrepo + + + # 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 + if: matrix.type == 'sync' + 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 + + # App names are limited to 32 characters, so the appNamePrefix should not exceed 22 characters. + - name: Run tests + working-directory: packages + run: > + ./gradlew :test-${{ matrix.type }}:${{ matrix.test-task }} + -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} + -PincludeSdkModules=false + --info --no-daemon + + - name: Publish Unit Test Results + uses: dorny/test-reporter@v1 + if: always() || failure() + with: + name: ${{ matrix.test-title }} + path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml + reporter: java-junit + list-suites: failed + list-tests: failed + fail-on-error: true + + - name: Stopping the BAAS container + if: always() && matrix.type == 'sync' + 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-jvm-packages: + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] # TODO Should we also test om MacOS arm64? + type: [base, sync] + include: + - os: macos-latest + os-id: mac + type: base + test-title: Unit Test Results - Base JVM MacOS x64 + - os: ubuntu-latest + os-id: ubu + type: base + test-title: Unit Test Results - Base JVM Linux + - os: windows-latest + os-id: win + type: base + test-title: Unit Test Results - Base JVM Windows + - os: macos-latest + os-id: mac + type: sync + test-title: Unit Test Results - Sync JVM MacOS x64 + - os: ubuntu-latest + os-id: ubu + type: sync + test-title: Unit Test Results - Sync JVM Linux + exclude: + # Do not run Windows Sync Tests, because the bash script for + # starting the BAAS container doesn not work on Windows. + - os: windows-latest + #os-id: win + type: sync + #test-title: Unit Test Results - Sync JVM Windows + + runs-on: ${{ matrix.os }} + needs: [check-cache, build-jvm-packages, build-kotlin-metadata-package] + if: | + always() && + !cancelled() && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + # checkout BAAS CLI repo + - name: Checkout BAAS repo + if: matrix.type == 'sync' + 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 + if: matrix.type == 'sync' + 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 | jq -r '.id') + echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT + + - name: Setup Java 11 + uses: actions/setup-java@v3 + with: + distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} + java-version: ${{ vars.VERSION_JAVA }} + + - name: Setup Gradle and task/dependency caching + uses: gradle/gradle-build-action@v2 + with: + cache-read-only: false + + - name: Restore Kotlin metadata artifacts + uses: actions/download-artifact@v3 + with: + name: packages-metadata-${{ needs.check-cache.outputs.version-label }} + path: ./packages/build/m2-buildrepo + + - name: Restore m2-buildrepo + uses: actions/download-artifact@v3 + with: + name: packages-jvm-${{ needs.check-cache.outputs.version-label }} + path: ./packages/build/m2-buildrepo + + # 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 + if: matrix.type == 'sync' + 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 + + # App names are limited to 32 characters, so the appNamePrefix should not exceed 22 characters. + - name: Run tests + working-directory: packages + run: > + ./gradlew :test-${{ matrix.type }}:jvmTest + -PsyncUsePlatformNetworking=true + -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} + -PincludeSdkModules=false + --info --no-daemon + + - name: Publish Unit Test Results + uses: dorny/test-reporter@v1 + if: always() || failure() + with: + name: ${{ matrix.test-title }} + path: ./packages/test-${{ matrix.type }}/build/**/TEST-*.xml + reporter: java-junit + list-suites: failed + list-tests: failed + fail-on-error: true + + - name: Stopping the BAAS container + if: always() && matrix.type == 'sync' + 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 package-all-artifacts: runs-on: ubuntu-latest @@ -1607,166 +1608,102 @@ jobs: path: ./packages/build/m2-buildrepo retention-days: 7 - # integration-tests: - # uses: ./.github/workflows/include-integration-tests.yml - # needs: [check-cache, package-all-artifacts] - # if: | - # always() && - # !cancelled() && - # !contains(needs.*.result, 'failure') && - # !contains(needs.*.result, 'cancelled') - # with: - # version-label: ${{ needs.check-cache.outputs.version-label }} - - print-secret: + integration-tests: + uses: ./.github/workflows/include-integration-tests.yml + needs: [check-cache, package-all-artifacts] + if: | + always() && + !cancelled() && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') + with: + version-label: ${{ needs.check-cache.outputs.version-label }} + + deploy-snapshot: + uses: ./.github/workflows/include-deploy-snapshot.yml + needs: [ + check-cache, + static-analysis, + integration-tests, + test-jvm-packages, + test-macos-packages, + test-ios-packages, + test-android-packages-emulator, + # test-android-packages-device-farm, + test-android-packages-device-farm-sync, + package-all-artifacts + ] + if: | + always() && + !cancelled() && + endsWith(needs.check-cache.outputs.version-label, '-SNAPSHOT') && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') && + (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/releases') + + secrets: inherit + with: + version-label: ${{ needs.check-cache.outputs.version-label }} + + # This job sets an output `publishBuild` to `true` if this is a release build + check-release-build: runs-on: ubuntu-latest + needs: [check-cache] steps: - - name: Print Organization - env: - DOCS_S3_ACCESS_KEY: ${{ secrets.DOCS_S3_ACCESS_KEY }} - DOCS_S3_SECRET_KEY: ${{ secrets.DOCS_S3_SECRET_KEY }} - GPG_PASS_PHRASE: ${{ secrets.GPG_PASS_PHRASE }} - GPG_PASS_PHRASE_DBG: ${{ secrets.GPG_PASS_PHRASE_DBG }} - GPG_SIGNING_KEY_BASE_64: ${{ secrets.GPG_SIGNING_KEY_BASE_64 }} - GPG_SIGNING_KEY_BASE_64_DBG: ${{ secrets.GPG_SIGNING_KEY_BASE_64_DBG }} - GRADLE_PORTAL_KEY: ${{ secrets.GRADLE_PORTAL_KEY }} - GRADLE_PORTAL_SECRET: ${{ secrets.GRADLE_PORTAL_SECRET }} - MAVEN_CENTRAL_KEY_DBG: ${{ secrets.MAVEN_CENTRAL_KEY_DBG }} - MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} - MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }} - MAVEN_CENTRAL_USER_DBG: ${{ secrets.MAVEN_CENTRAL_USER_DBG }} - SLACK_METRICS_CHANNEL_URL: ${{ secrets.SLACK_METRICS_CHANNEL_URL }} - SLACK_URL_CI: ${{ secrets.SLACK_URL_CI }} - SLACK_URL_RELEASE: ${{ secrets.SLACK_URL_RELEASE }} - AWS_S3_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} - AWS_S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} + - uses: actions/checkout@v3 + + - name: Get Git tag + run: | + gitTag=$(git describe --tags --exact-match HEAD) + echo "Git branch/tag: ${GITHUB_REF}/${gitTag:-'none'}" + + - name: Check if release build + id: check_release run: | - echo "DOCS_S3_ACCESS_KEY" - for ((i=0; i<${#DOCS_S3_ACCESS_KEY}; i++)); do - echo "${DOCS_S3_ACCESS_KEY:i:1}" - done - - echo "DOCS_S3_SECRET_KEY" - for ((i=0; i<${#DOCS_S3_SECRET_KEY}; i++)); do - echo "${DOCS_S3_SECRET_KEY:i:1}" - done - - echo "GPG_PASS_PHRASE" - for ((i=0; i<${#GPG_PASS_PHRASE}; i++)); do - echo "${GPG_PASS_PHRASE:i:1}" - done - - echo "GPG_PASS_PHRASE_DBG" - for ((i=0; i<${#GPG_PASS_PHRASE_DBG}; i++)); do - echo "${GPG_PASS_PHRASE_DBG:i:1}" - done - - echo "GPG_SIGNING_KEY_BASE_64" - for ((i=0; i<${#GPG_SIGNING_KEY_BASE_64}; i++)); do - echo "${GPG_SIGNING_KEY_BASE_64:i:1}" - done - - echo "GPG_SIGNING_KEY_BASE_64_DBG" - for ((i=0; i<${#GPG_SIGNING_KEY_BASE_64_DBG}; i++)); do - echo "${GPG_SIGNING_KEY_BASE_64_DBG:i:1}" - done - - echo "GRADLE_PORTAL_KEY" - for ((i=0; i<${#GRADLE_PORTAL_KEY}; i++)); do - echo "${GRADLE_PORTAL_KEY:i:1}" - done - - echo "GRADLE_PORTAL_SECRET" - for ((i=0; i<${#GRADLE_PORTAL_SECRET}; i++)); do - echo "${GRADLE_PORTAL_SECRET:i:1}" - done - - echo "MAVEN_CENTRAL_KEY_DBG" - for ((i=0; i<${#MAVEN_CENTRAL_KEY_DBG}; i++)); do - echo "${MAVEN_CENTRAL_KEY_DBG:i:1}" - done - - echo "MAVEN_CENTRAL_PASSWORD" - for ((i=0; i<${#MAVEN_CENTRAL_PASSWORD}; i++)); do - echo "${MAVEN_CENTRAL_PASSWORD:i:1}" - done - - echo "MAVEN_CENTRAL_USER" - for ((i=0; i<${#MAVEN_CENTRAL_USER}; i++)); do - echo "${MAVEN_CENTRAL_USER:i:1}" - done - - echo "MAVEN_CENTRAL_USER_DBG" - for ((i=0; i<${#MAVEN_CENTRAL_USER_DBG}; i++)); do - echo "${MAVEN_CENTRAL_USER_DBG:i:1}" - done - - echo "SLACK_METRICS_CHANNEL_URL" - for ((i=0; i<${#SLACK_METRICS_CHANNEL_URL}; i++)); do - echo "${SLACK_METRICS_CHANNEL_URL:i:1}" - done - - echo "SLACK_URL_CI" - for ((i=0; i<${#SLACK_URL_CI}; i++)); do - echo "${SLACK_URL_CI:i:1}" - done - - echo "SLACK_URL_RELEASE" - for ((i=0; i<${#SLACK_URL_RELEASE}; i++)); do - echo "${SLACK_URL_RELEASE:i:1}" - done - - echo "AWS_S3_ACCESS_KEY_ID" - for ((i=0; i<${#AWS_S3_ACCESS_KEY_ID}; i++)); do - echo "${AWS_S3_ACCESS_KEY_ID:i:1}" - done - - echo "AWS_S3_SECRET_ACCESS_KEY" - for ((i=0; i<${#AWS_S3_SECRET_ACCESS_KEY}; i++)); do - echo "${AWS_S3_SECRET_ACCESS_KEY:i:1}" - done - - # deploy-snapshot: - # uses: ./.github/workflows/include-deploy-snapshot.yml - # needs: [ - # check-cache, - # # static-analysis, - # # integration-tests, - # # test-jvm-packages, - # # test-macos-packages, - # # test-ios-packages, - # # test-android-packages-emulator, - # # test-android-packages-device-farm, - # # test-android-packages-device-farm-sync, - # # package-all-artifacts - # ] - # if: | - # always() && - # !cancelled() - - # secrets: inherit - # with: - # version-label: ${{ needs.check-cache.outputs.version-label }} - - - # deploy-release: - # uses: ./.github/workflows/include-deploy-release.yml - # needs: [ - # check-cache, - # # static-analysis, - # # integration-tests, - # # test-jvm-packages, - # # test-macos-packages, - # # test-ios-packages, - # # test-android-packages-emulator, - # # test-android-packages-device-farm, - # # test-android-packages-device-farm-sync, - # package-all-artifacts - # ] - # if: | - # always() && - # !cancelled() - # secrets: inherit - # with: - # version-label: ${{ needs.check-cache.outputs.version-label }} - # packages-sha-label: ${{ needs.check-cache.outputs.packages-sha }} \ No newline at end of file + if [[ -z "$gitTag" ]]; then + gitSha=$(git rev-parse HEAD | cut -c1-8) + echo "Building commit: ${{ needs.check-cache.outputs.version-label }} - ${gitSha}" + publishBuild=false + else + if [[ "$gitTag" != "v${{ needs.check-cache.outputs.version-label }}" ]]; then + echo "Git tag '${gitTag}' does not match v${{ needs.check-cache.outputs.version-label }}" + else + echo "Building release: '${gitTag}'" + publishBuild=true + fi + fi + echo "is_publish_build=$publishBuild" >> $GITHUB_OUTPUT + + - name: Print is release build + run: | + echo "Is release build: ${{ steps.outputs.is_publish_build }}" + + + + deploy-release: + uses: ./.github/workflows/include-deploy-release.yml + needs: [ + check-cache, + check-release-build, + # static-analysis, + # integration-tests, + # test-jvm-packages, + # test-macos-packages, + # test-ios-packages, + # test-android-packages-emulator, + # test-android-packages-device-farm, + # test-android-packages-device-farm-sync, + # package-all-artifacts + ] + if: | + always() && + !cancelled() && + !endsWith(needs.check-cache.outputs.version-label, '-SNAPSHOT') && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') && + (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/releases') && + needs.outputs.is_publish_build + + secrets: inherit + with: + version-label: ${{ needs.check-cache.outputs.version-label }} \ No newline at end of file From af88825bf87d6fbd66ba03c3fe5cb0455012e474 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 7 Mar 2024 15:33:36 +0000 Subject: [PATCH 27/36] Missed var --- .github/workflows/pr.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ca5340d317..fdd1566011 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1678,8 +1678,6 @@ jobs: run: | echo "Is release build: ${{ steps.outputs.is_publish_build }}" - - deploy-release: uses: ./.github/workflows/include-deploy-release.yml needs: [ @@ -1706,4 +1704,5 @@ jobs: secrets: inherit with: - version-label: ${{ needs.check-cache.outputs.version-label }} \ No newline at end of file + version-label: ${{ needs.check-cache.outputs.version-label }} + packages-sha-label: ${{ needs.check-cache.outputs.packages-sha }} \ No newline at end of file From 3520357f0acda4e315d0c6b738dd62635675844a Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 7 Mar 2024 15:50:50 +0000 Subject: [PATCH 28/36] Fallback in case no tag is found --- .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 fdd1566011..faac7bb3e6 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1654,7 +1654,7 @@ jobs: - name: Get Git tag run: | - gitTag=$(git describe --tags --exact-match HEAD) + gitTag=$(git describe --tags --exact-match HEAD) || echo "NONE" echo "Git branch/tag: ${GITHUB_REF}/${gitTag:-'none'}" - name: Check if release build From 29ba516f5d36dbb6a1f6e36f0b89f0459e79ad47 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 7 Mar 2024 15:58:15 +0000 Subject: [PATCH 29/36] fixes --- .github/workflows/pr.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index faac7bb3e6..818237961a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1663,16 +1663,17 @@ jobs: if [[ -z "$gitTag" ]]; then gitSha=$(git rev-parse HEAD | cut -c1-8) echo "Building commit: ${{ needs.check-cache.outputs.version-label }} - ${gitSha}" - publishBuild=false + echo "is_publish_build=false" >> $GITHUB_OUTPUT else if [[ "$gitTag" != "v${{ needs.check-cache.outputs.version-label }}" ]]; then echo "Git tag '${gitTag}' does not match v${{ needs.check-cache.outputs.version-label }}" + echo "is_publish_build=false" >> $GITHUB_OUTPUT else echo "Building release: '${gitTag}'" - publishBuild=true + echo "is_publish_build=true" >> $GITHUB_OUTPUT fi fi - echo "is_publish_build=$publishBuild" >> $GITHUB_OUTPUT + - name: Print is release build run: | @@ -1700,7 +1701,7 @@ jobs: !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/releases') && - needs.outputs.is_publish_build + needs.check-release-build.outputs.is_publish_build secrets: inherit with: From 64d7444fb7e41c556cb6acb139dfcab9b031e842 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 7 Mar 2024 16:15:25 +0000 Subject: [PATCH 30/36] fixes --- .github/workflows/pr.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 818237961a..7f7efce97c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1649,6 +1649,9 @@ jobs: check-release-build: runs-on: ubuntu-latest needs: [check-cache] + outputs: + is_publish_build: ${{ steps.check_release.outputs.is_publish_build }} + steps: - uses: actions/checkout@v3 @@ -1677,7 +1680,7 @@ jobs: - name: Print is release build run: | - echo "Is release build: ${{ steps.outputs.is_publish_build }}" + echo "Is release build: ${{ steps.check_release.outputs.is_publish_build }}" deploy-release: uses: ./.github/workflows/include-deploy-release.yml @@ -1696,11 +1699,6 @@ jobs: ] if: | always() && - !cancelled() && - !endsWith(needs.check-cache.outputs.version-label, '-SNAPSHOT') && - !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') && - (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/releases') && needs.check-release-build.outputs.is_publish_build secrets: inherit From 48d0da5f73984f87c8b2b9b53350b5095737f12f Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 7 Mar 2024 16:18:13 +0000 Subject: [PATCH 31/36] Fixes --- .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 7f7efce97c..2fd4a8c44e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1699,7 +1699,7 @@ jobs: ] if: | always() && - needs.check-release-build.outputs.is_publish_build + (needs.check-release-build.outputs.is_publish_build == 'true') secrets: inherit with: From 40107402497c2ac23553d9c178c484440a05cf06 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 7 Mar 2024 16:45:27 +0000 Subject: [PATCH 32/36] un-comment steps --- .github/workflows/pr.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2fd4a8c44e..71d52cdb56 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1687,18 +1687,23 @@ jobs: needs: [ check-cache, check-release-build, - # static-analysis, - # integration-tests, - # test-jvm-packages, - # test-macos-packages, - # test-ios-packages, - # test-android-packages-emulator, + static-analysis, + integration-tests, + test-jvm-packages, + test-macos-packages, + test-ios-packages, + test-android-packages-emulator, # test-android-packages-device-farm, - # test-android-packages-device-farm-sync, - # package-all-artifacts + test-android-packages-device-farm-sync, + package-all-artifacts ] if: | always() && + !cancelled() && + !endsWith(needs.check-cache.outputs.version-label, '-SNAPSHOT') && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') && + (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/releases') && (needs.check-release-build.outputs.is_publish_build == 'true') secrets: inherit From d56884d2436d7d87852dfa3f538903ef077b116f Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 7 Mar 2024 16:46:50 +0000 Subject: [PATCH 33/36] re-enable publishing --- .github/workflows/include-deploy-release.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/include-deploy-release.yml b/.github/workflows/include-deploy-release.yml index 80bf6cddb4..730194e1c9 100644 --- a/.github/workflows/include-deploy-release.yml +++ b/.github/workflows/include-deploy-release.yml @@ -100,13 +100,13 @@ jobs: name: all-packages-${{ inputs.version-label }} path: ./packages/build/m2-buildrepo - # - name: Publish release to Maven Central - # run: | - # set +x - # sh ./tools/publish_release.sh "${{ secrets.MAVEN_CENTRAL_USER_DBG }}" "${{ secrets.MAVEN_CENTRAL_KEY_DBG }}" \ - # "${{ secrets.AWS_S3_ACCESS_KEY_ID }}" "${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}" \ - # "${{ secrets.DOCS_S3_ACCESS_KEY }}" "${{ secrets.DOCS_S3_SECRET_KEY }}" \ - # "${{ secrets.SLACK_URL_RELEASE }}" "${{ secrets.SLACK_URL_CI }}" \ - # "${{ secrets.GRADLE_PORTAL_KEY }}" "${{ secrets.GRADLE_PORTAL_SECRET }}" \ - # '-PsignBuild=true -PsignSecretRingFileKotlin="${{ secrets.GPG_SIGNING_KEY_BASE_64_DBG }}" -PsignPasswordKotlin=${{ secrets.GPG_PASS_PHRASE_DBG }}' + - name: Publish release to Maven Central + run: | + set +x + sh ./tools/publish_release.sh "${{ secrets.MAVEN_CENTRAL_USER_DBG }}" "${{ secrets.MAVEN_CENTRAL_KEY_DBG }}" \ + "${{ secrets.AWS_S3_ACCESS_KEY_ID }}" "${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}" \ + "${{ secrets.DOCS_S3_ACCESS_KEY }}" "${{ secrets.DOCS_S3_SECRET_KEY }}" \ + "${{ secrets.SLACK_URL_RELEASE }}" "${{ secrets.SLACK_URL_CI }}" \ + "${{ secrets.GRADLE_PORTAL_KEY }}" "${{ secrets.GRADLE_PORTAL_SECRET }}" \ + '-PsignBuild=true -PsignSecretRingFileKotlin="${{ secrets.GPG_SIGNING_KEY_BASE_64_DBG }}" -PsignPasswordKotlin=${{ secrets.GPG_PASS_PHRASE_DBG }}' From 852befd9e39800a0cc01817fb1534eef454384c5 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 7 Mar 2024 16:50:12 +0000 Subject: [PATCH 34/36] more cleanup --- .github/workflows/pr.yml | 3 +-- buildSrc/src/main/kotlin/Config.kt | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 71d52cdb56..c84c0fead1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -15,7 +15,6 @@ concurrency: env: REALM_DISABLE_ANALYTICS: true - REALM_PRINT_ANALYTICS: true CMAKE_C_COMPILER: /usr/local/bin/ccache-clang CMAKE_CXX_COMPILER: /usr/local/bin/ccache-clang++ # Workflow environment variables are not available in Job if statements: https://github.com/actions/runner/issues/1661 @@ -1645,7 +1644,7 @@ jobs: with: version-label: ${{ needs.check-cache.outputs.version-label }} - # This job sets an output `publishBuild` to `true` if this is a release build + # This job sets an output `is_publish_build` to `true` if this is a release build check-release-build: runs-on: ubuntu-latest needs: [check-cache] diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index fdad4fbf8c..a9735d8935 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -62,7 +62,7 @@ val HOST_OS: OperatingSystem = findHostOs() object Realm { val ciBuild = (System.getenv("JENKINS_HOME") != null || System.getenv("CI") != null) - const val version = "0.0.1" + const val version = "1.14.0-SNAPSHOT" const val group = "io.realm.kotlin" const val projectUrl = "https://realm.io" const val pluginPortalId = "io.realm.kotlin" From 60ef040da08535c2a8493d68c10a8e5ac9ad5ee9 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 8 Mar 2024 10:23:19 +0000 Subject: [PATCH 35/36] Changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e75747bdec..a150bebb97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,8 +11,9 @@ ### Fixed * Cache notification callback JNI references at startup to ensure that symbols can be resolved in core callbacks. (Issue [#1577](https://github.com/realm/realm-kotlin/issues/1577)) * Using `Realm.asFlow()` could miss an update if a write was started right after opening the Realm. (Issue [#1582](https://github.com/realm/realm-kotlin/issues/1582)) -* Snapshot publishing with Github Action. (Issue [#1654](https://github.com/realm/realm-kotlin/issues/1654) [JIRA](https://jira.mongodb.org/browse/RKOTLIN-1018)) * [Sync] `NullPointerException` while waiting for the synchronization of a subscription set if the client was set in `AwaitingMark` state. (Issue [#1671](https://github.com/realm/realm-kotlin/issues/1671) [JIRA](https://jira.mongodb.org/browse/RKOTLIN-1027)) +* Github Action: Snapshot publishing with Github Action. (Issue [#1654](https://github.com/realm/realm-kotlin/issues/1654) [JIRA](https://jira.mongodb.org/browse/RKOTLIN-1018)) +* Github Action: automate release process to Maven Central. (Issue [JIRA](https://jira.mongodb.org/browse/RKOTLIN-709)) ### Compatibility * File format: Generates Realms with file format v23. From dd7219537d5d361409d1132d06ea6cbe91df2d0e Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 8 Mar 2024 11:31:08 +0000 Subject: [PATCH 36/36] fetching all tags for release job check --- .github/workflows/pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 611f4a4c21..b829a3e7a8 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1657,6 +1657,7 @@ jobs: - name: Get Git tag run: | + git fetch --tags gitTag=$(git describe --tags --exact-match HEAD) || echo "NONE" echo "Git branch/tag: ${GITHUB_REF}/${gitTag:-'none'}"