diff --git a/.github/problem-matchers/detekt.json b/.github/problem-matchers/detekt.json new file mode 100644 index 0000000000..9911b4c1a2 --- /dev/null +++ b/.github/problem-matchers/detekt.json @@ -0,0 +1,17 @@ +{ + "problemMatcher": [ + { + "owner": "detekt", + "severity": "error", + "pattern": [ + { + "regexp": "(.+\\.kt):(\\d+):(\\d+):\\s(.*)", + "file": 1, + "line": 2, + "column": 3, + "message": 4 + } + ] + } + ] +} diff --git a/.github/problem-matchers/kotlin.json b/.github/problem-matchers/kotlin.json new file mode 100644 index 0000000000..a5cdc3ab7c --- /dev/null +++ b/.github/problem-matchers/kotlin.json @@ -0,0 +1,40 @@ +{ + "problemMatcher": [ + { + "owner": "kotlin", + "severity": "error", + "pattern": [ + { + "regexp": "^e\\:\\s(?:(?:(.*):(?:\\s\\()?(\\d+)(?:(?:\\,\\s)|\\:)(\\d+))(?:\\))?\\:\\s)?(.*)$", + "file": 1, + "line": 2, + "column": 3, + "message": 4 + } + ] + }, + { + "owner": "kotlin-warning", + "severity": "warning", + "pattern": [ + { + "regexp": "^w\\:\\s(?:(?:(.*):(?:\\s\\()?(\\d+)(?:(?:\\,\\s)|\\:)(\\d+))(?:\\))?\\:\\s)?(.*)$", + "file": 1, + "line": 2, + "column": 3, + "message": 4 + } + ] + }, + { + "owner": "gradle-warning", + "severity": "warning", + "pattern": [ + { + "regexp": "^WARNING:(.*(?:\\n(?!w|e\\:|>|FAILURE|BUILD SUCCESSFUL).*)*)$", + "message": 1 + } + ] + } + ] +} diff --git a/.github/problem-matchers/ktlint.json b/.github/problem-matchers/ktlint.json new file mode 100644 index 0000000000..924000e815 --- /dev/null +++ b/.github/problem-matchers/ktlint.json @@ -0,0 +1,17 @@ +{ + "problemMatcher": [ + { + "owner": "ktlint", + "severity": "error", + "pattern": [ + { + "regexp": "(.+\\.kt):(\\d+):(\\d+):\\s(.*)", + "file": 1, + "line": 2, + "column": 3, + "message": 4 + } + ] + } + ] +} diff --git a/.github/workflows/auto-merge-branches.yml b/.github/workflows/auto-merge-branches.yml index cd16801f2e..9df6218f79 100644 --- a/.github/workflows/auto-merge-branches.yml +++ b/.github/workflows/auto-merge-branches.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: git checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Set the branch we want to merge changes into as step output. This step should list each branch name found in the `push` # trigger in the top of this file. diff --git a/.github/workflows/include-check-cache.yml b/.github/workflows/include-check-cache.yml index c7bfb275e4..98cb33a9ed 100644 --- a/.github/workflows/include-check-cache.yml +++ b/.github/workflows/include-check-cache.yml @@ -19,68 +19,54 @@ on: workflow_call: outputs: version-label: - value: ${{ jobs.check-cache.outputs.version-label }} + value: ${{ jobs.checksum.outputs.version-label }} + packages-sha: + value: ${{ jobs.checksum.outputs.packages-sha }} + benchmarks-sha: + value: ${{ jobs.checksum.outputs.benchmarks-sha }} + core-commit-sha: + value: ${{ jobs.checksum.outputs.core-commit-sha }} + packages-metadata-cache-hit: - value: ${{ jobs.check-cache.outputs.packages-metadata-cache-hit }} + value: ${{ jobs.metadata-compiler-plugin.outputs.packages-metadata-cache-hit }} packages-jvm-cache-hit: - value: ${{ jobs.check-cache.outputs.packages-jvm-cache-hit }} + value: ${{ jobs.jvm-all.outputs.packages-jvm-cache-hit }} packages-android-cache-hit: - value: ${{ jobs.check-cache.outputs.packages-android-cache-hit }} + value: ${{ jobs.android.outputs.packages-android-cache-hit }} android-test-base-apk-cache-hit: - value: ${{ jobs.check-cache.outputs.android-test-base-apk-cache-hit }} + value: ${{ jobs.android-test-base.outputs.android-test-base-apk-cache-hit }} android-test-sync-apk-cache-hit: - value: ${{ jobs.check-cache.outputs.android-test-sync-apk-cache-hit }} + value: ${{ jobs.android-test-sync.outputs.android-test-sync-apk-cache-hit }} packages-macos-x64-cache-hit: - value: ${{ jobs.check-cache.outputs.packages-macos-x64-cache-hit }} + value: ${{ jobs.macos-x64.outputs.packages-macos-x64-cache-hit }} packages-macos-arm64-cache-hit: - value: ${{ jobs.check-cache.outputs.packages-macos-arm64-cache-hit }} + value: ${{ jobs.macos-arm.outputs.packages-macos-arm64-cache-hit }} packages-ios-x64-cache-hit: - value: ${{ jobs.check-cache.outputs.packages-ios-x64-cache-hit }} + value: ${{ jobs.ios-x64.outputs.packages-ios-x64-cache-hit }} packages-ios-arm64-cache-hit: - value: ${{ jobs.check-cache.outputs.packages-ios-arm64-cache-hit }} + value: ${{ jobs.ios-arm.outputs.packages-ios-arm64-cache-hit }} jni-swig-stub-cache-hit: - value: ${{ jobs.check-cache.outputs.jni-swig-stub-cache-hit }} + value: ${{ jobs.jni-stub.outputs.jni-swig-stub-cache-hit }} jni-linux-lib-cache-hit: - value: ${{ jobs.check-cache.outputs.jni-linux-lib-cache-hit }} + value: ${{ jobs.jni-linux-lib.outputs.jni-linux-lib-cache-hit }} jni-macos-lib-cache-hit: - value: ${{ jobs.check-cache.outputs.jni-macos-lib-cache-hit }} + value: ${{ jobs.jni-macos-lib.outputs.jni-macos-lib-cache-hit }} jni-windows-lib-cache-hit: - value: ${{ jobs.check-cache.outputs.jni-windows-lib-cache-hit }} - packages-sha: - value: ${{ jobs.check-cache.outputs.packages-sha }} - benchmarks-sha: - value: ${{ jobs.check-cache.outputs.benchmarks-sha }} - core-commit-sha: - value: ${{ jobs.check-cache.outputs.core-commit-sha }} + value: ${{ jobs.jni-windows-lib.outputs.jni-windows-lib-cache-hit }} jobs: - check-cache: + checksum: runs-on: ubuntu-latest - name: Check cache - env: - CACHE_SKIP_SAVE: true + name: Cache SHA outputs: version-label: ${{ steps.find-library-version.outputs.label }} - packages-metadata-cache-hit: ${{ steps.kotlin-metadata-cache.outputs.cache-hit }} - packages-jvm-cache-hit: ${{ steps.jvm-cache.outputs.cache-hit }} - packages-android-cache-hit: ${{ steps.android-cache.outputs.cache-hit }} - android-test-base-apk-cache-hit: ${{ steps.android-test-base-apk.outputs.cache-hit }} - android-test-sync-apk-cache-hit: ${{ steps.android-test-sync-apk.outputs.cache-hit }} - packages-macos-x64-cache-hit: ${{ steps.macos-x64-cache.outputs.cache-hit }} - packages-macos-arm64-cache-hit: ${{ steps.macos-arm64-cache.outputs.cache-hit }} - packages-ios-x64-cache-hit: ${{ steps.ios-x64-cache.outputs.cache-hit }} - packages-ios-arm64-cache-hit: ${{ steps.ios-arm64-cache.outputs.cache-hit }} - jni-swig-stub-cache-hit: ${{ steps.jni-swig-stub-cache.outputs.cache-hit }} - jni-linux-lib-cache-hit: ${{ steps.jni-linux-lib-cache.outputs.cache-hit }} - jni-macos-lib-cache-hit: ${{ steps.jni-macos-lib-cache.outputs.cache-hit }} - jni-windows-lib-cache-hit: ${{ steps.jni-windows-lib-cache.outputs.cache-hit }} packages-sha: ${{ steps.packages-cache-key.outputs.sha }} benchmarks-sha: ${{ steps.calculate-benchmarks-cache-key.outputs.sha }} - core-commit-sha: ${{ steps.calculate-core-commmit-sha.outputs.commit }} + core-commit-sha: ${{ steps.calculate-core-versioncommmit-sha.outputs.commit }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" @@ -88,6 +74,7 @@ jobs: id: find-library-version run: | version=$(grep "const val version" buildSrc/src/main/kotlin/Config.kt | cut -d \" -f2) + echo "Label: $version" echo "label=$version" >> $GITHUB_OUTPUT # This also include changes to Realm Core as they are hashed as part of `/packages/external/core` @@ -104,349 +91,341 @@ jobs: working-directory: packages/external/core run: echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - # - # For each specific package we need to perform 3 steps: - # - # 1. Check if a cache is available and download it if it is. - # 2. If (1), store this cache as an artifact for jobs downstream to use. - # 3. Cleanup the build folder. This is required so we can download the next - # platform into a fresh cache location. It does not look possible to download - # a cache into a different location. - # - # TODO There doesn't seem to be a good way to check if a cache key exists without download it. - # https://github.com/actions/cache/issues/321 - # - # TODO Create a custom action for this until we have a work-around? - # - - # - # Kotlin Metadata and Gradle/Compiler Plugin - # + # + # Kotlin Metadata and Gradle/Compiler Plugin + # + metadata-compiler-plugin: + runs-on: ubuntu-latest + name: Metadata & Compiler plugin + needs: checksum + outputs: + packages-metadata-cache-hit: ${{ steps.kotlin-metadata-cache.outputs.cache-hit }} + steps: - name: Check Kotlin Metadata cache id: kotlin-metadata-cache - uses: cmelchior/cache@main + uses: actions/cache@v4 with: path: ./packages/build/m2-buildrepo - key: packages-m2-metadata-${{ steps.packages-cache-key.outputs.sha }} + key: packages-m2-metadata-${{ needs.checksum.outputs.packages-sha }} - name: Save Kotlin Metadata packages - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() && !cancelled() && steps.kotlin-metadata-cache.outputs.cache-hit == 'true' with: - name: packages-metadata-${{ steps.find-library-version.outputs.label }} + name: packages-metadata-${{ needs.checksum.outputs.version-label }} path: ./packages/build/m2-buildrepo/**/* retention-days: 1 - - name: Delete downloaded JVM cache files - id: delete-cache-metadata - uses: JesseTG/rm@v1.0.3 - if: always() && !cancelled() && steps.kotlin-metadata-cache.outputs.cache-hit == 'true' - with: - path: ./packages/build/m2-buildrepo + # + # JVM (All platforms) + # + jvm-all: + runs-on: ubuntu-latest + needs: checksum + name: JVM (All platforms) + outputs: + packages-jvm-cache-hit: ${{ steps.jvm-cache.outputs.cache-hit }} - # - # JVM (All platforms) - # + steps: - name: Check JVM cache id: jvm-cache - uses: cmelchior/cache@main + uses: actions/cache@v4 with: path: ./packages/build/m2-buildrepo - key: packages-m2-jvm-sync-${{ steps.packages-cache-key.outputs.sha }} + key: packages-m2-jvm-sync-${{ needs.checksum.outputs.packages-sha }} - name: Save JVM packages - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() && !cancelled() && steps.jvm-cache.outputs.cache-hit == 'true' with: - name: packages-jvm-${{ steps.find-library-version.outputs.label }} + name: packages-jvm-${{ needs.checksum.outputs.version-label }} path: ./packages/build/m2-buildrepo/**/* retention-days: 1 - - name: Delete downloaded JVM cache files - id: delete-cache-jvm - uses: JesseTG/rm@v1.0.3 - if: always() && !cancelled() && steps.jvm-cache.outputs.cache-hit == 'true' - with: - path: ./packages/build/m2-buildrepo - - # - # JNI Stub (JVM) - # + # + # JNI Stub (JVM) + # + jni-stub: + runs-on: ubuntu-latest + needs: checksum + name: JNI Stub (JVM) + outputs: + jni-swig-stub-cache-hit: ${{ steps.jni-swig-stub-cache.outputs.cache-hit }} + + steps: - name: Check JNI Swig stub cache id: jni-swig-stub-cache - uses: cmelchior/cache@main + uses: actions/cache@v4 with: path: ./packages/jni-swig-stub/build/generated/sources/jni - key: jni-swig-stubs-${{ steps.packages-cache-key.outputs.sha }} + key: jni-swig-stubs-${{ needs.checksum.outputs.packages-sha }} - name: Save JNI Stub packages - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() && !cancelled() && steps.jni-swig-stub-cache.outputs.cache-hit == 'true' with: - name: jni-stub-${{ steps.find-library-version.outputs.label }} + name: jni-stub-${{ needs.checksum.outputs.version-label }} path: ./packages/jni-swig-stub/build/generated/sources/jni/* retention-days: 1 - - name: Delete downloaded JVM cache files - id: delete-cache-jni-stub - uses: JesseTG/rm@v1.0.3 - if: always() && !cancelled() && steps.jni-swig-stub-cache.outputs.cache-hit == 'true' - with: - path: ./packages/jni-swig-stub/build/generated/sources/jni + # + # JNI MacOS Lib + # + jni-macos-lib: + runs-on: ubuntu-latest + needs: checksum + name: JNI MacOS Lib + outputs: + jni-macos-lib-cache-hit: ${{ steps.jni-macos-lib-cache.outputs.cache-hit }} - # - # JNI MacOS Lib - # + steps: - name: Check JNI MacOS lib cache id: jni-macos-lib-cache - uses: cmelchior/cache@main + uses: actions/cache@v4 with: path: ./packages/cinterop/build/realmMacOsBuild - key: jni-macos-lib-${{ steps.packages-cache-key.outputs.sha }} - + key: jni-macos-lib-${{ needs.checksum.outputs.packages-sha }} - name: Save JNI MacOS lib package - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() && !cancelled() && steps.jni-macos-lib-cache.outputs.cache-hit == 'true' with: - name: jni-macos-lib-${{ steps.find-library-version.outputs.label }} + name: jni-macos-lib-${{ needs.checksum.outputs.version-label }} path: ./packages/cinterop/build/realmMacOsBuild/**/* retention-days: 1 - - name: Delete downloaded JVM cache files - id: delete-cache-macos-lib - uses: JesseTG/rm@v1.0.3 - if: always() && !cancelled() && steps.jni-macos-lib-cache.outputs.cache-hit == 'true' - with: - path: ./packages/cinterop/build/realmMacOsBuild + # + # JNI Linux Lib + # + jni-linux-lib: + runs-on: ubuntu-latest + needs: checksum + name: JNI Linux Lib + outputs: + jni-linux-lib-cache-hit: ${{ steps.jni-linux-lib-cache.outputs.cache-hit }} - # - # JNI Linux Lib - # + steps: - name: Check JNI Linux lib cache id: jni-linux-lib-cache - uses: cmelchior/cache@main + uses: actions/cache@v4 with: path: ./packages/cinterop/build/realmLinuxBuild - key: jni-linux-lib-${{ steps.packages-cache-key.outputs.sha }} + key: jni-linux-lib-${{ needs.checksum.outputs.packages-sha }} - name: Save JNI Linux lib package - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() && !cancelled() && steps.jni-linux-lib-cache.outputs.cache-hit == 'true' with: - name: jni-linux-lib-${{ steps.find-library-version.outputs.label }} + name: jni-linux-lib-${{ needs.checksum.outputs.version-label }} path: ./packages/cinterop/build/realmLinuxBuild/**/* retention-days: 1 - - name: Delete downloaded JVM cache files - id: delete-cache-linux-lib - uses: JesseTG/rm@v1.0.3 - if: always() && !cancelled() && steps.jni-linux-lib-cache.outputs.cache-hit == 'true' + # + # JNI Windows Lib + # + jni-windows-lib: + runs-on: ubuntu-latest + needs: checksum + name: JNI Windows Lib + outputs: + jni-windows-lib-cache-hit: ${{ steps.jni-windows-lib-cache.outputs.cache-hit }} + steps: + - name: Check JNI Windows lib cache + id: jni-windows-lib-cache + uses: actions/cache@v4 with: - path: ./packages/cinterop/build/realmLinuxBuild + path: ./packages/cinterop/build/realmWindowsBuild + key: jni-windows-lib-${{ needs.checksum.outputs.packages-sha }} + enableCrossOsArchive: true + + - name: Save JNI Windows lib package + uses: actions/upload-artifact@v4 + if: always() && !cancelled() && steps.jni-windows-lib-cache.outputs.cache-hit == 'true' + with: + name: jni-windows-lib-${{ needs.checksum.outputs.version-label }} + path: ./packages/cinterop/build/realmWindowsBuild/Release/realmc.dll + retention-days: 1 + # + # Android + # + android: + runs-on: ubuntu-latest + needs: checksum + name: Android + outputs: + packages-android-cache-hit: ${{ steps.android-cache.outputs.cache-hit }} - # - # Android - # + steps: - name: Check Android cache id: android-cache - uses: cmelchior/cache@main + uses: actions/cache@v4 with: path: ./packages/build/m2-buildrepo - key: packages-m2-android-sync-${{ steps.packages-cache-key.outputs.sha }} + key: packages-m2-android-sync-${{ needs.checksum.outputs.packages-sha }} - name: Save Android packages - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() && !cancelled() && steps.android-cache.outputs.cache-hit == 'true' with: - name: packages-android-${{ steps.find-library-version.outputs.label }} + name: packages-android-${{ needs.checksum.outputs.version-label }} path: ./packages/build/m2-buildrepo/**/* retention-days: 1 - - name: Delete downloaded Android cache files - id: delete-cache-android - uses: JesseTG/rm@v1.0.3 - if: always() && !cancelled() && steps.android-cache.outputs.cache-hit == 'true' - with: - path: ./packages/build/m2-buildrepo + # + # Android Base Test APK + # + android-test-base: + runs-on: ubuntu-latest + needs: checksum + name: Android Base Test APK + outputs: + android-test-base-apk-cache-hit: ${{ steps.android-test-base-apk.outputs.cache-hit }} - # - # Android Base Test APK - # + steps: - name: Check Android Base Test APK id: android-test-base-apk - uses: cmelchior/cache@main + uses: actions/cache@v4 with: path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk - key: android-base-test-apk-key-${{ steps.packages-cache-key.outputs.sha }} - + key: android-base-test-apk-key-${{ needs.checksum.outputs.packages-sha }} - name: Save Android Base Test APK - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() && !cancelled() && steps.android-test-base-apk.outputs.cache-hit == 'true' with: - name: android-base-test-apk-${{ steps.find-library-version.outputs.label }} + name: android-base-test-apk-${{ needs.checksum.outputs.version-label }} path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk retention-days: 1 - - name: Delete Android Base Test APK cache files - id: delete-cache-android-base-test-apk - uses: JesseTG/rm@v1.0.3 - if: always() && !cancelled() && steps.android-test-base-apk.outputs.cache-hit == 'true' - with: - path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk + # + # Android Sync Test APK + # + android-test-sync: + runs-on: ubuntu-latest + needs: checksum + name: Android Sync Test APK + outputs: + android-test-sync-apk-cache-hit: ${{ steps.android-test-sync-apk.outputs.cache-hit }} - # - # Android Sync Test APK - # + steps: - name: Check Android Sync Test APK id: android-test-sync-apk - uses: cmelchior/cache@main + uses: actions/cache@v4 with: - key: android-sync-test-apk-key-${{ steps.packages-cache-key.outputs.sha }} + key: android-sync-test-apk-key-${{ needs.checksum.outputs.packages-sha }} path: | ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk - name: Save Android Sync Test APK - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() && !cancelled() && steps.android-test-sync-apk.outputs.cache-hit == 'true' with: - name: android-sync-test-apk-${{ steps.find-library-version.outputs.label }} + name: android-sync-test-apk-${{ needs.checksum.outputs.version-label }} retention-days: 1 path: | ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk - - name: Delete Android Sync Test APK cache files - id: delete-cache-android-sync-test-apk - uses: JesseTG/rm@v1.0.3 - if: always() && !cancelled() && steps.android-test-sync-apk.outputs.cache-hit == 'true' - with: - path: | - ./packages/test-sync/build/outputs/apk/androidTest/debug/test-sync-debug-androidTest.apk - ./packages/test-sync/build/outputs/apk/debug/test-sync-debug.apk + # + # MacOS arm64 + # + macos-arm: + runs-on: ubuntu-latest + needs: checksum + name: MacOS arm64 + outputs: + packages-macos-arm64-cache-hit: ${{ steps.macos-arm64-cache.outputs.cache-hit }} - # - # MacOS arm64 - # + steps: - name: Check MacOS arm64 cache id: macos-arm64-cache - uses: cmelchior/cache@main + uses: actions/cache@v4 with: path: ./packages/build/m2-buildrepo - key: packages-m2-macos-arm64-sync-${{ steps.packages-cache-key.outputs.sha }} + key: packages-m2-macos-arm64-sync-${{ needs.checksum.outputs.packages-sha }} - name: Save MacOS arm64 packages - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() && !cancelled() && steps.macos-arm64-cache.outputs.cache-hit == 'true' with: - name: packages-macos-arm64-${{ steps.find-library-version.outputs.label }} + name: packages-macos-arm64-${{ needs.checksum.outputs.version-label }} path: ./packages/build/m2-buildrepo/**/* retention-days: 1 - - name: Delete downloaded MacOS arm64 cache files - id: delete-cache-macos-arm64 - uses: JesseTG/rm@v1.0.3 - if: always() && !cancelled() && steps.macos-arm64-cache.outputs.cache-hit == 'true' - with: - path: ./packages/build/m2-buildrepo + # + # MacOS x64 + # + macos-x64: + runs-on: ubuntu-latest + needs: checksum + name: MacOS x64 + outputs: + packages-macos-x64-cache-hit: ${{ steps.macos-x64-cache.outputs.cache-hit }} - # - # MacOS x64 - # + steps: - name: Check MacOS X64 cache id: macos-x64-cache - uses: cmelchior/cache@main + uses: actions/cache@v4 with: path: ./packages/build/m2-buildrepo - key: packages-m2-macos-x64-sync-${{ steps.packages-cache-key.outputs.sha }} + key: packages-m2-macos-x64-sync-${{ needs.checksum.outputs.packages-sha }} - name: Save MacOS x64 packages - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() && !cancelled() && steps.macos-x64-cache.outputs.cache-hit == 'true' with: - name: packages-macos-x64-${{ steps.find-library-version.outputs.label }} + name: packages-macos-x64-${{ needs.checksum.outputs.version-label }} path: ./packages/build/m2-buildrepo/**/* retention-days: 1 - - name: Delete downloaded MacOS x64 cache files - id: delete-cache-macos-x64 - uses: JesseTG/rm@v1.0.3 - if: always() && !cancelled() && steps.macos-x64-cache.outputs.cache-hit == 'true' - with: - path: ./packages/build/m2-buildrepo - # - # iOS arm64 - # + # + # iOS arm64 + # + ios-arm: + runs-on: ubuntu-latest + needs: checksum + name: iOS arm64 + outputs: + packages-ios-arm64-cache-hit: ${{ steps.ios-arm64-cache.outputs.cache-hit }} + + steps: - name: Check iOS arm64 cache id: ios-arm64-cache - uses: cmelchior/cache@main + uses: actions/cache@v4 with: path: ./packages/build/m2-buildrepo - key: packages-m2-ios-arm64-sync-${{ steps.packages-cache-key.outputs.sha }} + key: packages-m2-ios-arm64-sync-${{ needs.checksum.outputs.packages-sha }} - name: Save iOS arm64 packages - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() && !cancelled() && steps.ios-arm64-cache.outputs.cache-hit == 'true' with: - name: packages-ios-arm64-${{ steps.find-library-version.outputs.label }} + name: packages-ios-arm64-${{ needs.checksum.outputs.version-label }} path: ./packages/build/m2-buildrepo/**/* retention-days: 1 - - name: Delete downloaded iOS arm64 cache files - id: delete-cache-ios-arm64 - uses: JesseTG/rm@v1.0.3 - if: always() && !cancelled() && steps.ios-arm64-cache.outputs.cache-hit == 'true' - with: - path: ./packages/build/m2-buildrepo + # + # iOS x64 + # + ios-x64: + runs-on: ubuntu-latest + needs: checksum + name: iOS x64 + outputs: + packages-ios-x64-cache-hit: ${{ steps.ios-x64-cache.outputs.cache-hit }} - # - # iOS x64 - # + steps: - name: Check iOS X64 cache id: ios-x64-cache - uses: cmelchior/cache@main + uses: actions/cache@v4 with: path: ./packages/build/m2-buildrepo - key: packages-m2-ios-x64-sync-${{ steps.packages-cache-key.outputs.sha }} + key: packages-m2-ios-x64-sync-${{ needs.checksum.outputs.packages-sha }} - name: Save iOS x64 packages - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() && !cancelled() && steps.ios-x64-cache.outputs.cache-hit == 'true' with: - name: packages-ios-x64-${{ steps.find-library-version.outputs.label }} + name: packages-ios-x64-${{ needs.checksum.outputs.version-label }} path: ./packages/build/m2-buildrepo/**/* retention-days: 1 - - - name: Delete downloaded iOS x64 cache files - id: delete-cache-ios-x64 - uses: JesseTG/rm@v1.0.3 - if: always() && !cancelled() && steps.ios-x64-cache.outputs.cache-hit == 'true' - with: - path: ./packages/build/m2-buildrepo - - # - # JNI Windows Lib - # - - name: Check JNI Windows lib cache - id: jni-windows-lib-cache - uses: cmelchior/cache@main - with: - path: ./packages/cinterop/build/realmWindowsBuild - key: jni-windows-lib-${{ steps.packages-cache-key.outputs.sha }} - enableCrossOsArchive: true - - - name: Save JNI Windows lib package - uses: actions/upload-artifact@v3 - if: always() && !cancelled() && steps.jni-windows-lib-cache.outputs.cache-hit == 'true' - with: - name: jni-windows-lib-${{ steps.find-library-version.outputs.label }} - path: ./packages/cinterop/build/realmWindowsBuild/Release/realmc.dll - retention-days: 1 - - - name: Delete downloaded JNI Windows lib cache files - id: delete-cache-windows-lib - uses: JesseTG/rm@v1.0.3 - if: always() && !cancelled() && steps.jni-windows-lib-cache.outputs.cache-hit == 'true' - with: - path: ./packages/cinterop/build/realmWindowsBuild diff --git a/.github/workflows/include-deploy-release.yml b/.github/workflows/include-deploy-release.yml index 4dc1d2d163..7e5bd70819 100644 --- a/.github/workflows/include-deploy-release.yml +++ b/.github/workflows/include-deploy-release.yml @@ -18,33 +18,33 @@ jobs: steps: - name: git checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2 with: cmake-version: ${{ vars.VERSION_CMAKE }} - name: Setup ninja - uses: cmelchior/setup-ninja@master + uses: clementetb/setup-ninja@master with: version: ${{ vars.VERSION_NINJA }} - name: Install ccache - uses: hendrikmuhs/ccache-action@v1.2.2 + uses: hendrikmuhs/ccache-action@v1.2.13 with: key: 'jvm-package' max-size: '2.0G' @@ -71,31 +71,31 @@ jobs: # We cannot use artifacts as they cannot be shared between workflows, so use cache instead. - name: Setup build cache - uses: actions/cache@v3 + uses: actions/cache@v4 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 + uses: actions/download-artifact@v4 with: name: jni-linux-lib-${{ inputs.version-label }} path: ./packages/cinterop/build/realmLinuxBuild - name: Restore Windows JNI lib - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: jni-windows-lib-${{ inputs.version-label }} path: ./packages/cinterop/build/realmWindowsBuild/Release - name: Restore MacOS JNI lib - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: jni-macos-lib-${{ inputs.version-label }} path: ./packages/cinterop/build/realmMacOsBuild - name: Restore m2-buildrepo - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: all-packages-${{ inputs.version-label }} path: ./packages/build/m2-buildrepo diff --git a/.github/workflows/include-deploy-snapshot.yml b/.github/workflows/include-deploy-snapshot.yml index d50f9abbdc..83dbf0fbd3 100644 --- a/.github/workflows/include-deploy-snapshot.yml +++ b/.github/workflows/include-deploy-snapshot.yml @@ -19,12 +19,12 @@ jobs: sudo rm -rf "$AGENT_TOOLSDIRECTORY" - name: git checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} @@ -35,7 +35,7 @@ jobs: version: ${{ vars.VERSION_KOTLIN_COMMANDLINE_TOOLS }} - name: Restore m2-buildrepo - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: all-packages-${{ inputs.version-label }} path: ./packages/build/m2-buildrepo diff --git a/.github/workflows/include-integration-tests.yml b/.github/workflows/include-integration-tests.yml index 6f23b27bbb..2d3349ec8e 100644 --- a/.github/workflows/include-integration-tests.yml +++ b/.github/workflows/include-integration-tests.yml @@ -19,21 +19,21 @@ jobs: # runs-on: macos-12 # steps: # - name: Checkout code - # uses: actions/checkout@v3 + # uses: actions/checkout@v4 # - name: Setup Java 11 - # uses: actions/setup-java@v3 + # uses: actions/setup-java@v4 # with: # distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} # java-version: 11 # - name: Setup Gradle and task/dependency caching - # uses: gradle/gradle-build-action@v2 + # uses: gradle/actions/setup-gradle@v3 # with: # cache-read-only: false # - name: Restore m2-buildrepo - # uses: actions/download-artifact@v3 + # uses: actions/download-artifact@v4 # with: # name: all-packages-${{ needs.check-cache.outputs.version-label }} # path: ./packages/build/m2-buildrepo @@ -60,21 +60,21 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Restore m2-buildrepo - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: all-packages-${{ inputs.version-label }} path: ./packages/build/m2-buildrepo @@ -90,27 +90,27 @@ jobs: runs-on: macos-12 steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Restore m2-buildrepo - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: all-packages-${{ inputs.version-label }} path: ./packages/build/m2-buildrepo # - name: AVD cache - # uses: actions/cache@v3 + # uses: actions/cache@v4 # id: avd-cache # with: # path: | @@ -171,24 +171,24 @@ jobs: build-benchmarks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Restore m2-buildrepo - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: all-packages-${{ inputs.version-label }} path: ./packages/build/m2-buildrepo @@ -213,30 +213,30 @@ jobs: arguments: integrationTest runs-on: macos-12 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Restore m2-buildrepo - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: all-packages-${{ inputs.version-label }} path: ./packages/build/m2-buildrepo # - name: AVD cache - # uses: actions/cache@v3 + # uses: actions/cache@v4 # id: avd-cache # with: # path: | @@ -294,30 +294,30 @@ jobs: arguments: integrationTest runs-on: macos-12 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Java 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: 17 - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Restore m2-buildrepo - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: all-packages-${{ inputs.version-label }} path: ./packages/build/m2-buildrepo # - name: AVD cache - # uses: actions/cache@v3 + # uses: actions/cache@v4 # id: avd-cache # with: # path: | diff --git a/.github/workflows/include-static-analysis.yml b/.github/workflows/include-static-analysis.yml index 4f456ecae0..e30fd81978 100644 --- a/.github/workflows/include-static-analysis.yml +++ b/.github/workflows/include-static-analysis.yml @@ -9,17 +9,21 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" + - name: Register problem matchers + run: |- + echo "::add-matcher::.github/problem-matchers/ktlint.json" + - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false # TODO How to configure caching here? - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.2 with: cmake-version: ${{ vars.VERSION_CMAKE }} @@ -29,9 +33,9 @@ jobs: - name: Run Ktlint run: ./gradlew ktlintCheck + continue-on-error: true - name: Stash Ktlint results - if: always() run: | rm -rf /tmp/ktlint rm -rf /tmp/detekt @@ -45,30 +49,33 @@ jobs: rsync -a --delete --ignore-errors packages/gradle-plugin/build/reports/ktlint/ /tmp/ktlint/plugin-gradle/ || true rsync -a --delete --ignore-errors benchmarks/build/reports/ktlint/ /tmp/ktlint/benchmarks/ || true - - name: Publish Ktlint results - uses: cmelchior/checkstyle-github-action@master - if: always() + - name: Publish Ktlint results + uses: actions/upload-artifact@v4 with: - name: Ktlint Results - title: Ktlint Analyzer report - path: '/tmp/ktlint/**/*.xml' + name: Ktlint Analyzer report + path: /tmp/ktlint/* + retention-days: 1 detekt: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" + - name: Register problem matchers + run: |- + echo "::add-matcher::.github/problem-matchers/detekt.json" + - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false # TODO How to configure caching here? - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2 with: cmake-version: ${{ vars.VERSION_CMAKE }} @@ -78,9 +85,9 @@ jobs: - name: Run Detekt run: ./gradlew detekt + continue-on-error: true - name: Stash Detekt results - if: always() run: | rm -rf /tmp/detekt mkdir /tmp/detekt @@ -93,9 +100,8 @@ jobs: rsync -a --delete --ignore-errors benchmarks/build/reports/detekt/ /tmp/detekt/benchmarks/ || true - name: Publish Detekt results - uses: cmelchior/checkstyle-github-action@master - if: always() + uses: actions/upload-artifact@v4 with: - name: Detekt Results - title: Detekt Analyzer report - path: '/tmp/detekt/**/*.xml' + name: Detekt Analyzer report + path: /tmp/detekt/* + retention-days: 1 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index cf1ec975d8..3cb0346b1d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -37,29 +37,33 @@ jobs: if: always() && !cancelled() && needs.check-cache.outputs.jni-swig-stub-cache-hit != 'true' steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" + - name: Register problem matchers + run: |- + echo "::add-matcher::.github/problem-matchers/kotlin.json" + - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Load build cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./packages/jni-swig-stub/build/generated/sources/jni key: jni-swig-stubs-${{ needs.check-cache.outputs.packages-sha }} - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.2 with: cmake-version: ${{ vars.VERSION_CMAKE }} @@ -80,20 +84,19 @@ jobs: cd ~ curl -L ${{ vars.VERSION_SWIG}} > swig.rb && HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=true brew install swig.rb - - name: Build JNI Stub working-directory: ./packages run: ./gradlew :jni-swig-stub:assemble -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: jni-stub-${{ needs.check-cache.outputs.version-label }} path: ./packages/jni-swig-stub/build/generated/sources/jni/* retention-days: 1 build-jvm-linux-native-lib: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: [check-cache, build-jni-swig-stub] if: | always() && @@ -104,42 +107,40 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" + - name: Register problem matchers + run: |- + echo "::add-matcher::.github/problem-matchers/kotlin.json" + - name: Setup build cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./packages/cinterop/build/realmLinuxBuild key: jni-linux-lib-${{ needs.check-cache.outputs.packages-sha }} + - name: Setup Java 11 + uses: actions/setup-java@v3 + with: + distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} + java-version: ${{ vars.VERSION_JAVA }} + - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.2 with: cmake-version: ${{ vars.VERSION_CMAKE }} - name: Restore JNI Swig Stubs - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: jni-stub-${{ needs.check-cache.outputs.version-label }} path: ./packages/jni-swig-stub/build/generated/sources/jni - - name: Build Docker image - uses: docker/build-push-action@v3 - with: - tags: jvm-native-lib-linux:latest - file: ./packages/cinterop/src/jvmMain/generic.Dockerfile - push: false - - name: Build native lib - uses: addnab/docker-run-action@v3 - with: - image: jvm-native-lib-linux:latest - shell: bash - options: -v ${{ github.workspace }}:/work - run: | - cd /work/packages/cinterop + working-directory: ./packages/cinterop + run: | mkdir build cd build rm -rf realmLinuxBuild @@ -149,11 +150,14 @@ jobs: -DREALM_ENABLE_SYNC=1 \ -DREALM_NO_TESTS=1 \ -DREALM_BUILD_LIB_ONLY=true \ + -DCMAKE_CXX_VISIBILITY_PRESET=hidden \ + -DCMAKE_TOOLCHAIN_FILE=../../../external/core/tools/cmake/x86_64-linux-gnu.toolchain.cmake \ + -DJAVA_INCLUDE_PATH=${{ env.JAVA_HOME }}/include/ \ ../../src/jvm make -j8 - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: jni-linux-lib-${{ needs.check-cache.outputs.version-label }} path: ./packages/cinterop/build/realmLinuxBuild/librealmc.so @@ -171,7 +175,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # TODO See https://github.com/microsoft/vcpkg/issues/25349 which might describe the error here https://github.com/realm/realm-kotlin/runs/8099890473?check_suite_focus=true # -- Building for: Visual Studio 17 2022 @@ -185,19 +189,19 @@ jobs: submodules: "recursive" - name: Setup build cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./packages/cinterop/build/realmWindowsBuild key: jni-windows-lib-${{ needs.check-cache.outputs.packages-sha }} enableCrossOsArchive: true - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.2 with: cmake-version: ${{ vars.VERSION_CMAKE }} - name: Restore JNI Swig Stubs - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: jni-stub-${{ needs.check-cache.outputs.version-label }} path: ${{ github.workspace }}/packages/jni-swig-stub/build/generated/sources/jni @@ -218,11 +222,12 @@ jobs: -DCMAKE_BUILD_TYPE=Release ` -DREALM_ENABLE_SYNC=ON ` -DREALM_NO_TESTS=1 ` + -DCMAKE_CXX_VISIBILITY_PRESET=hidden ` -DVCPKG_TARGET_TRIPLET=x64-windows-static cmake --build . --config Release - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: jni-windows-lib-${{ needs.check-cache.outputs.version-label }} path: ./packages/cinterop/build/realmWindowsBuild/Release/realmc.dll @@ -240,33 +245,33 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.2 with: cmake-version: ${{ vars.VERSION_CMAKE }} - name: Setup ninja - uses: cmelchior/setup-ninja@master + uses: clementetb/setup-ninja@master with: version: ${{ vars.VERSION_NINJA }} - name: Install ccache - uses: hendrikmuhs/ccache-action@v1.2.2 + uses: hendrikmuhs/ccache-action@v1.2.13 with: key: 'jvm-macos-native-lib' max-size: '2.0G' @@ -292,13 +297,13 @@ jobs: # We cannot use artifacts as they cannot be shared between workflows, so use cache instead. - name: Setup build cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./packages/cinterop/build/realmMacOsBuild key: jni-macos-lib-${{ needs.check-cache.outputs.packages-sha }} - name: Restore JNI Swig Stubs - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: jni-stub-${{ needs.check-cache.outputs.version-label }} path: ${{ github.workspace }}/packages/jni-swig-stub/build/generated/sources/jni @@ -307,8 +312,12 @@ jobs: working-directory: packages run: ./gradlew buildJVMSharedLibs -Prealm.kotlin.mainHost=false + - name: Show ccache size + run: | + echo `du -sh ~/.ccache` + - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: jni-macos-lib-${{ needs.check-cache.outputs.version-label }} path: ./packages/cinterop/build/realmMacOsBuild/librealmc.dylib @@ -328,33 +337,37 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" + - name: Register problem matchers + run: |- + echo "::add-matcher::.github/problem-matchers/kotlin.json" + - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.2 with: cmake-version: ${{ vars.VERSION_CMAKE }} - name: Setup ninja - uses: cmelchior/setup-ninja@master + uses: clementetb/setup-ninja@master with: version: ${{ vars.VERSION_NINJA }} - name: Install ccache - uses: hendrikmuhs/ccache-action@v1.2.2 + uses: hendrikmuhs/ccache-action@v1.2.13 with: key: 'metadata-package' max-size: '2.0G' @@ -377,7 +390,7 @@ jobs: ndk-version: r23c - name: Setup build cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./packages/build/m2-buildrepo key: packages-m2-metadata-${{ needs.check-cache.outputs.packages-sha }} @@ -387,7 +400,7 @@ jobs: run: ./gradlew publishCIPackages -Prealm.kotlin.targets=gradlePlugin,compilerPlugin -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=true - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: packages-metadata-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo/**/* @@ -410,33 +423,37 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" + - name: Register problem matchers + run: |- + echo "::add-matcher::.github/problem-matchers/kotlin.json" + - name: Setup Java 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: '17' - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.2 with: cmake-version: ${{ vars.VERSION_CMAKE }} - name: Setup ninja - uses: cmelchior/setup-ninja@master + uses: clementetb/setup-ninja@master with: version: ${{ vars.VERSION_NINJA }} - name: Install ccache - uses: hendrikmuhs/ccache-action@v1.2.2 + uses: hendrikmuhs/ccache-action@v1.2.13 with: key: 'jvm-package' max-size: '2.0G' @@ -463,25 +480,25 @@ jobs: # We cannot use artifacts as they cannot be shared between workflows, so use cache instead. - name: Setup build cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./packages/build/m2-buildrepo key: packages-m2-jvm-sync-${{ needs.check-cache.outputs.packages-sha }} - name: Restore Linux JNI lib - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: jni-linux-lib-${{ needs.check-cache.outputs.version-label }} path: ./packages/cinterop/build/realmLinuxBuild - name: Restore Windows JNI lib - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: jni-windows-lib-${{ needs.check-cache.outputs.version-label }} path: ./packages/cinterop/build/realmWindowsBuild/Release - name: Restore MacOS JNI lib - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: jni-macos-lib-${{ needs.check-cache.outputs.version-label }} path: ./packages/cinterop/build/realmMacOsBuild @@ -490,8 +507,12 @@ jobs: working-directory: packages run: ./gradlew publishCIPackages -Prealm.kotlin.targets=jvm -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.copyNativeJvmLibs=linux,windows,macos -Prealm.kotlin.mainHost=false + - name: Show ccache size + run: | + echo `du -sh ~/.ccache` + - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: packages-jvm-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo/**/* @@ -518,18 +539,18 @@ jobs: sudo rm -rf "$AGENT_TOOLSDIRECTORY" - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false @@ -554,17 +575,17 @@ jobs: run: brew install jq - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.2 with: cmake-version: ${{ vars.VERSION_CMAKE }} - name: Setup ninja - uses: cmelchior/setup-ninja@master + uses: clementetb/setup-ninja@master with: version: ${{ vars.VERSION_NINJA }} - name: Install ccache - uses: hendrikmuhs/ccache-action@v1.2.2 + uses: hendrikmuhs/ccache-action@v1.2.13 with: key: 'android-package' max-size: '2.0G' @@ -599,20 +620,20 @@ jobs: run: ./gradlew publishCIPackages -Prealm.kotlin.targets=android -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false - name: Store build cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./packages/build/m2-buildrepo key: packages-m2-android-sync-${{ needs.check-cache.outputs.packages-sha }} - name: Store build cache for Android Test APK - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk key: android-base-test-apk-key-${{ needs.check-cache.outputs.packages-sha }} # Must match naming found in include-check-cache.yml - name: Store build cache for Android Sync Test APK - uses: actions/cache@v3 + uses: actions/cache@v4 with: key: android-sync-test-apk-key-${{ needs.check-cache.outputs.packages-sha }} path: | @@ -622,21 +643,21 @@ jobs: # Must match naming found in include-check-cache.yml # Must match naming found in include-check-cache.yml - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: packages-android-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo/**/* retention-days: 1 - name: Upload Android Base Test APK - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: android-base-test-apk-${{ needs.check-cache.outputs.version-label }} path: ./packages/test-base/build/outputs/apk/androidTest/debug/test-base-debug-androidTest.apk retention-days: 1 - name: Upload Android Sync Test APK - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: android-sync-test-apk-${{ needs.check-cache.outputs.version-label }} retention-days: 1 @@ -653,33 +674,33 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.2 with: cmake-version: ${{ vars.VERSION_CMAKE }} - name: Setup ninja - uses: cmelchior/setup-ninja@master + uses: clementetb/setup-ninja@master with: version: ${{ vars.VERSION_NINJA }} - name: Install ccache - uses: hendrikmuhs/ccache-action@v1.2.2 + uses: hendrikmuhs/ccache-action@v1.2.13 with: key: 'macos-x64-package' max-size: '2.0G' @@ -702,16 +723,20 @@ jobs: working-directory: packages run: ./gradlew publishCIPackages -Prealm.kotlin.targets=macosX64 -Prealm.kotlin.mainHost=false + - name: Show ccache size + run: | + echo `du -sh ~/.ccache` + # We cannot use artifacts as they cannot be shared between workflows, so use cache instead. - name: Store build cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./packages/build/m2-buildrepo key: packages-m2-macos-x64-sync-${{ needs.check-cache.outputs.packages-sha }} # Must match naming found in include-check-cache.yml - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: packages-macos-x64-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo/**/* @@ -725,33 +750,33 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.2 with: cmake-version: ${{ vars.VERSION_CMAKE }} - name: Setup ninja - uses: cmelchior/setup-ninja@master + uses: clementetb/setup-ninja@master with: version: ${{ vars.VERSION_NINJA }} - name: Install ccache - uses: hendrikmuhs/ccache-action@v1.2.2 + uses: hendrikmuhs/ccache-action@v1.2.13 with: key: 'macos-arm64-package' max-size: '2.0G' @@ -775,14 +800,14 @@ jobs: run: ./gradlew publishCIPackages -Prealm.kotlin.targets=macosArm64 -Prealm.kotlin.mainHost=false - name: Store build cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./packages/build/m2-buildrepo key: packages-m2-macos-arm64-sync-${{ needs.check-cache.outputs.packages-sha }} # Must match naming found in include-check-cache.yml - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: packages-macos-arm64-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo/**/* @@ -796,33 +821,33 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.2 with: cmake-version: ${{ vars.VERSION_CMAKE }} - name: Setup ninja - uses: cmelchior/setup-ninja@master + uses: clementetb/setup-ninja@master with: version: ${{ vars.VERSION_NINJA }} - name: Install ccache - uses: hendrikmuhs/ccache-action@v1.2.2 + uses: hendrikmuhs/ccache-action@v1.2.13 with: key: 'ios-x64-package' max-size: '2.0G' @@ -847,14 +872,14 @@ jobs: # We cannot use artifacts as they cannot be shared between workflows, so use cache instead. - name: Store build cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./packages/build/m2-buildrepo key: packages-m2-ios-x64-sync-${{ needs.check-cache.outputs.packages-sha }} # Must match naming found in include-check-cache.yml - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: packages-ios-x64-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo/**/* @@ -868,33 +893,33 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.2 with: cmake-version: ${{ vars.VERSION_CMAKE }} - name: Setup ninja - uses: cmelchior/setup-ninja@master + uses: clementetb/setup-ninja@master with: version: ${{ vars.VERSION_NINJA }} - name: Install ccache - uses: hendrikmuhs/ccache-action@v1.2.2 + uses: hendrikmuhs/ccache-action@v1.2.13 with: key: 'ios-arm64-package' max-size: '2.0G' @@ -919,14 +944,14 @@ jobs: # We cannot use artifacts as they cannot be shared between workflows, so use cache instead. - name: Store build cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./packages/build/m2-buildrepo key: packages-m2-ios-arm64-sync-${{ needs.check-cache.outputs.packages-sha }} # Must match naming found in include-check-cache.yml - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: packages-ios-arm64-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo/**/* @@ -962,7 +987,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" @@ -988,30 +1013,30 @@ jobs: echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Restore Kotlin metadata artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 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 + uses: actions/download-artifact@v4 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 + uses: actions/download-artifact@v4 with: name: packages-jvm-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo @@ -1048,7 +1073,7 @@ jobs: 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 + uses: actions/upload-artifact@v4 if: always() || failure() with: name: logcat-${{ matrix.type }}-emulator.txt @@ -1091,16 +1116,16 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Restore Android Test APK - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 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 + uses: aws-actions/configure-aws-credentials@v4 with: aws-access-key-id: ${{ secrets.AWS_DEVICEFARM_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_DEVICEFARM_SECRET_ACCESS_KEY }} @@ -1125,10 +1150,12 @@ jobs: always() && !cancelled() && !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') + !contains(needs.*.result, 'cancelled') && + endsWith(needs.check-cache.outputs.version-label, '-SNAPSHOT') && + (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/releases' || github.ref == 'refs/heads/release/k2') steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # checkout BAAS CLI repo - name: Checkout BAAS repo @@ -1148,13 +1175,13 @@ jobs: echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Restore Android Sync Test APK - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 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 + uses: aws-actions/configure-aws-credentials@v4 with: aws-access-key-id: ${{ secrets.AWS_DEVICEFARM_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_DEVICEFARM_SECRET_ACCESS_KEY }} @@ -1232,7 +1259,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # checkout BAAS CLI repo - name: Checkout BAAS repo @@ -1256,24 +1283,24 @@ jobs: echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Restore m2-buildrepo - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 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 + uses: actions/download-artifact@v4 with: name: packages-metadata-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo @@ -1361,7 +1388,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # checkout BAAS CLI repo - name: Checkout BAAS repo @@ -1385,24 +1412,24 @@ jobs: echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Restore m2-buildrepo (ios) - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 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 + uses: actions/download-artifact@v4 with: name: packages-metadata-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo @@ -1503,7 +1530,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # checkout BAAS CLI repo - name: Checkout BAAS repo @@ -1527,24 +1554,24 @@ jobs: echo "baas_container_id=$OUTPUT" >> $GITHUB_OUTPUT - name: Setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} java-version: ${{ vars.VERSION_JAVA }} - name: Setup Gradle and task/dependency caching - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: false - name: Restore Kotlin metadata artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: packages-metadata-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo - name: Restore m2-buildrepo - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: packages-jvm-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo @@ -1602,54 +1629,54 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # The Metadata artifact contain broken JVM publications, so it needs to be # restored first, it so they can be overidden with the correct ones. - name: Restore Kotlin metadata artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: packages-metadata-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo - name: Restore Android artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: packages-android-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo - name: Restore JVM artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: packages-jvm-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo - name: Restore MacOS x64 artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: packages-macos-x64-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo - name: Restore MacOS arm64 artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: packages-macos-arm64-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo - name: Restore iOS x64 artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: packages-ios-x64-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo - name: Restore iOS arm64 artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: packages-ios-arm64-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo - name: Upload artifacts bundle - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: all-packages-${{ needs.check-cache.outputs.version-label }} path: ./packages/build/m2-buildrepo @@ -1700,7 +1727,7 @@ jobs: is_publish_build: ${{ steps.check_release.outputs.is_publish_build }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check if release build id: check_release @@ -1755,4 +1782,4 @@ jobs: secrets: inherit with: version-label: ${{ needs.check-cache.outputs.version-label }} - packages-sha-label: ${{ needs.check-cache.outputs.packages-sha }} + packages-sha-label: ${{ needs.check-cache.outputs.packages-sha }} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b68f8a560..fb7be35513 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ - None. ### Enhancements -- None. +- Avoid exporting Core's symbols so we can statically build the Kotlin SDK with other SDKs like Swift in the same project. (Issue [JIRA](https://jira.mongodb.org/browse/RKOTLIN-877)). +- Improved mechanism for unpacking of JVM native libs suitable for local development. (Issue [#1715](https://github.com/realm/realm-kotlin/issues/1715) [JIRA](https://jira.mongodb.org/browse/RKOTLIN-1065)). ### Fixed - None. @@ -37,6 +38,7 @@ * None. ### Fixed +* Fix crashes when core tries to log invalid utf-8 messages. (Issue [#1760](https://github.com/realm/realm-kotlin/issues/1760) [RKOTLIN-1089](https://jira.mongodb.org/browse/RKOTLIN-1089)). * [Sync] Fatal sync exceptions are now thrown as `UnrecoverableSyncException`. (Issue [#1767](https://github.com/realm/realm-kotlin/issues/1767) [RKOTLIN-1096](https://jira.mongodb.org/browse/RKOTLIN-1096)). * [Sync] Fix `NullPointerException` in `SubscriptionSet.waitForSynchronization`. (Issue [#1777](https://github.com/realm/realm-kotlin/issues/1777) [RKOTLIN-1102](https://jira.mongodb.org/browse/RKOTLIN-1102)). @@ -58,6 +60,7 @@ ### Internal - None. + ## 2.0.0 (2024-06-03) > [!NOTE] diff --git a/buildSrc/src/main/kotlin/realm-lint.gradle.kts b/buildSrc/src/main/kotlin/realm-lint.gradle.kts index aed516a6ac..3020dfc01a 100644 --- a/buildSrc/src/main/kotlin/realm-lint.gradle.kts +++ b/buildSrc/src/main/kotlin/realm-lint.gradle.kts @@ -66,6 +66,7 @@ allprojects { "!src/**/generated/**", "!src/**/resources/**", "--reporter=plain", + "--reporter=html,output=${project.buildDir}/reports/ktlint/ktlint.html", "--reporter=checkstyle,output=${project.buildDir}/reports/ktlint/ktlint.xml", "--editorconfig=${configDir}/ktlint/.editorconfig" ) diff --git a/packages/cinterop/build.gradle.kts b/packages/cinterop/build.gradle.kts index 6a0c7e1817..32a61dd7ca 100644 --- a/packages/cinterop/build.gradle.kts +++ b/packages/cinterop/build.gradle.kts @@ -494,6 +494,10 @@ fun getSharedCMakeFlags(buildType: BuildType, ccache: Boolean = true): Array> /etc/ssh/ssh_config && \ - ssh-keyscan github.com >> /etc/ssh/ssh_known_hosts - diff --git a/packages/cinterop/src/jvmMain/kotlin/io/realm/kotlin/jvm/SoLoader.kt b/packages/cinterop/src/jvmMain/kotlin/io/realm/kotlin/jvm/SoLoader.kt index 2bf019be67..e30197adf4 100644 --- a/packages/cinterop/src/jvmMain/kotlin/io/realm/kotlin/jvm/SoLoader.kt +++ b/packages/cinterop/src/jvmMain/kotlin/io/realm/kotlin/jvm/SoLoader.kt @@ -61,7 +61,7 @@ class SoLoader { // path should be /io.realm.kotlin/libraryVersion]/librealmffi.so // if the full path exists then load it otherwise unpack and load it. val libraryInstallationLocation: File = defaultAbsolutePath(libraryName) - if (!libraryInstallationLocation.exists()) { + if (!libraryInstallationLocation.exists() || SDK_VERSION.endsWith("-SNAPSHOT", ignoreCase = true)) { unpackAndInstall(libraryName, libraryInstallationLocation) } @Suppress("UnsafeDynamicallyLoadedCode") diff --git a/packages/jni-swig-stub/src/main/jni/realm_api_helpers.cpp b/packages/jni-swig-stub/src/main/jni/realm_api_helpers.cpp index a112cf6d1a..bd4ad3a654 100644 --- a/packages/jni-swig-stub/src/main/jni/realm_api_helpers.cpp +++ b/packages/jni-swig-stub/src/main/jni/realm_api_helpers.cpp @@ -984,7 +984,15 @@ realm_set_log_callback([](void *userdata, const char *category, realm_log_level_ "(SLjava/lang/String;Ljava/lang/String;)V"); push_local_frame(jenv, 2); - jenv->CallVoidMethod(log_callback, log_method, java_level, to_jstring(jenv, category), to_jstring(jenv, message)); + jstring j_message = NULL; + try { + j_message = to_jstring(jenv, message); + } catch (RuntimeError exception) { + std::ostringstream ret; + ret << "Invalid data: " << exception.reason(); + j_message = to_jstring(jenv, ret.str()); + } + jenv->CallVoidMethod(log_callback, log_method, java_level, to_jstring(jenv, category), j_message); jni_check_exception(jenv); jenv->PopLocalFrame(NULL); }, diff --git a/packages/test-sync/build.gradle.kts b/packages/test-sync/build.gradle.kts index a374182607..2067ca0332 100644 --- a/packages/test-sync/build.gradle.kts +++ b/packages/test-sync/build.gradle.kts @@ -103,6 +103,8 @@ kotlin { implementation("io.ktor:ktor-client-content-negotiation:${Versions.ktor}") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.serialization}") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.serialization}") + implementation("com.squareup.okio:okio:${Versions.okio}") } } diff --git a/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/AppAdmin.kt b/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/AppAdmin.kt index aa2b6e00d0..e15939520e 100644 --- a/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/AppAdmin.kt +++ b/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/AppAdmin.kt @@ -18,9 +18,7 @@ package io.realm.kotlin.test.mongodb.util import io.realm.kotlin.mongodb.sync.SyncMode import io.realm.kotlin.mongodb.sync.SyncSession -import kotlinx.coroutines.delay import kotlinx.serialization.json.JsonObject -import kotlin.time.Duration.Companion.seconds /** * Wrapper around App Services Server Admin functions needed for tests. @@ -103,11 +101,6 @@ interface AppAdmin { */ suspend fun deleteDocuments(database: String, clazz: String, query: String): JsonObject? - /** - * Wait for Sync bootstrap to complete for all model classes. - */ - suspend fun waitForSyncBootstrap() - fun closeClient() } @@ -208,20 +201,6 @@ class AppAdminImpl( app.deleteDocument(database, clazz, query) } - override suspend fun waitForSyncBootstrap() { - baasClient.run { - val limit = 300 - var i = 0 - while (!app.initialSyncComplete() && i < limit) { - delay(1.seconds) - i++ - } - if (!app.initialSyncComplete()) { - throw IllegalStateException("Test server did not finish bootstrapping sync in time: $limit s.") - } - } - } - override fun closeClient() { baasClient.closeClient() } diff --git a/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/AppServicesClient.kt b/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/AppServicesClient.kt index 42abc29833..8e8212d284 100644 --- a/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/AppServicesClient.kt +++ b/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/AppServicesClient.kt @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@file:Suppress("invisible_member", "invisible_reference") package io.realm.kotlin.test.mongodb.util @@ -45,6 +44,7 @@ import io.realm.kotlin.test.mongodb.SyncServerConfig import io.realm.kotlin.test.mongodb.TEST_APP_CLUSTER_NAME import io.realm.kotlin.types.BaseRealmObject import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.delay import kotlinx.coroutines.withContext import kotlinx.coroutines.withTimeout import kotlinx.serialization.ExperimentalSerializationApi @@ -73,72 +73,20 @@ import kotlinx.serialization.json.put import kotlinx.serialization.serializer import kotlin.reflect.KClass import kotlin.time.Duration.Companion.minutes +import kotlin.time.Duration.Companion.seconds private const val ADMIN_PATH = "/api/admin/v3.0" private const val PRIVATE_PATH = "/api/private/v1.0" -@OptIn(ExperimentalSerializationApi::class) -private val json = Json { - classDiscriminatorMode = ClassDiscriminatorMode.NONE - encodeDefaults = true -} - data class SyncPermissions( val read: Boolean, val write: Boolean ) -@Serializable -data class LoginResponse(val access_token: String) - -@Serializable -data class Profile(val roles: List) - -@Serializable -data class Role(val role_name: String, val group_id: String? = null) - -@Serializable -data class AuthProvider constructor( - val _id: String, - val type: String, - val disabled: Boolean = false, - @Transient val app: BaasApp? = null -) - -@Serializable -data class Service( - val _id: String, - val name: String, - val type: String, - @Transient val app: BaasApp? = null -) - -@Serializable -data class Function( - val _id: String? = null, - val name: String, - val source: String? = null, - @SerialName("run_as_system") val runAsSystem: Boolean? = null, - val private: Boolean? = null, - @SerialName("can_evaluate") val canEvaluate: JsonObject? = null -) - -@Serializable -data class BaasApp( - val _id: String, - @SerialName("client_app_id") val clientAppId: String, - val name: String, - @SerialName("domain_id") val domainId: String, - @SerialName("group_id") val groupId: String, - - @Transient private val _client: AppServicesClient? = null -) { - val client: AppServicesClient - get() = _client ?: TODO("App should be copy'ed with _client set to the AppServicesClient that retrieved it") - val url: String - get() = client.baseUrl + ADMIN_PATH + "/groups/${this.groupId}/apps/${this._id}" - val privateUrl: String - get() = client.baseUrl + PRIVATE_PATH + "/groups/${this.groupId}/apps/${this._id}" +@OptIn(ExperimentalSerializationApi::class) +private val json = Json { + classDiscriminatorMode = ClassDiscriminatorMode.NONE + encodeDefaults = true } @Serializable @@ -338,6 +286,59 @@ fun PropertyType.toSchemaType() = else -> throw IllegalArgumentException("Unsupported type") } +@Serializable +data class LoginResponse(val access_token: String) + +@Serializable +data class Profile(val roles: List) + +@Serializable +data class Role(val role_name: String, val group_id: String? = null) + +@Serializable +data class AuthProvider constructor( + val _id: String, + val type: String, + val disabled: Boolean = false, + @Transient val app: BaasApp? = null +) + +@Serializable +data class Service( + val _id: String, + val name: String, + val type: String, + @Transient val app: BaasApp? = null +) + +@Serializable +data class Function( + val _id: String? = null, + val name: String, + val source: String? = null, + @SerialName("run_as_system") val runAsSystem: Boolean? = null, + val private: Boolean? = null, + @SerialName("can_evaluate") val canEvaluate: JsonObject? = null +) + +@Serializable +data class BaasApp( + val _id: String, + @SerialName("client_app_id") val clientAppId: String, + val name: String, + @SerialName("domain_id") val domainId: String, + @SerialName("group_id") val groupId: String, + + @Transient private val _client: AppServicesClient? = null +) { + val client: AppServicesClient + get() = _client ?: TODO("App should be copy'ed with _client set to the AppServicesClient that retrieved it") + val url: String + get() = client.baseUrl + ADMIN_PATH + "/groups/${this.groupId}/apps/${this._id}" + val privateUrl: String + get() = client.baseUrl + PRIVATE_PATH + "/groups/${this.groupId}/apps/${this._id}" +} + /** * Client to interact with App Services Server. It allows to create Applications and tweak their * configurations. @@ -390,18 +391,6 @@ class AppServicesClient( } } - suspend fun BaasApp.toggleFeatures(features: Set, enable: Boolean) { - withContext(dispatcher) { - httpClient.typedRequest( - Post, - "$privateUrl/features" - ) { - setBody(Json.parseToJsonElement("""{ "action": "${if (enable) "enable" else "disable"}", "feature_flags": [ ${features.joinToString { "\"$it\"" }} ] }""")) - contentType(ContentType.Application.Json) - } - } - } - suspend fun BaasApp.setSchema( schema: Set>, extraProperties: Map = emptyMap() @@ -450,17 +439,6 @@ class AppServicesClient( } } - suspend fun BaasApp.addFunction(function: Function): Function = - withContext(dispatcher) { - httpClient.typedRequest( - Post, - "$url/functions" - ) { - setBody(function) - contentType(ContentType.Application.Json) - } - } - suspend fun BaasApp.waitForSchemaVersion(expectedVersion: Int) { return withTimeout(1.minutes) { withContext(dispatcher) { @@ -494,7 +472,7 @@ class AppServicesClient( suspend fun BaasApp.updateSchema( id: String, schema: Schema, - bypassServiceChange: Boolean = false, + bypassServiceChange: Boolean = false ): HttpResponse = withContext(dispatcher) { httpClient.request( @@ -506,6 +484,31 @@ class AppServicesClient( } } + val BaasApp.url: String + get() = "$groupUrl/apps/${this._id}" + suspend fun BaasApp.toggleFeatures(features: Set, enable: Boolean) { + withContext(dispatcher) { + httpClient.typedRequest( + Post, + "$privateUrl/features" + ) { + setBody(Json.parseToJsonElement("""{ "action": "${if (enable) "enable" else "disable"}", "feature_flags": [ ${features.joinToString { "\"$it\"" }} ] }""")) + contentType(ContentType.Application.Json) + } + } + } + + suspend fun BaasApp.addFunction(function: Function): Function = + withContext(dispatcher) { + httpClient.typedRequest( + Post, + "$url/functions" + ) { + setBody(function) + contentType(ContentType.Application.Json) + } + } + suspend fun BaasApp.addSchema(schema: Schema): String = withContext(dispatcher) { httpClient.typedRequest( @@ -856,6 +859,14 @@ class AppServicesClient( ) } + suspend fun BaasApp.waitUntilInitialSyncCompletes() { + withTimeout(5.minutes) { + while (!initialSyncComplete()) { + delay(1.seconds) + } + } + } + suspend fun BaasApp.initialSyncComplete(): Boolean { return withContext(dispatcher) { try { @@ -863,7 +874,6 @@ class AppServicesClient( Get, "$url/sync/progress" ).let { obj: JsonObject -> - println(obj) obj["accepting_clients"]?.jsonPrimitive?.boolean ?: false } } catch (ex: IllegalStateException) { @@ -948,6 +958,7 @@ class AppServicesClient( val httpClient = defaultClient("realm-baas-authorized", debug) { expectSuccess = true + defaultRequest { headers { append("Authorization", "Bearer $accessToken") diff --git a/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/SchemaProcessor.kt b/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/SchemaProcessor.kt index 1e8b9fc8ae..9cc9b17bf6 100644 --- a/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/SchemaProcessor.kt +++ b/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/SchemaProcessor.kt @@ -1,3 +1,18 @@ +/* + * Copyright 2024 Realm Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ @file:Suppress("invisible_member", "invisible_reference") package io.realm.kotlin.test.mongodb.util @@ -11,7 +26,6 @@ import io.realm.kotlin.schema.RealmClassKind import io.realm.kotlin.types.BaseRealmObject import kotlin.reflect.KClass -// TODO REname methods and classes class SchemaProcessor private constructor( classes: Set>, private val databaseName: String, @@ -50,11 +64,32 @@ class SchemaProcessor private constructor( val processedRelationships: MutableMap> = mutableMapOf() init { - // TODO CHECK embedded CYCLES + checkCycles() generateSchemas() generateRelationships() } + private fun checkCycles() { + realmSchemas.values.filter { + it.kind == RealmClassKind.EMBEDDED + }.forEach { schema -> + checkCycles(schema) + } + } + + private fun checkCycles(schema: RealmClassImpl, visited: Array = emptyArray()) { + if (visited.contains(schema.cinteropClass.name)) + throw IllegalStateException("Cycles in embedded object schemas are not supported") + + schema.cinteropProperties + .filter { targetSchema -> + targetSchema.type == PropertyType.RLM_PROPERTY_TYPE_OBJECT + } + .forEach { targetSchema -> + checkCycles(realmSchemas[targetSchema.linkTarget]!!, visited + schema.name) + } + } + private fun generateRelationships() { processedSchemas.values.forEach { schema -> processedRelationships[schema.title] = diff --git a/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/TestAppInitializer.kt b/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/TestAppInitializer.kt index 3064bf410c..0a5d25d3c9 100644 --- a/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/TestAppInitializer.kt +++ b/packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/TestAppInitializer.kt @@ -20,7 +20,6 @@ import io.realm.kotlin.test.mongodb.TEST_APP_FLEX import io.realm.kotlin.test.mongodb.TEST_APP_PARTITION import io.realm.kotlin.test.mongodb.common.FLEXIBLE_SYNC_SCHEMA import io.realm.kotlin.test.mongodb.common.PARTITION_BASED_SCHEMA -import kotlinx.coroutines.delay import kotlinx.serialization.json.Json interface AppInitializer { @@ -110,10 +109,6 @@ open class BaseAppInitializer( with(client) { block?.invoke(this, app) } - - while (!app.initialSyncComplete()) { - delay(500) - } } } } @@ -140,7 +135,7 @@ object DefaultFlexibleSyncAppInitializer : @Suppress("LongMethod") suspend fun AppServicesClient.initializeFlexibleSync( app: BaasApp, - recoveryDisabled: Boolean = false, + recoveryDisabled: Boolean = false, // TODO ) { val databaseName = app.clientAppId @@ -168,12 +163,13 @@ suspend fun AppServicesClient.initializeFlexibleSync( } """.trimIndent() ) + app.waitUntilInitialSyncCompletes() } @Suppress("LongMethod") suspend fun AppServicesClient.initializePartitionSync( app: BaasApp, - recoveryDisabled: Boolean = false, + recoveryDisabled: Boolean = false, // TODO ) { val databaseName = app.clientAppId @@ -182,7 +178,9 @@ suspend fun AppServicesClient.initializePartitionSync( app.setSchema( schema = PARTITION_BASED_SCHEMA, - extraProperties = mapOf("realm_id" to PrimitivePropertyType.Type.STRING) + extraProperties = mapOf( + "realm_id" to PrimitivePropertyType.Type.STRING + ) ) app.mongodbService.setSyncConfig( @@ -222,6 +220,8 @@ suspend fun AppServicesClient.initializePartitionSync( } """.trimIndent() ) + + app.waitUntilInitialSyncCompletes() } suspend fun AppServicesClient.addEmailProvider( diff --git a/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/SchemaProcessorTests.kt b/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/SchemaProcessorTests.kt new file mode 100644 index 0000000000..f7b19a18f7 --- /dev/null +++ b/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/SchemaProcessorTests.kt @@ -0,0 +1,70 @@ +/* + * Copyright 2024 Realm Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.realm.kotlin.test.mongodb.common + +import io.realm.kotlin.test.mongodb.common.utils.assertFailsWithMessage +import io.realm.kotlin.test.mongodb.util.SchemaProcessor +import io.realm.kotlin.types.EmbeddedRealmObject +import kotlin.test.Test + +class CycleEmbeddedObject1 : EmbeddedRealmObject { + var name: String = "" + var o1: CycleEmbeddedObject2 = CycleEmbeddedObject2() +} + +class CycleEmbeddedObject2 : EmbeddedRealmObject { + var name: String = "" + var o1: CycleEmbeddedObject3 = CycleEmbeddedObject3() +} + +class CycleEmbeddedObject3 : EmbeddedRealmObject { + var name: String = "" + var o1: CycleEmbeddedObject1 = CycleEmbeddedObject1() +} + +class NoCycleEmbeddedObject1 : EmbeddedRealmObject { + var name: String = "" + var o1: NoCycleEmbeddedObject2 = NoCycleEmbeddedObject2() +} + +class NoCycleEmbeddedObject2 : EmbeddedRealmObject { + var name: String = "" +} + +class SchemaProcessorTests { + + @Test + fun cyclesThrow() { + assertFailsWithMessage("Cycles in embedded object schemas are not supported") { + SchemaProcessor.process( + "", + classes = setOf( + CycleEmbeddedObject1::class, + CycleEmbeddedObject2::class, + CycleEmbeddedObject3::class + ) + ) + } + } + + @Test + fun noCyclesDoesntThrow() { + SchemaProcessor.process( + "", + classes = setOf(NoCycleEmbeddedObject1::class, NoCycleEmbeddedObject2::class) + ) + } +} diff --git a/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/SyncSchemaMigrationTests.kt b/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/SyncSchemaMigrationTests.kt index b507200cf7..472f489e64 100644 --- a/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/SyncSchemaMigrationTests.kt +++ b/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/SyncSchemaMigrationTests.kt @@ -139,7 +139,13 @@ class SyncSchemaMigrationTests { .build() private val SyncConfiguration.isSyncMigrationPending: Boolean - get() = (this as SyncConfigurationImpl).isSyncMigrationPending(configPtr) + // get() = true + get() { + (this as SyncConfigurationImpl) + + val configPtr = this.createNativeConfiguration() + return this.isSyncMigrationPending(configPtr) + } @BeforeTest fun setup() { diff --git a/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/SyncedRealmTests.kt b/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/SyncedRealmTests.kt index 0cc452e6cf..6755835db8 100644 --- a/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/SyncedRealmTests.kt +++ b/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/SyncedRealmTests.kt @@ -767,19 +767,13 @@ class SyncedRealmTests { } ).let { config -> Realm.open(config).use { realm -> - println("download changes") realm.syncSession.downloadAllServerChanges(10.seconds) - println("downloaded changes") val flow = realm.query("_id = $0", parentId).asFlow() val parent = withTimeout(10.seconds) { - println("get object") - val x = flow.first { + flow.first { it.list.size >= 1 }.list[0] - println("x") - x } - println("get parent") parent.let { val value = it.value!!.asDictionary() assertEquals(RealmAny.Companion.create(1), value["primitive"]) @@ -1585,18 +1579,10 @@ class SyncedRealmTests { // key of the objects from asset-pbs.realm will not be unique on secondary runs. @Test fun initialRealm_partitionBasedSync() { - // Delete any document from previous runs - with(app.asTestApp) { - runBlocking { - deleteDocuments(clientAppId, ParentPk::class.simpleName!!, "{}") - } - } - val (email, password) = randomEmail() to "password1234" val user = runBlocking { app.createUserAndLogIn(email, password) } - val config1 = createPartitionSyncConfig( user = user, partitionValue = partitionValue, name = "db1", errorHandler = object : SyncSession.ErrorHandler {