Update: ci.yml #1274
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [master, beta] | |
| pull_request: | |
| branches: [master, beta] | |
| workflow_dispatch: | |
| jobs: | |
| cancel_previous: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: styfle/cancel-workflow-action@0.12.1 | |
| with: | |
| workflow_id: ${{ github.event.workflow.id }} | |
| build-and-test: | |
| needs: cancel_previous | |
| runs-on: 'ubuntu-latest' | |
| env: | |
| YARN_ENABLE_HARDENED_MODE: 0 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Workaround for corepack enable in node | |
| # Source: (https://github.com/actions/setup-node/issues/899#issuecomment-1828798029) | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - run: corepack enable | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: yarn | |
| # End workaround | |
| - name: Install | |
| run: yarn install --immutable | |
| - name: Build | |
| run: yarn build | |
| - name: Lint | |
| run: yarn lint | |
| - name: Test | |
| run: yarn test --coverage | |
| run-e2e-ios: | |
| runs-on: 'macos-15' | |
| env: | |
| YARN_ENABLE_HARDENED_MODE: 0 | |
| steps: | |
| - uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: '16.4' | |
| - name: Install applesimutils | |
| run: | | |
| HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null | |
| HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils >/dev/null | |
| - uses: actions/checkout@v4 | |
| # Workaround for corepack enable in node | |
| # Source: (https://github.com/actions/setup-node/issues/899#issuecomment-1828798029) | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - run: corepack enable | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: yarn | |
| # End workaround | |
| - name: Bootstrap (NO_FLIPPER) | |
| run: | | |
| yarn install | |
| yarn e2e install | |
| cd examples/E2E/ios | |
| rm -rf Pods Podfile.lock | |
| NO_FLIPPER=1 pod install --repo-update | |
| - name: Bundle Build | |
| run: yarn build | |
| - name: Detox - Build | |
| run: | | |
| RCT_NO_LAUNCH_PACKAGER=1 \ | |
| EXCLUDED_ARCHS=x86_64 \ | |
| ONLY_ACTIVE_ARCH=YES \ | |
| yarn e2e build:ios | |
| - name: Detox - Test | |
| run: yarn e2e test:ios | |
| run-e2e-android: | |
| runs-on: 'macos-15-intel' # This is important, linux cannot run the emulator graphically for e2e tests | |
| strategy: | |
| matrix: | |
| api-level: [30] | |
| profile: ['pixel_3a'] | |
| env: | |
| YARN_ENABLE_HARDENED_MODE: 0 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| cache: 'gradle' | |
| - name: Gradle cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} | |
| # - name: AVD cache | |
| # uses: actions/cache@v4 | |
| # id: avd-cache | |
| # with: | |
| # path: | | |
| # ~/.android/avd/* | |
| # ~/.android/adb* | |
| # key: avd-${{ matrix.api-level }}-${{matrix.profile}} | |
| # - 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: ${{ matrix.api-level }} | |
| # profile: ${{matrix.profile}} | |
| # avd-name: Pixel_3a_API_30 | |
| # target: default | |
| # force-avd-creation: false | |
| # emulator-options: > | |
| # -no-window | |
| # -gpu swiftshader_indirect | |
| # -noaudio | |
| # -no-boot-anim | |
| # -camera-back none | |
| # -accel off | |
| # disable-animations: false | |
| # script: echo "Generated AVD snapshot for caching." | |
| # Workaround for corepack enable in node | |
| # Source: (https://github.com/actions/setup-node/issues/899#issuecomment-1828798029) | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - run: corepack enable | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: yarn | |
| # End workaround | |
| - name: Bootstrap | |
| run: yarn install && yarn e2e install # No need to run bootstrap here since we don't need cocoapods | |
| - name: Bundle build | |
| run: yarn build | |
| - name: Detox - Build | |
| run: RCT_NO_LAUNCH_PACKAGER=1 yarn e2e build:android | |
| - name: Detox - Test | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| profile: ${{matrix.profile}} | |
| avd-name: Pixel_3a_API_30 | |
| target: google_apis | |
| force-avd-creation: true | |
| emulator-boot-timeout: 900 | |
| emulator-options: > | |
| -no-window | |
| -gpu swiftshader_indirect | |
| -noaudio | |
| -no-boot-anim | |
| -camera-back none | |
| -wipe-data | |
| -no-snapshot-load | |
| -no-snapshot-save | |
| disable-animations: true | |
| script: | | |
| echo "Waiting for Android framework services..." | |
| adb wait-for-device | |
| echo "Waiting for package service..." | |
| adb shell 'until service list | grep -q package; do sleep 2; done' | |
| echo "Waiting for settings service..." | |
| adb shell 'until service list | grep -q settings; do sleep 2; done' | |
| echo "Disabling animations (best effort)..." | |
| adb shell settings put global window_animation_scale 0 || true | |
| adb shell settings put global transition_animation_scale 0 || true | |
| adb shell settings put global animator_duration_scale 0 || true | |
| yarn e2e test:android |