chore(🐙): factorize android emulator creation step #2065
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 | |
| - next | |
| pull_request: | |
| branches: | |
| - main | |
| - next | |
| merge_group: | |
| types: | |
| - checks_requested | |
| concurrency: | |
| group: ${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| - run: pip install cpplint | |
| - run: cpplint --linelength=230 --filter=-legal/copyright,-whitespace/indent,-whitespace/comments,-whitespace/ending_newline,-build/include_order,-runtime/references,-readability/todo,-whitespace/blank_line,-whitespace/todo,-runtime/int,-build/c++11,-whitespace/parens --exclude=package/cpp/skia --exclude=package/apple --exclude=package/android/build --exclude=package/node_modules --recursive package | |
| - name: Install clang-format | |
| run: sudo apt-get update && sudo apt-get install -y clang-format-18 | |
| # - name: Clang Format Check | |
| # working-directory: packages/skia | |
| # run: | | |
| # yarn clang-format | |
| # if [[ `git status --porcelain` ]]; then | |
| # echo "ERROR: clang-format would modify files. Please run 'yarn clang-format' and commit the changes." | |
| # echo "Files that would be modified:" | |
| # git status --porcelain | |
| # echo "Diff of changes:" | |
| # git diff | |
| # exit 1 | |
| # fi | |
| - name: Lint files | |
| run: yarn lint | |
| - name: Typecheck files | |
| run: yarn tsc | |
| test: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Test | |
| run: yarn test | |
| build-library: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| run_id: ${{ github.run_id }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build package | |
| run: yarn build | |
| - name: Pack package | |
| working-directory: packages/skia | |
| run: yarn pack | |
| - name: Upload package artifact | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: package-tgz | |
| path: packages/skia/package.tgz | |
| - name: Build dry run release | |
| working-directory: packages/skia | |
| run: | | |
| npx semantic-release --dry-run | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| test-package-e2e: | |
| needs: build-library | |
| uses: ./.github/workflows/test-skia-package.yml | |
| with: | |
| skia_version: artifact:${{ needs.build-library.outputs.run_id }} | |
| test_ios: true | |
| test_android: true | |
| test_web: true | |
| build-windows-library: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build package | |
| run: yarn build | |
| build-android-ubuntu: | |
| runs-on: ubuntu-latest | |
| env: | |
| TURBO_CACHE_DIR: .turbo/android | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache turborepo for Android | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: ${{ env.TURBO_CACHE_DIR }} | |
| key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-turborepo-android | |
| - name: Install JDK | |
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '17' | |
| - name: Install NDK | |
| uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 # v1.5.0 | |
| id: setup-ndk | |
| with: | |
| ndk-version: r27d | |
| - name: Set ANDROID_NDK | |
| run: echo "ANDROID_NDK=$ANDROID_HOME/ndk-bundle" >> $GITHUB_ENV | |
| - name: Finalize Android SDK | |
| run: | | |
| /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" | |
| - name: Install Android SDK | |
| run: | | |
| echo "sdk.dir=$ANDROID_HOME" > $GITHUB_WORKSPACE/apps/example/android/local.properties | |
| - name: Cache Gradle | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: | | |
| ~/.gradle/wrapper | |
| ~/.gradle/caches | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('./apps/example/android/gradle/wrapper/gradle-wrapper.properties') }} | |
| ${{ runner.os }}-gradle- | |
| - name: Build example for Android | |
| env: | |
| JAVA_OPTS: "-XX:MaxHeapSize=6g" | |
| run: | | |
| yarn turbo run build:android --concurrency 1 --filter=example | |
| build-android: | |
| runs-on: macos-latest-large | |
| env: | |
| TURBO_CACHE_DIR: .turbo/android | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache turborepo for Android | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: ${{ env.TURBO_CACHE_DIR }} | |
| key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-turborepo-android | |
| - name: Install JDK | |
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '17' | |
| - name: Install NDK | |
| uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 # v1.5.0 | |
| id: setup-ndk | |
| with: | |
| ndk-version: r26d | |
| - name: Set ANDROID_NDK | |
| run: echo "ANDROID_NDK=$ANDROID_HOME/ndk-bundle" >> $GITHUB_ENV | |
| - name: Finalize Android SDK | |
| run: | | |
| /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" | |
| - name: Install Android SDK | |
| run: | | |
| echo "sdk.dir=$ANDROID_HOME" > $GITHUB_WORKSPACE/apps/example/android/local.properties | |
| - name: Cache Gradle | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| 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=16g" | |
| run: | | |
| yarn turbo run build:android --concurrency 1 | |
| - name: Cache apk | |
| uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| env: | |
| cache-name: cache-apk | |
| with: | |
| path: apps/example/android/app/build/outputs/apk/debug/app-debug.apk | |
| key: apk-${{ github.sha }} | |
| test-android: | |
| needs: build-android | |
| runs-on: macos-latest-xlarge | |
| timeout-minutes: 60 | |
| env: | |
| TURBO_CACHE_DIR: .turbo/android | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Restore APK | |
| id: cache-apk | |
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: apps/example/android/app/build/outputs/apk/debug/app-debug.apk | |
| key: apk-${{ github.sha }} | |
| - name: Setup Android Emulator | |
| uses: ./.github/actions/setup-android-emulator | |
| with: | |
| api_level: '30' | |
| device: 'Nexus 5X' | |
| gpu_mode: 'angle_indirect' | |
| avd_name: 'Pixel_API_30' | |
| - name: Start Package Manager | |
| working-directory: apps/example/ | |
| run: E2E=true yarn start & | |
| - name: Check APK existence | |
| uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0 | |
| with: | |
| files: apps/example/android/app/build/outputs/apk/debug/app-debug.apk | |
| fail: true | |
| - name: Install APK | |
| run: adb install -r apps/example/android/app/build/outputs/apk/debug/app-debug.apk | |
| # - name: Set up environment | |
| # run: echo "PACKAGE_NAME=${{ env.PACKAGE_NAME }}" >> $GITHUB_ENV | |
| - name: Launch APK | |
| env: | |
| PACKAGE_NAME: 'com.microsoft.reacttestapp' | |
| run: adb shell monkey -p ${{ env.PACKAGE_NAME }} 1 | |
| # On fabric, the system fonts are slightly different | |
| # so wont run the paragraph tests there for now | |
| - name: Run e2e Tests | |
| working-directory: packages/skia | |
| run: | | |
| CI=true yarn e2e --testPathIgnorePatterns Paragraphs | |
| - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| if: failure() | |
| with: | |
| path: packages/skia/src/__tests__/snapshots/ | |
| name: tests-snapshots-screenshots | |
| - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| if: failure() | |
| with: | |
| path: apps/docs/static/ | |
| name: tests-docs-screenshots | |
| build-test-ios: | |
| runs-on: macos-latest-xlarge | |
| env: | |
| TURBO_CACHE_DIR: .turbo/ios | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache turborepo for iOS | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| 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: Install CocoaPods | |
| working-directory: apps/example/ios | |
| run: pod install | |
| - name: Start Package Manager | |
| working-directory: apps/example | |
| run: E2E=true yarn start & | |
| - name: Build example for iOS | |
| working-directory: apps/example | |
| run: yarn ios --simulator 'iPhone 16 Pro' | |
| - name: Run e2e tests | |
| working-directory: packages/skia | |
| run: CI=true yarn e2e | |
| build-test-macos: | |
| runs-on: macos-latest | |
| env: | |
| TURBO_CACHE_DIR: .turbo/macos | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache turborepo for macOS | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: ${{ env.TURBO_CACHE_DIR }} | |
| key: ${{ runner.os }}-turborepo-macos-${{ hashFiles('yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-turborepo-macos- | |
| - name: Build example for macOS | |
| run: yarn turbo run build:macos --concurrency 1 | |
| build-test-macos-catalyst: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install CocoaPods and enable Catalyst | |
| working-directory: apps/example | |
| run: yarn pod:install:catalyst | |
| - name: Build example for macOS Catalyst | |
| working-directory: apps/example/ios | |
| run: xcodebuild -workspace example.xcworkspace -scheme ReactTestApp -destination 'platform=macOS,arch=arm64,variant=Mac Catalyst' -configuration Debug build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO |