chore: enable web e2e on ci #1745
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: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| merge_group: | |
| types: | |
| - checks_requested | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| android: ${{ steps.filter.outputs.android }} | |
| ios: ${{ steps.filter.outputs.ios }} | |
| web: ${{ steps.filter.outputs.web }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Check file changes | |
| uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| android: | |
| - 'android/**' | |
| - 'apps/example/android/**' | |
| - 'src/**' | |
| - 'cpp/**' | |
| - 'package.json' | |
| - 'apps/example/package.json' | |
| - 'react-native.config.js' | |
| - 'babel.config.js' | |
| ios: | |
| - 'ios/**' | |
| - 'apps/example/ios/**' | |
| - 'src/**' | |
| - 'cpp/**' | |
| - '*.podspec' | |
| - 'package.json' | |
| - 'apps/example/package.json' | |
| - 'react-native.config.js' | |
| - 'babel.config.js' | |
| web: | |
| - 'src/**' | |
| - 'apps/example-web/src/**' | |
| - 'package.json' | |
| - 'apps/example-web/package.json' | |
| - 'apps/example-web/vite.config.ts' | |
| - 'apps/example-web/index.html' | |
| - '.playwright/**' | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Run ESLint (JS/TS check) | |
| run: yarn lint | |
| - name: Typecheck files | |
| run: yarn typecheck | |
| - name: Run clang-format (C/C++ check) | |
| run: yarn lint-clang | |
| - name: Run android lint (Kotlin/Java/Groovy check) | |
| run: yarn lint:android | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Run unit tests | |
| run: yarn test --maxWorkers=2 --coverage | |
| test-e2e-web: | |
| needs: [changes] | |
| if: needs.changes.outputs.web == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-playwright- | |
| - name: Install Playwright browsers | |
| run: yarn playwright install --with-deps chromium | |
| - name: Run web e2e tests | |
| run: yarn playwright test --config .playwright/playwright.config.ts | |
| - name: Upload Playwright report | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: .playwright/playwright-report/ | |
| retention-days: 7 | |
| build-library: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Build package | |
| run: yarn prepare | |
| build-web: | |
| needs: [changes] | |
| if: needs.changes.outputs.web == 'true' | |
| runs-on: ubuntu-latest | |
| env: | |
| TURBO_CACHE_DIR: .turbo/web | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Cache turborepo for Web | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.TURBO_CACHE_DIR }} | |
| key: ${{ runner.os }}-turborepo-web-${{ hashFiles('yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-turborepo-web- | |
| - name: Check turborepo cache for Web | |
| run: | | |
| TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:web --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:web').cache.status") | |
| if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then | |
| echo "turbo_cache_hit=1" >> $GITHUB_ENV | |
| fi | |
| - name: Build example for Web | |
| run: | | |
| yarn turbo run build:web --cache-dir="${{ env.TURBO_CACHE_DIR }}" | |
| build-android: | |
| needs: [changes] | |
| if: needs.changes.outputs.android == 'true' | |
| runs-on: ubuntu-latest | |
| env: | |
| TURBO_CACHE_DIR: .turbo/android | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Cache turborepo for Android | |
| uses: actions/cache@v4 | |
| 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@v4 | |
| 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@v4 | |
| with: | |
| path: | | |
| ~/.gradle/wrapper | |
| ~/.gradle/caches | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('apps/example/android/gradle/wrapper/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Build example for Android | |
| env: | |
| JAVA_OPTS: '-XX:MaxHeapSize=6g' | |
| run: | | |
| yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" | |
| build-ios: | |
| needs: [changes] | |
| if: needs.changes.outputs.ios == 'true' | |
| runs-on: macos-latest | |
| env: | |
| TURBO_CACHE_DIR: .turbo/ios | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Set up Xcode | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: '16.4' | |
| - name: Reset build folder and pods | |
| run: rm -rf apps/example/build apps/example/ios/Pods apps/example/ios/Podfile.lock | |
| - name: Cache turborepo for iOS | |
| uses: actions/cache@v4 | |
| 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: Restore cocoapods | |
| if: env.turbo_cache_hit != 1 | |
| id: cocoapods-cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| **/ios/Pods | |
| key: ${{ runner.os }}-cocoapods-${{ hashFiles('apps/example/ios/Podfile.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cocoapods- | |
| - name: Install cocoapods | |
| if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true' | |
| run: | | |
| cd apps/example/ios | |
| pod install | |
| env: | |
| NO_FLIPPER: 1 | |
| - name: Cache cocoapods | |
| if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| **/ios/Pods | |
| key: ${{ steps.cocoapods-cache.outputs.cache-key }} | |
| - name: Build example for iOS | |
| run: | | |
| yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" |