From cb87b57c79c1a51632de7f3f2b95b496259dcd6b Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Sat, 10 Jan 2026 11:25:51 +0100 Subject: [PATCH 1/9] ci: run Harness in CI --- .github/workflows/ci.yml | 138 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 137 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03d1868..4483aa7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,17 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +env: + # Android emulator configuration + ANDROID_API_LEVEL: '35' + ANDROID_ARCH: 'x86_64' + ANDROID_PROFILE: 'pixel_6' + ANDROID_AVD_NAME: 'Pixel_8_API_35' + # iOS simulator configuration + IOS_DEVICE_MODEL: 'iPhone 16 Pro' + IOS_VERSION: '18.2' + XCODE_VERSION: '16.3' + jobs: lint: runs-on: ubuntu-latest @@ -102,11 +113,17 @@ jobs: run: | yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" + - name: Upload Android APK + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: android-apk + path: example/android/app/build/outputs/apk/debug/app-debug.apk + retention-days: 1 + build-ios: runs-on: macos-latest env: - XCODE_VERSION: 16.3 TURBO_CACHE_DIR: .turbo/ios RCT_USE_RN_DEP: 1 RCT_USE_PREBUILT_RNCORE: 1 @@ -151,3 +168,122 @@ jobs: - name: Build example for iOS run: | yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" + + - name: Upload iOS App + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: ios-app + path: example/ios/build/Build/Products/Debug-iphonesimulator/WebworkerExample.app + retention-days: 1 + + harness-android: + name: Harness Android + needs: build-android + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: Setup + uses: ./.github/actions/setup + + - name: Reclaim disk space + uses: AdityaGarg8/remove-unwanted-software@v5 + with: + remove-dotnet: true + remove-haskell: true + remove-codeql: true + remove-docker-images: true + + - name: Download Android APK + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: android-apk + path: example/android/app/build/outputs/apk/debug + + - name: Enable KVM group perms + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + ls /dev/kvm + + - name: AVD cache + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-${{ env.ANDROID_API_LEVEL }}-${{ env.ANDROID_ARCH }} + + - name: Create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ env.ANDROID_API_LEVEL }} + arch: ${{ env.ANDROID_ARCH }} + profile: ${{ env.ANDROID_PROFILE }} + disk-size: 1G + heap-size: 1G + force-avd-creation: false + avd-name: ${{ env.ANDROID_AVD_NAME }} + disable-animations: true + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + script: echo "Generated AVD snapshot for caching." + + - name: Run Harness E2E tests + uses: reactivecircus/android-emulator-runner@v2 + with: + working-directory: example + api-level: ${{ env.ANDROID_API_LEVEL }} + arch: ${{ env.ANDROID_ARCH }} + force-avd-creation: false + avd-name: ${{ env.ANDROID_AVD_NAME }} + disable-animations: true + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + script: | + adb install -r "./android/app/build/outputs/apk/debug/app-debug.apk" + yarn test:harness:android + + harness-ios: + name: Harness iOS + needs: build-ios + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: Setup + uses: ./.github/actions/setup + + - name: Use appropriate Xcode version + uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0 + with: + xcode-version: ${{ env.XCODE_VERSION }} + + - name: Download iOS App + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: ios-app + path: example/ios/build/Build/Products/Debug-iphonesimulator + + - name: Setup iOS Simulator + uses: futureware-tech/simulator-action@v4 + with: + model: ${{ env.IOS_DEVICE_MODEL }} + os: iOS + os_version: ${{ env.IOS_VERSION }} + wait_for_boot: true + erase_before_boot: false + + - name: Install app on simulator + run: | + xcrun simctl install booted example/ios/build/Build/Products/Debug-iphonesimulator/WebworkerExample.app + + - name: Run Harness E2E tests + working-directory: example + run: | + yarn test:harness:ios From 716b180008b488bb962296037708573c3c1b7dbc Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Sat, 10 Jan 2026 11:28:20 +0100 Subject: [PATCH 2/9] ci: tweak retention policy --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4483aa7..21b4c18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,7 +118,7 @@ jobs: with: name: android-apk path: example/android/app/build/outputs/apk/debug/app-debug.apk - retention-days: 1 + retention-days: 7 # Match cache default retention policy build-ios: runs-on: macos-latest @@ -174,10 +174,9 @@ jobs: with: name: ios-app path: example/ios/build/Build/Products/Debug-iphonesimulator/WebworkerExample.app - retention-days: 1 + retention-days: 7 # Match cache default retention policy harness-android: - name: Harness Android needs: build-android runs-on: ubuntu-latest @@ -248,7 +247,6 @@ jobs: yarn test:harness:android harness-ios: - name: Harness iOS needs: build-ios runs-on: macos-latest From 7bb06cbdd97fc20430ad86161bb85bf147dc5dcc Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Sat, 10 Jan 2026 11:38:45 +0100 Subject: [PATCH 3/9] ci: adjust build scripts --- example/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/package.json b/example/package.json index ea8a870..f55b0f0 100644 --- a/example/package.json +++ b/example/package.json @@ -6,8 +6,8 @@ "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", - "build:android": "react-native build-android --extra-params \"--no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a\"", - "build:ios": "react-native build-ios --mode Debug", + "build:android": "react-native build-android --tasks assembleDebug --extra-params \"--no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a\"", + "build:ios": "react-native build-ios --mode Debug --buildFolder ios/build", "test:harness:ios": "react-native-harness --harnessRunner ios", "test:harness:android": "react-native-harness --harnessRunner android" }, From d77725ab3d3e69472a4f9c3370d05d42d2bcf89b Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Sat, 10 Jan 2026 12:10:12 +0100 Subject: [PATCH 4/9] fix: buildFolder argument --- example/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/package.json b/example/package.json index f55b0f0..11fd833 100644 --- a/example/package.json +++ b/example/package.json @@ -7,7 +7,7 @@ "ios": "react-native run-ios", "start": "react-native start", "build:android": "react-native build-android --tasks assembleDebug --extra-params \"--no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a\"", - "build:ios": "react-native build-ios --mode Debug --buildFolder ios/build", + "build:ios": "react-native build-ios --mode Debug --buildFolder build", "test:harness:ios": "react-native-harness --harnessRunner ios", "test:harness:android": "react-native-harness --harnessRunner android" }, From 3088a95f17024d2657d61e38b9a66b6408c0fb4b Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Sat, 10 Jan 2026 12:11:51 +0100 Subject: [PATCH 5/9] fix: set correct arch --- example/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/package.json b/example/package.json index 11fd833..210a7a5 100644 --- a/example/package.json +++ b/example/package.json @@ -6,7 +6,7 @@ "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", - "build:android": "react-native build-android --tasks assembleDebug --extra-params \"--no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a\"", + "build:android": "react-native build-android --tasks assembleDebug --extra-params \"--no-daemon --console=plain -PreactNativeArchitectures=x86_64\"", "build:ios": "react-native build-ios --mode Debug --buildFolder build", "test:harness:ios": "react-native-harness --harnessRunner ios", "test:harness:android": "react-native-harness --harnessRunner android" From fc075386e8c4baea3c2ba5332f475b9f76d4ff85 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Sat, 10 Jan 2026 12:22:36 +0100 Subject: [PATCH 6/9] ci: adjust config --- .github/workflows/ci.yml | 2 +- example/rn-harness.config.mjs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21b4c18..c6e2559 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ env: ANDROID_PROFILE: 'pixel_6' ANDROID_AVD_NAME: 'Pixel_8_API_35' # iOS simulator configuration - IOS_DEVICE_MODEL: 'iPhone 16 Pro' + IOS_DEVICE_MODEL: 'iPhone 17 Pro' IOS_VERSION: '18.2' XCODE_VERSION: '16.3' diff --git a/example/rn-harness.config.mjs b/example/rn-harness.config.mjs index 27988d4..05c6cb8 100644 --- a/example/rn-harness.config.mjs +++ b/example/rn-harness.config.mjs @@ -14,7 +14,7 @@ const config = { runners: [ androidPlatform({ name: 'android', - device: androidEmulator('Pixel_8_API_33', { + device: androidEmulator('Pixel_8_API_35', { apiLevel: 35, profile: 'pixel_6', diskSize: '1G', @@ -24,7 +24,7 @@ const config = { }), applePlatform({ name: 'ios', - device: appleSimulator('iPhone 16 Pro', '26.0'), + device: appleSimulator('iPhone 17 Pro', '18.2'), bundleId: 'webworker.example', }), ], From 4d4717b7810468e3a4aeeb5084245aa8e1b3dae4 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Sat, 10 Jan 2026 13:44:57 +0100 Subject: [PATCH 7/9] ci: turn off build caching --- .github/workflows/ci.yml | 49 ++++------------------------------------ 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6e2559..f3c00be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,9 +58,6 @@ jobs: build-android: runs-on: ubuntu-latest - env: - TURBO_CACHE_DIR: .turbo/android - steps: - name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 @@ -68,36 +65,17 @@ jobs: - name: Setup uses: ./.github/actions/setup - - name: Cache turborepo for Android - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: ${{ env.TURBO_CACHE_DIR }} - key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }} - restore-keys: | - ${{ runner.os }}-turborepo-android- - - - name: Check turborepo cache for Android - run: | - TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status") - - if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then - echo "turbo_cache_hit=1" >> $GITHUB_ENV - fi - - name: Install JDK - if: env.turbo_cache_hit != 1 uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 with: distribution: 'zulu' java-version: '17' - name: Finalize Android SDK - if: env.turbo_cache_hit != 1 run: | /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" - name: Cache Gradle - if: env.turbo_cache_hit != 1 uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 with: path: | @@ -108,10 +86,10 @@ jobs: ${{ runner.os }}-gradle- - name: Build example for Android + working-directory: example env: JAVA_OPTS: "-XX:MaxHeapSize=6g" - run: | - yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" + run: yarn build:android - name: Upload Android APK uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 @@ -124,7 +102,6 @@ jobs: runs-on: macos-latest env: - TURBO_CACHE_DIR: .turbo/ios RCT_USE_RN_DEP: 1 RCT_USE_PREBUILT_RNCORE: 1 @@ -135,30 +112,12 @@ jobs: - name: Setup uses: ./.github/actions/setup - - name: Cache turborepo for iOS - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: ${{ env.TURBO_CACHE_DIR }} - key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }} - restore-keys: | - ${{ runner.os }}-turborepo-ios- - - - name: Check turborepo cache for iOS - run: | - TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status") - - if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then - echo "turbo_cache_hit=1" >> $GITHUB_ENV - fi - - name: Use appropriate Xcode version - if: env.turbo_cache_hit != 1 uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0 with: xcode-version: ${{ env.XCODE_VERSION }} - name: Install cocoapods - if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true' run: | cd example bundle install @@ -166,8 +125,8 @@ jobs: bundle exec pod install --project-directory=ios - name: Build example for iOS - run: | - yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" + working-directory: example + run: yarn build:ios - name: Upload iOS App uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 From 8a6e52042357656ec300ca0d4132e5262fef1b83 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Sat, 10 Jan 2026 13:57:48 +0100 Subject: [PATCH 8/9] ci: tweak iOS --- .github/workflows/ci.yml | 4 ++-- example/rn-harness.config.mjs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3c00be..54c1429 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,8 +22,8 @@ env: ANDROID_AVD_NAME: 'Pixel_8_API_35' # iOS simulator configuration IOS_DEVICE_MODEL: 'iPhone 17 Pro' - IOS_VERSION: '18.2' - XCODE_VERSION: '16.3' + IOS_VERSION: '26.0' + XCODE_VERSION: '26.1.1' jobs: lint: diff --git a/example/rn-harness.config.mjs b/example/rn-harness.config.mjs index 05c6cb8..3ffa9f9 100644 --- a/example/rn-harness.config.mjs +++ b/example/rn-harness.config.mjs @@ -24,7 +24,7 @@ const config = { }), applePlatform({ name: 'ios', - device: appleSimulator('iPhone 17 Pro', '18.2'), + device: appleSimulator('iPhone 17 Pro', '26.0'), bundleId: 'webworker.example', }), ], From 473e77ccfe301a2fdfbf39293bcb6677bc8eee3b Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Sat, 10 Jan 2026 15:56:33 +0100 Subject: [PATCH 9/9] ci: refactor workflow to use turbo --- .github/workflows/ci.yml | 170 ++++++++++++++++++++------------------- turbo.json | 41 +++++++++- 2 files changed, 127 insertions(+), 84 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54c1429..c5e98f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,9 +55,12 @@ jobs: - name: Build package run: yarn prepare - build-android: + harness-android: runs-on: ubuntu-latest + env: + TURBO_CACHE_DIR: .turbo/android + steps: - name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 @@ -65,17 +68,51 @@ jobs: - name: Setup uses: ./.github/actions/setup + - name: Cache turborepo for Android + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: ${{ env.TURBO_CACHE_DIR }} + key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-turborepo-android- + + - name: Check turborepo cache status + run: | + # Check if harness tests can be skipped entirely + HARNESS_CACHE_STATUS=$(node -p "($(yarn turbo run test:harness:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'test:harness:android').cache.status") + if [[ $HARNESS_CACHE_STATUS == "HIT" ]]; then + echo "harness_cache_hit=1" >> $GITHUB_ENV + fi + + # Check if native build can be skipped (to avoid installing JDK/Gradle) + BUILD_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status") + if [[ $BUILD_CACHE_STATUS == "HIT" ]]; then + echo "build_cache_hit=1" >> $GITHUB_ENV + fi + + - name: Reclaim disk space + if: env.harness_cache_hit != 1 + uses: AdityaGarg8/remove-unwanted-software@v5 + with: + remove-dotnet: true + remove-haskell: true + remove-codeql: true + remove-docker-images: true + - name: Install JDK + if: env.harness_cache_hit != 1 && env.build_cache_hit != 1 uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 with: distribution: 'zulu' java-version: '17' - name: Finalize Android SDK + if: env.harness_cache_hit != 1 && env.build_cache_hit != 1 run: | /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" - name: Cache Gradle + if: env.harness_cache_hit != 1 && env.build_cache_hit != 1 uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 with: path: | @@ -86,81 +123,14 @@ jobs: ${{ runner.os }}-gradle- - name: Build example for Android - working-directory: example + if: env.harness_cache_hit != 1 env: JAVA_OPTS: "-XX:MaxHeapSize=6g" - run: yarn build:android - - - name: Upload Android APK - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: android-apk - path: example/android/app/build/outputs/apk/debug/app-debug.apk - retention-days: 7 # Match cache default retention policy - - build-ios: - runs-on: macos-latest - - env: - RCT_USE_RN_DEP: 1 - RCT_USE_PREBUILT_RNCORE: 1 - - steps: - - name: Checkout - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - - name: Setup - uses: ./.github/actions/setup - - - name: Use appropriate Xcode version - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0 - with: - xcode-version: ${{ env.XCODE_VERSION }} - - - name: Install cocoapods run: | - cd example - bundle install - bundle exec pod repo update --verbose - bundle exec pod install --project-directory=ios - - - name: Build example for iOS - working-directory: example - run: yarn build:ios - - - name: Upload iOS App - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: ios-app - path: example/ios/build/Build/Products/Debug-iphonesimulator/WebworkerExample.app - retention-days: 7 # Match cache default retention policy - - harness-android: - needs: build-android - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - - name: Setup - uses: ./.github/actions/setup - - - name: Reclaim disk space - uses: AdityaGarg8/remove-unwanted-software@v5 - with: - remove-dotnet: true - remove-haskell: true - remove-codeql: true - remove-docker-images: true - - - name: Download Android APK - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 - with: - name: android-apk - path: example/android/app/build/outputs/apk/debug + yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" - name: Enable KVM group perms + if: env.harness_cache_hit != 1 run: | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules sudo udevadm control --reload-rules @@ -168,6 +138,7 @@ jobs: ls /dev/kvm - name: AVD cache + if: env.harness_cache_hit != 1 uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 id: avd-cache with: @@ -177,7 +148,7 @@ jobs: key: avd-${{ env.ANDROID_API_LEVEL }}-${{ env.ANDROID_ARCH }} - name: Create AVD and generate snapshot for caching - if: steps.avd-cache.outputs.cache-hit != 'true' + if: env.harness_cache_hit != 1 && steps.avd-cache.outputs.cache-hit != 'true' uses: reactivecircus/android-emulator-runner@v2 with: api-level: ${{ env.ANDROID_API_LEVEL }} @@ -192,6 +163,7 @@ jobs: script: echo "Generated AVD snapshot for caching." - name: Run Harness E2E tests + if: env.harness_cache_hit != 1 uses: reactivecircus/android-emulator-runner@v2 with: working-directory: example @@ -203,12 +175,16 @@ jobs: emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none script: | adb install -r "./android/app/build/outputs/apk/debug/app-debug.apk" - yarn test:harness:android + yarn turbo run test:harness:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" harness-ios: - needs: build-ios runs-on: macos-latest + env: + TURBO_CACHE_DIR: .turbo/ios + RCT_USE_RN_DEP: 1 + RCT_USE_PREBUILT_RNCORE: 1 + steps: - name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 @@ -216,18 +192,49 @@ jobs: - name: Setup uses: ./.github/actions/setup + - name: Cache turborepo for iOS + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: ${{ env.TURBO_CACHE_DIR }} + key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-turborepo-ios- + + - name: Check turborepo cache status + run: | + # Check if harness tests can be skipped entirely + HARNESS_CACHE_STATUS=$(node -p "($(yarn turbo run test:harness:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'test:harness:ios').cache.status") + if [[ $HARNESS_CACHE_STATUS == "HIT" ]]; then + echo "harness_cache_hit=1" >> $GITHUB_ENV + fi + + # Check if native build can be skipped (to avoid installing Xcode/CocoaPods) + BUILD_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status") + if [[ $BUILD_CACHE_STATUS == "HIT" ]]; then + echo "build_cache_hit=1" >> $GITHUB_ENV + fi + - name: Use appropriate Xcode version + if: env.harness_cache_hit != 1 && env.build_cache_hit != 1 uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0 with: xcode-version: ${{ env.XCODE_VERSION }} - - name: Download iOS App - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 - with: - name: ios-app - path: example/ios/build/Build/Products/Debug-iphonesimulator + - name: Install cocoapods + if: env.harness_cache_hit != 1 && env.build_cache_hit != 1 + run: | + cd example + bundle install + bundle exec pod repo update --verbose + bundle exec pod install --project-directory=ios + + - name: Build example for iOS + if: env.harness_cache_hit != 1 + run: | + yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" - name: Setup iOS Simulator + if: env.harness_cache_hit != 1 uses: futureware-tech/simulator-action@v4 with: model: ${{ env.IOS_DEVICE_MODEL }} @@ -237,10 +244,11 @@ jobs: erase_before_boot: false - name: Install app on simulator + if: env.harness_cache_hit != 1 run: | xcrun simctl install booted example/ios/build/Build/Products/Debug-iphonesimulator/WebworkerExample.app - name: Run Harness E2E tests - working-directory: example + if: env.harness_cache_hit != 1 run: | - yarn test:harness:ios + yarn turbo run test:harness:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" diff --git a/turbo.json b/turbo.json index 8b2bf08..35ba962 100644 --- a/turbo.json +++ b/turbo.json @@ -7,17 +7,16 @@ "env": ["ANDROID_HOME", "ORG_GRADLE_PROJECT_newArchEnabled"], "inputs": [ "package.json", + "cpp", "android", "!android/build", - "src/*.ts", - "src/*.tsx", "example/package.json", "example/android", "!example/android/.gradle", "!example/android/build", "!example/android/app/build" ], - "outputs": [] + "outputs": ["example/android/app/build/outputs/apk/debug/app-debug.apk"] }, "build:ios": { "env": [ @@ -28,11 +27,47 @@ ], "inputs": [ "package.json", + "cpp", + "*.podspec", + "ios", + "example/package.json", + "example/ios", + "!example/ios/build", + "!example/ios/Pods" + ], + "outputs": [ + "example/ios/build/Build/Products/Debug-iphonesimulator/WebworkerExample.app/**" + ] + }, + "test:harness:android": { + "dependsOn": ["build:android"], + "inputs": [ + "package.json", + "cpp", + "android", + "!android/build", + "src/*.ts", + "src/*.tsx", + "example/package.json", + "example/src", + "example/android", + "!example/android/.gradle", + "!example/android/build", + "!example/android/app/build" + ], + "outputs": [] + }, + "test:harness:ios": { + "dependsOn": ["build:ios"], + "inputs": [ + "package.json", + "cpp", "*.podspec", "ios", "src/*.ts", "src/*.tsx", "example/package.json", + "example/src", "example/ios", "!example/ios/build", "!example/ios/Pods"