diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2b4e709cd3..962350571e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -914,258 +914,258 @@ 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: + # 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 @@ -1287,7 +1287,7 @@ jobs: fi - test-ios-packages: + # test-ios-packages: timeout-minutes: 60 strategy: fail-fast: false @@ -1409,7 +1409,7 @@ jobs: bash cli.sh stop ${{ steps.baas_cli_start.outputs.baas_container_id }} fi - test-jvm-packages: + # test-jvm-packages: timeout-minutes: 60 strategy: fail-fast: false @@ -1607,7 +1607,7 @@ jobs: path: ./packages/build/m2-buildrepo retention-days: 7 - integration-tests: + # integration-tests: uses: ./.github/workflows/include-integration-tests.yml needs: [check-cache, package-all-artifacts] if: | @@ -1622,23 +1622,18 @@ jobs: 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, + # 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, + # 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') + always() secrets: inherit with: