From 38b1ddebd5cce51f8b7bf6852a9cd34f50a0bede Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 25 Jun 2024 14:54:03 +0200 Subject: [PATCH] [LOCAL][RN][CI] Improve stability of the Hermes pipeline (#45142) * [LOCAL][CI] Require cocoapods to hermes-engine podspec * Refactor Hermes workspace (#45071) Summary: This change is the first step in refactoring GHA so that they can be reused more easily across jobs. Its goal is also to be more reliable w.r.t. caches. That this change do: * moves `prepare_hermes_workspace` to a composite action * saves the `prepare_hermes_workspace` caches only on main * uploads the destination folder as an artifact so that we can use it later in the run * makes the `test-all`, `nightly` and `publish-release` workflow use the new composite action * updates the `setup-hermes-workspace` to download and use the artifact uploaded by `prepare_hermes_workspace` [Internal] - Factor out the prepare_hermes_workspace action Pull Request resolved: https://github.com/facebook/react-native/pull/45071 Test Plan: GHA in CI Reviewed By: cortinico Differential Revision: D58808087 Pulled By: cipolleschi fbshipit-source-id: 42c46bcf75fc73b2edfda9be62b5d0fe8a919a5d * [LOCAL][RN][CI] Improve stability of the Hermes pipeline * chore: align nighlties and releases to the test-all jobs which is green in GHA --- .../actions/test_ios_helloworld/action.yml | 19 +- .github/actions/test_ios_rntester/action.yml | 10 +- .github/workflows/nightly.yml | 171 ++++++++++-------- .github/workflows/publish-release.yml | 170 +++++++++-------- .github/workflows/test-all.yml | 169 ++++++++--------- 5 files changed, 288 insertions(+), 251 deletions(-) diff --git a/.github/actions/test_ios_helloworld/action.yml b/.github/actions/test_ios_helloworld/action.yml index c4d4efb46d3..6a76091c7fc 100644 --- a/.github/actions/test_ios_helloworld/action.yml +++ b/.github/actions/test_ios_helloworld/action.yml @@ -45,17 +45,19 @@ runs: uses: ./.github/actions/setup-xcode - name: Setup node.js uses: ./.github/actions/setup-node - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup + - name: Create Hermes folder + run: mkdir -p "$HERMES_WS_DIR" + - name: Download Hermes + uses: actions/download-artifact@v4 with: - hermes-version: ${{ inputs.hermes-version }} - react-native-version: ${{ inputs.react-native-version }} + name: hermes-darwin-bin-${{ inputs.flavor }} + path: $HERMES_WS_DIR/hermes-runtime-darwin/ + - name: Print Downloaded hermes + shell: bash + run: ls -lR "$HERMES_WS_DIR" - name: Run yarn shell: bash run: yarn install --non-interactive - - name: Restore Hermes workspace - uses: ./.github/actions/restore-hermes-workspace - name: Setup ruby uses: ruby/setup-ruby@v1.170.0 with: @@ -78,9 +80,10 @@ runs: args+=(--jsvm jsc) yarn bootstrap ios "${args[@]}" | cat else + BUILD_TYPE="${{ inputs.flavor }}" TARBALL_FILENAME=$(node ../react-native/scripts/hermes/get-tarball-name.js --buildType "$BUILD_TYPE") - HERMES_PATH="$HERMES_WS_DIR/hermes-runtime-darwin/$TARBALL_FILENAME" + HERMES_PATH="$HERMES_WS_DIR/hermes-runtime-darwin/hermes-darwin-bin-${{ inputs.flavor }}/$TARBALL_FILENAME" HERMES_ENGINE_TARBALL_PATH="$HERMES_PATH" yarn bootstrap ios "${args[@]}" | cat fi - name: Build HelloWorld project diff --git a/.github/actions/test_ios_rntester/action.yml b/.github/actions/test_ios_rntester/action.yml index 3f339734c9d..0fd3592ca72 100644 --- a/.github/actions/test_ios_rntester/action.yml +++ b/.github/actions/test_ios_rntester/action.yml @@ -38,12 +38,11 @@ runs: - name: Run yarn shell: bash run: yarn install --non-interactive - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup + - name: Download Hermes + uses: actions/download-artifact@v4 with: - hermes-version: ${{ inputs.hermes-version }} - react-native-version: ${{ inputs.react-native-version }} + name: hermes-darwin-bin-${{ inputs.flavor }} + path: ${{ inputs.hermes-tarball-artifacts-dir }} - name: Setup ruby uses: ruby/setup-ruby@v1.170.0 with: @@ -82,6 +81,7 @@ runs: if [[ -e $TARBALL_PATH ]]; then tar -xf $TARBALL_PATH echo 'print(HermesInternal?.getRuntimeProperties?.()["OSS Release Version"])' > test.js + chmod +x ./destroot/bin/hermes ./destroot/bin/hermes test.js rm test.js rm -rf destroot diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 2958369b3c0..0f762c271bd 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -28,7 +28,6 @@ jobs: HERMES_WS_DIR: /tmp/hermes HERMES_VERSION_FILE: packages/react-native/sdks/.hermesversion BUILD_FROM_SOURCE: true - GRADLE_OPTS: '-Dorg.gradle.daemon=false' outputs: react-native-version: ${{ steps.prepare-hermes-workspace.outputs.react-native-version }} hermes-version: ${{ steps.prepare-hermes-workspace.outputs.hermes-version }} @@ -38,6 +37,10 @@ jobs: - name: Prepare Hermes Workspace id: prepare-hermes-workspace uses: ./.github/actions/prepare-hermes-workspace + with: + HERMES_WS_DIR: ${{ env.HERMES_WS_DIR }} + HERMES_VERSION_FILE: ${{ env.HERMES_VERSION_FILE }} + BUILD_FROM_SOURCE: ${{ env.BUILD_FROM_SOURCE }} build_hermesc_apple: runs-on: macos-13 @@ -67,7 +70,7 @@ jobs: path: ./packages/react-native/sdks/hermes/build_host_hermesc - name: Cache hermesc apple uses: actions/cache/save@v4.0.0 - if: ${{ github.ref == 'refs/heads/main' }} # To avoid that the cache explode. + if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode. with: path: ./packages/react-native/sdks/hermes/build_host_hermesc key: v2-hermesc-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }} @@ -94,12 +97,6 @@ jobs: uses: actions/checkout@v4.1.1 - name: Setup xcode uses: ./.github/actions/setup-xcode - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup - with: - hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} - react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} - name: Restore Hermes workspace uses: ./.github/actions/restore-hermes-workspace - name: Restore HermesC Artifact @@ -107,22 +104,12 @@ jobs: with: name: hermesc-apple path: ./packages/react-native/sdks/hermes/build_host_hermesc - - name: Check if the required artifacts already exist - id: check_if_apple_artifacts_are_there - run: | - FLAVOR="${{ matrix.flavor }}" - echo "Flavor is $FLAVOR" - OSX_BIN="/tmp/hermes/osx-bin/$FLAVOR" - DSYM="/tmp/hermes/dSYM/$FLAVOR" - HERMES="/tmp/hermes/hermes-runtime-darwin/hermes-ios-$FLAVOR.tar.gz" - - if [[ -d "$OSX_BIN" ]] && \ - [[ -d "$DSYM" ]] && \ - [[ -f "$HERMES" ]]; then - - echo "Artifacts are there!" - echo "ARTIFACTS_EXIST=true" >> $GITHUB_ENV - fi + - name: Restore Slice From Cache + id: restore-slice-cache + uses: actions/cache/restore@v4.0.0 + with: + path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }} + key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }} - name: Build the Hermes ${{ matrix.slice }} frameworks run: | cd ./packages/react-native/sdks/hermes || exit 1 @@ -142,7 +129,10 @@ jobs: fi export RELEASE_VERSION=${{ needs.prepare_hermes_workspace.outputs.react-native-version }} - chmod +x /Users/runner/work/react-native/react-native/packages/react-native/sdks/hermes/build_host_hermesc/bin/hermesc + + # HermesC is used to build hermes, so it has to be executable + chmod +x ./build_host_hermesc/bin/hermesc + if [[ "$SLICE" == "macosx" ]]; then echo "[HERMES] Building Hermes for MacOS" @@ -173,8 +163,14 @@ jobs: echo "Please try again" exit 1 fi + - name: Upload Artifact for Slice (${{ matrix.slice }}, ${{ matrix.flavor }}} + uses: actions/upload-artifact@v4.3.1 + with: + name: slice-${{ matrix.slice }}-${{ matrix.flavor }} + path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }} - name: Save slice cache - uses: actions/cache@v4.0.0 + if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode. + uses: actions/cache/save@v4.0.0 with: path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }} key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }} @@ -197,14 +193,16 @@ jobs: uses: ./.github/actions/setup-xcode - name: Setup node.js uses: ./.github/actions/setup-node - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup - with: - hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} - react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} - name: Restore Hermes workspace uses: ./.github/actions/restore-hermes-workspace + - name: Restore Cached Artifacts + uses: actions/cache/restore@v4.0.0 + with: + key: v2-hermes-osx-bin-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + path: | + /tmp/hermes/osx-bin/${{ matrix.flavor }} + /tmp/hermes/dSYM/${{ matrix.flavor }} + /tmp/hermes/hermes-runtime-darwin/hermes-ios-${{ matrix.flavor }}.tar.gz - name: Check if the required artifacts already exist id: check_if_apple_artifacts_are_there run: | @@ -223,46 +221,46 @@ jobs: echo "ARTIFACTS_EXIST=true" >> $GITHUB_OUTPUT fi - name: Yarn- Install Dependencies - if: ${{ ! contains(github.event.head_commit.message, 'Bump metro@') && steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: yarn install --non-interactive - name: Slice cache macosx - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_macosx_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-macosx-${{ matrix.flavor }} + name: slice-macosx-${{ matrix.flavor }} - name: Slice cache iphoneos - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_iphoneos_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-iphoneos-${{ matrix.flavor }} + name: slice-iphoneos-${{ matrix.flavor }} - name: Slice cache iphonesimulator - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_iphonesimulator_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-iphonesimulator-${{ matrix.flavor }} + name: slice-iphonesimulator-${{ matrix.flavor }} - name: Slice cache catalyst - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_catalyst_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-catalyst-${{ matrix.flavor }} + name: slice-catalyst-${{ matrix.flavor }} - name: Slice cache xros - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_xros_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-xros-${{ matrix.flavor }} + name: slice-xros-${{ matrix.flavor }} - name: Slice cache xrsimulator - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_xrsimulator_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-xrsimulator-${{ matrix.flavor }} + name: slice-xrsimulator-${{ matrix.flavor }} - name: Move back build folders - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: | ls -l ./packages/react-native/sdks/hermes cd ./packages/react-native/sdks/hermes || exit 1 @@ -273,20 +271,21 @@ jobs: mv build_xros_${{ matrix.flavor }} build_xros mv build_xrsimulator_${{ matrix.flavor }} build_xrsimulator - name: Prepare destroot folder - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: | cd ./packages/react-native/sdks/hermes || exit 1 + chmod +x ./utils/build-apple-framework.sh . ./utils/build-apple-framework.sh prepare_dest_root_for_ci - name: Create fat framework for iOS - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: | cd ./packages/react-native/sdks/hermes || exit 1 echo "[HERMES] Creating the universal framework" chmod +x ./utils/build-ios-framework.sh ./utils/build-ios-framework.sh build_framework - name: Package the Hermes Apple frameworks - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: | BUILD_TYPE="${{ matrix.flavor }}" echo "Packaging Hermes Apple frameworks for $BUILD_TYPE build type" @@ -310,16 +309,6 @@ jobs: mkdir -p /tmp/hermes/osx-bin/${{ matrix.flavor }} cp ./packages/react-native/sdks/hermes/build_macosx/bin/* /tmp/hermes/osx-bin/${{ matrix.flavor }} ls -lR /tmp/hermes/osx-bin/ - - name: Upload darwin artifacts - uses: actions/upload-artifact@v4.3.1 - with: - name: hermes-darwin-bin-${{ matrix.flavor }} - path: /tmp/hermes/hermes-runtime-darwin - - name: Upload osx-bin - uses: actions/upload-artifact@v4.3.1 - with: - name: hermes-osx-bin-${{ matrix.flavor }} - path: /tmp/hermes/osx-bin - name: Create dSYM archive if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} run: | @@ -353,10 +342,32 @@ jobs: with: name: hermes-dSYM-${{ matrix.flavor }} path: /tmp/hermes/dSYM/${{ matrix.flavor }} + - name: Upload hermes Runtime artifacts + uses: actions/upload-artifact@v4.3.1 + with: + name: hermes-darwin-bin-${{ matrix.flavor }} + path: /tmp/hermes/hermes-runtime-darwin/hermes-ios-${{ matrix.flavor }}.tar.gz + - name: Upload hermes osx artifacts + uses: actions/upload-artifact@v4.3.1 + with: + name: hermes-osx-bin-${{ matrix.flavor }} + path: /tmp/hermes/osx-bin/${{ matrix.flavor }} + - name: Upload Hermes Artifacts + uses: actions/cache/save@v4.0.0 + if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode. + with: + key: v2-hermes-artifacts-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + path: | + /tmp/hermes/osx-bin/${{ matrix.flavor }} + /tmp/hermes/dSYM/${{ matrix.flavor }} + /tmp/hermes/hermes-runtime-darwin/hermes-ios-${{ matrix.flavor }}.tar.gz build_hermesc_linux: runs-on: ubuntu-latest needs: prepare_hermes_workspace + env: + HERMES_WS_DIR: /tmp/hermes + HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin steps: - name: Checkout uses: actions/checkout@v4.1.1 @@ -365,12 +376,8 @@ jobs: sudo apt update sudo apt install -y git openssh-client cmake build-essential \ libreadline-dev libicu-dev jq zip python3 - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup - with: - hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} - react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + - name: Restore Hermes workspace + uses: ./.github/actions/restore-hermes-workspace - name: Linux cache uses: actions/cache@v4.0.0 with: @@ -404,18 +411,25 @@ jobs: needs: prepare_hermes_workspace env: HERMES_WS_DIR: 'D:\tmp\hermes' + HERMES_TARBALL_ARTIFACTS_DIR: 'D:\tmp\hermes\hermes-runtime-darwin' + HERMES_OSXBIN_ARTIFACTS_DIR: 'D:\tmp\hermes\osx-bin' ICU_URL: "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-Win64-MSVC2017.zip" MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin' CMAKE_DIR: 'C:\Program Files\CMake\bin' steps: - name: Checkout uses: actions/checkout@v4.1.1 - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup + - name: Download Previous Artifacts + uses: actions/download-artifact@v4 with: - hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} - react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + name: hermes-workspace + path: 'D:\tmp\hermes' + - name: Set up workspace + run: | + mkdir -p D:\tmp\hermes\osx-bin + mkdir -p .\packages\react-native\sdks\hermes + cp -r -Force D:\tmp\hermes\hermes\* .\packages\react-native\sdks\hermes\. + cp -r -Force .\packages\react-native\sdks\hermes-engine\utils\* .\packages\react-native\sdks\hermes\. - name: Windows cache uses: actions/cache@v4.0.0 with: @@ -526,6 +540,7 @@ jobs: name: rntester-apk path: packages/rn-tester/android/app/build/outputs/apk/ compression-level: 0 + build_npm_package: runs-on: 8-core-ubuntu needs: [set_release_type, prepare_hermes_workspace, build_hermes_macos, build_hermesc_linux, build_hermesc_windows,build_android] @@ -556,12 +571,12 @@ jobs: uses: actions/download-artifact@v4.1.3 with: name: hermes-osx-bin-Release - path: /tmp/hermes/osx-bin + path: /tmp/hermes/osx-bin/Release - name: Download osx-bin debug artifacts uses: actions/download-artifact@v4.1.3 with: name: hermes-osx-bin-Debug - path: /tmp/hermes/osx-bin + path: /tmp/hermes/osx-bin/Debug - name: Download darwin-bin release artifacts uses: actions/download-artifact@v4.1.3 with: diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 2b327124b0e..3f0c7e55112 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -25,7 +25,6 @@ jobs: HERMES_WS_DIR: /tmp/hermes HERMES_VERSION_FILE: packages/react-native/sdks/.hermesversion BUILD_FROM_SOURCE: true - GRADLE_OPTS: '-Dorg.gradle.daemon=false' outputs: react-native-version: ${{ steps.prepare-hermes-workspace.outputs.react-native-version }} hermes-version: ${{ steps.prepare-hermes-workspace.outputs.hermes-version }} @@ -35,6 +34,10 @@ jobs: - name: Prepare Hermes Workspace id: prepare-hermes-workspace uses: ./.github/actions/prepare-hermes-workspace + with: + HERMES_WS_DIR: ${{ env.HERMES_WS_DIR }} + HERMES_VERSION_FILE: ${{ env.HERMES_VERSION_FILE }} + BUILD_FROM_SOURCE: ${{ env.BUILD_FROM_SOURCE }} build_hermesc_apple: runs-on: macos-13 @@ -64,7 +67,7 @@ jobs: path: ./packages/react-native/sdks/hermes/build_host_hermesc - name: Cache hermesc apple uses: actions/cache/save@v4.0.0 - if: ${{ github.ref == 'refs/heads/main' }} # To avoid that the cache explode. + if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode. with: path: ./packages/react-native/sdks/hermes/build_host_hermesc key: v2-hermesc-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }} @@ -91,12 +94,6 @@ jobs: uses: actions/checkout@v4.1.1 - name: Setup xcode uses: ./.github/actions/setup-xcode - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup - with: - hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} - react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} - name: Restore Hermes workspace uses: ./.github/actions/restore-hermes-workspace - name: Restore HermesC Artifact @@ -104,22 +101,12 @@ jobs: with: name: hermesc-apple path: ./packages/react-native/sdks/hermes/build_host_hermesc - - name: Check if the required artifacts already exist - id: check_if_apple_artifacts_are_there - run: | - FLAVOR="${{ matrix.flavor }}" - echo "Flavor is $FLAVOR" - OSX_BIN="/tmp/hermes/osx-bin/$FLAVOR" - DSYM="/tmp/hermes/dSYM/$FLAVOR" - HERMES="/tmp/hermes/hermes-runtime-darwin/hermes-ios-$FLAVOR.tar.gz" - - if [[ -d "$OSX_BIN" ]] && \ - [[ -d "$DSYM" ]] && \ - [[ -f "$HERMES" ]]; then - - echo "Artifacts are there!" - echo "ARTIFACTS_EXIST=true" >> $GITHUB_ENV - fi + - name: Restore Slice From Cache + id: restore-slice-cache + uses: actions/cache/restore@v4.0.0 + with: + path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }} + key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }} - name: Build the Hermes ${{ matrix.slice }} frameworks run: | cd ./packages/react-native/sdks/hermes || exit 1 @@ -139,7 +126,10 @@ jobs: fi export RELEASE_VERSION=${{ needs.prepare_hermes_workspace.outputs.react-native-version }} - chmod +x /Users/runner/work/react-native/react-native/packages/react-native/sdks/hermes/build_host_hermesc/bin/hermesc + + # HermesC is used to build hermes, so it has to be executable + chmod +x ./build_host_hermesc/bin/hermesc + if [[ "$SLICE" == "macosx" ]]; then echo "[HERMES] Building Hermes for MacOS" @@ -170,8 +160,14 @@ jobs: echo "Please try again" exit 1 fi + - name: Upload Artifact for Slice (${{ matrix.slice }}, ${{ matrix.flavor }}} + uses: actions/upload-artifact@v4.3.1 + with: + name: slice-${{ matrix.slice }}-${{ matrix.flavor }} + path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }} - name: Save slice cache - uses: actions/cache@v4.0.0 + if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode. + uses: actions/cache/save@v4.0.0 with: path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }} key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }} @@ -194,14 +190,16 @@ jobs: uses: ./.github/actions/setup-xcode - name: Setup node.js uses: ./.github/actions/setup-node - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup - with: - hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} - react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} - name: Restore Hermes workspace uses: ./.github/actions/restore-hermes-workspace + - name: Restore Cached Artifacts + uses: actions/cache/restore@v4.0.0 + with: + key: v2-hermes-osx-bin-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + path: | + /tmp/hermes/osx-bin/${{ matrix.flavor }} + /tmp/hermes/dSYM/${{ matrix.flavor }} + /tmp/hermes/hermes-runtime-darwin/hermes-ios-${{ matrix.flavor }}.tar.gz - name: Check if the required artifacts already exist id: check_if_apple_artifacts_are_there run: | @@ -220,46 +218,46 @@ jobs: echo "ARTIFACTS_EXIST=true" >> $GITHUB_OUTPUT fi - name: Yarn- Install Dependencies - if: ${{ ! contains(github.event.head_commit.message, 'Bump metro@') && steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: yarn install --non-interactive - name: Slice cache macosx - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_macosx_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-macosx-${{ matrix.flavor }} + name: slice-macosx-${{ matrix.flavor }} - name: Slice cache iphoneos - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_iphoneos_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-iphoneos-${{ matrix.flavor }} + name: slice-iphoneos-${{ matrix.flavor }} - name: Slice cache iphonesimulator - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_iphonesimulator_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-iphonesimulator-${{ matrix.flavor }} + name: slice-iphonesimulator-${{ matrix.flavor }} - name: Slice cache catalyst - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_catalyst_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-catalyst-${{ matrix.flavor }} + name: slice-catalyst-${{ matrix.flavor }} - name: Slice cache xros - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_xros_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-xros-${{ matrix.flavor }} + name: slice-xros-${{ matrix.flavor }} - name: Slice cache xrsimulator - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_xrsimulator_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-xrsimulator-${{ matrix.flavor }} + name: slice-xrsimulator-${{ matrix.flavor }} - name: Move back build folders - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: | ls -l ./packages/react-native/sdks/hermes cd ./packages/react-native/sdks/hermes || exit 1 @@ -270,20 +268,21 @@ jobs: mv build_xros_${{ matrix.flavor }} build_xros mv build_xrsimulator_${{ matrix.flavor }} build_xrsimulator - name: Prepare destroot folder - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: | cd ./packages/react-native/sdks/hermes || exit 1 + chmod +x ./utils/build-apple-framework.sh . ./utils/build-apple-framework.sh prepare_dest_root_for_ci - name: Create fat framework for iOS - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: | cd ./packages/react-native/sdks/hermes || exit 1 echo "[HERMES] Creating the universal framework" chmod +x ./utils/build-ios-framework.sh ./utils/build-ios-framework.sh build_framework - name: Package the Hermes Apple frameworks - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: | BUILD_TYPE="${{ matrix.flavor }}" echo "Packaging Hermes Apple frameworks for $BUILD_TYPE build type" @@ -307,16 +306,6 @@ jobs: mkdir -p /tmp/hermes/osx-bin/${{ matrix.flavor }} cp ./packages/react-native/sdks/hermes/build_macosx/bin/* /tmp/hermes/osx-bin/${{ matrix.flavor }} ls -lR /tmp/hermes/osx-bin/ - - name: Upload darwin artifacts - uses: actions/upload-artifact@v4.3.1 - with: - name: hermes-darwin-bin-${{ matrix.flavor }} - path: /tmp/hermes/hermes-runtime-darwin - - name: Upload osx-bin - uses: actions/upload-artifact@v4.3.1 - with: - name: hermes-osx-bin-${{ matrix.flavor }} - path: /tmp/hermes/osx-bin - name: Create dSYM archive if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} run: | @@ -350,10 +339,32 @@ jobs: with: name: hermes-dSYM-${{ matrix.flavor }} path: /tmp/hermes/dSYM/${{ matrix.flavor }} + - name: Upload hermes Runtime artifacts + uses: actions/upload-artifact@v4.3.1 + with: + name: hermes-darwin-bin-${{ matrix.flavor }} + path: /tmp/hermes/hermes-runtime-darwin/hermes-ios-${{ matrix.flavor }}.tar.gz + - name: Upload hermes osx artifacts + uses: actions/upload-artifact@v4.3.1 + with: + name: hermes-osx-bin-${{ matrix.flavor }} + path: /tmp/hermes/osx-bin/${{ matrix.flavor }} + - name: Upload Hermes Artifacts + uses: actions/cache/save@v4.0.0 + if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode. + with: + key: v2-hermes-artifacts-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + path: | + /tmp/hermes/osx-bin/${{ matrix.flavor }} + /tmp/hermes/dSYM/${{ matrix.flavor }} + /tmp/hermes/hermes-runtime-darwin/hermes-ios-${{ matrix.flavor }}.tar.gz build_hermesc_linux: runs-on: ubuntu-latest needs: prepare_hermes_workspace + env: + HERMES_WS_DIR: /tmp/hermes + HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin steps: - name: Checkout uses: actions/checkout@v4.1.1 @@ -362,12 +373,8 @@ jobs: sudo apt update sudo apt install -y git openssh-client cmake build-essential \ libreadline-dev libicu-dev jq zip python3 - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup - with: - hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} - react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + - name: Restore Hermes workspace + uses: ./.github/actions/restore-hermes-workspace - name: Linux cache uses: actions/cache@v4.0.0 with: @@ -401,18 +408,25 @@ jobs: needs: prepare_hermes_workspace env: HERMES_WS_DIR: 'D:\tmp\hermes' + HERMES_TARBALL_ARTIFACTS_DIR: 'D:\tmp\hermes\hermes-runtime-darwin' + HERMES_OSXBIN_ARTIFACTS_DIR: 'D:\tmp\hermes\osx-bin' ICU_URL: "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-Win64-MSVC2017.zip" MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin' CMAKE_DIR: 'C:\Program Files\CMake\bin' steps: - name: Checkout uses: actions/checkout@v4.1.1 - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup + - name: Download Previous Artifacts + uses: actions/download-artifact@v4 with: - hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} - react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + name: hermes-workspace + path: 'D:\tmp\hermes' + - name: Set up workspace + run: | + mkdir -p D:\tmp\hermes\osx-bin + mkdir -p .\packages\react-native\sdks\hermes + cp -r -Force D:\tmp\hermes\hermes\* .\packages\react-native\sdks\hermes\. + cp -r -Force .\packages\react-native\sdks\hermes-engine\utils\* .\packages\react-native\sdks\hermes\. - name: Windows cache uses: actions/cache@v4.0.0 with: @@ -556,12 +570,12 @@ jobs: uses: actions/download-artifact@v4.1.3 with: name: hermes-osx-bin-Release - path: /tmp/hermes/osx-bin + path: /tmp/hermes/osx-bin/Release - name: Download osx-bin debug artifacts uses: actions/download-artifact@v4.1.3 with: name: hermes-osx-bin-Debug - path: /tmp/hermes/osx-bin + path: /tmp/hermes/osx-bin/Debug - name: Download darwin-bin release artifacts uses: actions/download-artifact@v4.1.3 with: diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 8eaddfbf082..a589f341213 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -78,7 +78,7 @@ jobs: path: ./packages/react-native/sdks/hermes/build_host_hermesc - name: Cache hermesc apple uses: actions/cache/save@v4.0.0 - if: ${{ github.ref == 'refs/heads/main' }} # To avoid that the cache explode. + if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode. with: path: ./packages/react-native/sdks/hermes/build_host_hermesc key: v2-hermesc-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }} @@ -105,12 +105,6 @@ jobs: uses: actions/checkout@v4.1.1 - name: Setup xcode uses: ./.github/actions/setup-xcode - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup - with: - hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} - react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} - name: Restore Hermes workspace uses: ./.github/actions/restore-hermes-workspace - name: Restore HermesC Artifact @@ -118,22 +112,12 @@ jobs: with: name: hermesc-apple path: ./packages/react-native/sdks/hermes/build_host_hermesc - - name: Check if the required artifacts already exist - id: check_if_apple_artifacts_are_there - run: | - FLAVOR="${{ matrix.flavor }}" - echo "Flavor is $FLAVOR" - OSX_BIN="/tmp/hermes/osx-bin/$FLAVOR" - DSYM="/tmp/hermes/dSYM/$FLAVOR" - HERMES="/tmp/hermes/hermes-runtime-darwin/hermes-ios-$FLAVOR.tar.gz" - - if [[ -d "$OSX_BIN" ]] && \ - [[ -d "$DSYM" ]] && \ - [[ -f "$HERMES" ]]; then - - echo "Artifacts are there!" - echo "ARTIFACTS_EXIST=true" >> $GITHUB_ENV - fi + - name: Restore Slice From Cache + id: restore-slice-cache + uses: actions/cache/restore@v4.0.0 + with: + path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }} + key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }} - name: Build the Hermes ${{ matrix.slice }} frameworks run: | cd ./packages/react-native/sdks/hermes || exit 1 @@ -153,7 +137,10 @@ jobs: fi export RELEASE_VERSION=${{ needs.prepare_hermes_workspace.outputs.react-native-version }} - chmod +x /Users/runner/work/react-native/react-native/packages/react-native/sdks/hermes/build_host_hermesc/bin/hermesc + + # HermesC is used to build hermes, so it has to be executable + chmod +x ./build_host_hermesc/bin/hermesc + if [[ "$SLICE" == "macosx" ]]; then echo "[HERMES] Building Hermes for MacOS" @@ -184,8 +171,14 @@ jobs: echo "Please try again" exit 1 fi + - name: Upload Artifact for Slice (${{ matrix.slice }}, ${{ matrix.flavor }}} + uses: actions/upload-artifact@v4.3.1 + with: + name: slice-${{ matrix.slice }}-${{ matrix.flavor }} + path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }} - name: Save slice cache - uses: actions/cache@v4.0.0 + if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode. + uses: actions/cache/save@v4.0.0 with: path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }} key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }} @@ -208,14 +201,16 @@ jobs: uses: ./.github/actions/setup-xcode - name: Setup node.js uses: ./.github/actions/setup-node - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup - with: - hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} - react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} - name: Restore Hermes workspace uses: ./.github/actions/restore-hermes-workspace + - name: Restore Cached Artifacts + uses: actions/cache/restore@v4.0.0 + with: + key: v2-hermes-osx-bin-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + path: | + /tmp/hermes/osx-bin/${{ matrix.flavor }} + /tmp/hermes/dSYM/${{ matrix.flavor }} + /tmp/hermes/hermes-runtime-darwin/hermes-ios-${{ matrix.flavor }}.tar.gz - name: Check if the required artifacts already exist id: check_if_apple_artifacts_are_there run: | @@ -234,45 +229,46 @@ jobs: echo "ARTIFACTS_EXIST=true" >> $GITHUB_OUTPUT fi - name: Yarn- Install Dependencies + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: yarn install --non-interactive - name: Slice cache macosx - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_macosx_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-macosx-${{ matrix.flavor }} + name: slice-macosx-${{ matrix.flavor }} - name: Slice cache iphoneos - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_iphoneos_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-iphoneos-${{ matrix.flavor }} + name: slice-iphoneos-${{ matrix.flavor }} - name: Slice cache iphonesimulator - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_iphonesimulator_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-iphonesimulator-${{ matrix.flavor }} + name: slice-iphonesimulator-${{ matrix.flavor }} - name: Slice cache catalyst - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_catalyst_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-catalyst-${{ matrix.flavor }} + name: slice-catalyst-${{ matrix.flavor }} - name: Slice cache xros - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_xros_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-xros-${{ matrix.flavor }} + name: slice-xros-${{ matrix.flavor }} - name: Slice cache xrsimulator - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} - uses: actions/cache@v4.0.0 + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} + uses: actions/download-artifact@v4.1.3 with: path: ./packages/react-native/sdks/hermes/build_xrsimulator_${{ matrix.flavor }} - key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-xrsimulator-${{ matrix.flavor }} + name: slice-xrsimulator-${{ matrix.flavor }} - name: Move back build folders - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: | ls -l ./packages/react-native/sdks/hermes cd ./packages/react-native/sdks/hermes || exit 1 @@ -283,21 +279,21 @@ jobs: mv build_xros_${{ matrix.flavor }} build_xros mv build_xrsimulator_${{ matrix.flavor }} build_xrsimulator - name: Prepare destroot folder - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: | cd ./packages/react-native/sdks/hermes || exit 1 chmod +x ./utils/build-apple-framework.sh . ./utils/build-apple-framework.sh prepare_dest_root_for_ci - name: Create fat framework for iOS - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: | cd ./packages/react-native/sdks/hermes || exit 1 echo "[HERMES] Creating the universal framework" chmod +x ./utils/build-ios-framework.sh ./utils/build-ios-framework.sh build_framework - name: Package the Hermes Apple frameworks - if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} + if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }} run: | BUILD_TYPE="${{ matrix.flavor }}" echo "Packaging Hermes Apple frameworks for $BUILD_TYPE build type" @@ -321,16 +317,6 @@ jobs: mkdir -p /tmp/hermes/osx-bin/${{ matrix.flavor }} cp ./packages/react-native/sdks/hermes/build_macosx/bin/* /tmp/hermes/osx-bin/${{ matrix.flavor }} ls -lR /tmp/hermes/osx-bin/ - - name: Upload darwin artifacts - uses: actions/upload-artifact@v4.3.1 - with: - name: hermes-darwin-bin-${{ matrix.flavor }} - path: /tmp/hermes/hermes-runtime-darwin - - name: Upload osx-bin - uses: actions/upload-artifact@v4.3.1 - with: - name: hermes-osx-bin-${{ matrix.flavor }} - path: /tmp/hermes/osx-bin - name: Create dSYM archive if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }} run: | @@ -364,6 +350,25 @@ jobs: with: name: hermes-dSYM-${{ matrix.flavor }} path: /tmp/hermes/dSYM/${{ matrix.flavor }} + - name: Upload hermes Runtime artifacts + uses: actions/upload-artifact@v4.3.1 + with: + name: hermes-darwin-bin-${{ matrix.flavor }} + path: /tmp/hermes/hermes-runtime-darwin/hermes-ios-${{ matrix.flavor }}.tar.gz + - name: Upload hermes osx artifacts + uses: actions/upload-artifact@v4.3.1 + with: + name: hermes-osx-bin-${{ matrix.flavor }} + path: /tmp/hermes/osx-bin/${{ matrix.flavor }} + - name: Upload Hermes Artifacts + uses: actions/cache/save@v4.0.0 + if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode. + with: + key: v2-hermes-artifacts-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + path: | + /tmp/hermes/osx-bin/${{ matrix.flavor }} + /tmp/hermes/dSYM/${{ matrix.flavor }} + /tmp/hermes/hermes-runtime-darwin/hermes-ios-${{ matrix.flavor }}.tar.gz test_ios_rntester_ruby_3_2_0: runs-on: macos-13 @@ -433,6 +438,9 @@ jobs: build_hermesc_linux: runs-on: ubuntu-latest needs: prepare_hermes_workspace + env: + HERMES_WS_DIR: /tmp/hermes + HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin steps: - name: Checkout uses: actions/checkout@v4.1.1 @@ -441,12 +449,8 @@ jobs: sudo apt update sudo apt install -y git openssh-client cmake build-essential \ libreadline-dev libicu-dev jq zip python3 - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup - with: - hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} - react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + - name: Restore Hermes workspace + uses: ./.github/actions/restore-hermes-workspace - name: Linux cache uses: actions/cache@v4.0.0 with: @@ -480,18 +484,25 @@ jobs: needs: prepare_hermes_workspace env: HERMES_WS_DIR: 'D:\tmp\hermes' + HERMES_TARBALL_ARTIFACTS_DIR: 'D:\tmp\hermes\hermes-runtime-darwin' + HERMES_OSXBIN_ARTIFACTS_DIR: 'D:\tmp\hermes\osx-bin' ICU_URL: "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-Win64-MSVC2017.zip" MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin' CMAKE_DIR: 'C:\Program Files\CMake\bin' steps: - name: Checkout uses: actions/checkout@v4.1.1 - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup + - name: Download Previous Artifacts + uses: actions/download-artifact@v4 with: - hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} - react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + name: hermes-workspace + path: 'D:\tmp\hermes' + - name: Set up workspace + run: | + mkdir -p D:\tmp\hermes\osx-bin + mkdir -p .\packages\react-native\sdks\hermes + cp -r -Force D:\tmp\hermes\hermes\* .\packages\react-native\sdks\hermes\. + cp -r -Force .\packages\react-native\sdks\hermes-engine\utils\* .\packages\react-native\sdks\hermes\. - name: Windows cache uses: actions/cache@v4.0.0 with: @@ -638,12 +649,12 @@ jobs: uses: actions/download-artifact@v4.1.3 with: name: hermes-osx-bin-Release - path: /tmp/hermes/osx-bin + path: /tmp/hermes/osx-bin/Release - name: Download osx-bin debug artifacts uses: actions/download-artifact@v4.1.3 with: name: hermes-osx-bin-Debug - path: /tmp/hermes/osx-bin + path: /tmp/hermes/osx-bin/Debug - name: Download darwin-bin release artifacts uses: actions/download-artifact@v4.1.3 with: @@ -676,12 +687,6 @@ jobs: path: /tmp/hermes/linux64-bin - name: Show /tmp/hermes directory run: ls -lR /tmp/hermes - - name: Cache setup - id: cache_setup - uses: ./.github/actions/cache_setup - with: - hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} - react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} - name: Copy Hermes binaries shell: bash run: |