Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RN][GHA] Move HelloWorld jobs from CCI to GHA #44875

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
name: test_ios_template
description: Test iOS Template
name: test_ios_helloworld
description: Test iOS Hello World
inputs:
jsengine:
description: Which JavaScript engine to use. Must be one of "Hermes", "JSC".
type: choice
default: Hermes
options:
- JSC
- Hermes
use-frameworks:
description: The dependency building and linking strategy to use. Must be one of "StaticLibraries", "DynamicFrameworks"
type: choice
default: StaticLibraries
options:
- StaticLibraries
- DynamicFrameworks
architecture:
description: The React Native architecture to Test. RNTester has always Fabric enabled, but we want to run integration test with the old arch setup
type: choice
default: OldArch
options:
- OldArch
- NewArch
ruby-version:
description: The version of ruby that must be used
default: 2.6.10
flavor:
description: The flavor of the build. Must be one of "Debug", "Release".
type: choice
default: Debug
options:
- Debug
- Release
hermes-version:
description: The version of hermes
required: true
Expand All @@ -29,70 +45,51 @@ runs:
uses: ./.github/actions/setup-xcode
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Run yarn
shell: bash
run: yarn install --non-interactive
- name: Cache setup
id: cache_setup
uses: ./.github/actions/cache_setup
with:
hermes-version: ${{ inputs.hermes-version }}
react-native-version: ${{ inputs.react-native-version }}
- name: Download npm package artifact
uses: actions/[email protected]
with:
name: react-native-package
path: build
- name: Run yarn
shell: bash
run: yarn install --non-interactive
- name: Setup Hermes workspace
uses: ./.github/actions/setup_hermes_workspace
- name: Setup ruby
uses: ruby/[email protected]
with:
ruby-version: ${{ inputs.ruby-version }}
- name: Set HERMES_ENGINE_TARBALL_PATH
if: inputs.jsengine == 'Hermes'
shell: bash
run: |
BUILD_TYPE="${{ inputs.flavor }}"
TARBALL_FILENAME=$(node ./packages/react-native/scripts/hermes/get-tarball-name.js --buildType "$BUILD_TYPE")
echo "export HERMES_ENGINE_TARBALL_PATH=$HERMES_WS_DIR/hermes-runtime-darwin/$TARBALL_FILENAME" >> $GITHUB_ENV
- name: Create iOS template project
shell: bash
run: |
PACKAGE=$(cat build/react-native-package-version)
PATH_TO_PACKAGE="$GITHUB_WORKSPACE/build/$PACKAGE"
node ./scripts/releases/update-template-package.js "{\"react-native\":\"file:$PATH_TO_PACKAGE\"}"
node ./scripts/e2e/init-template-e2e.js --projectName $PROJECT_NAME --templatePath "$GITHUB_WORKSPACE/packages/react-native" --directory "/tmp/$PROJECT_NAME" --verbose
- name: Yarn install in template project
shell: bash
run: |
cd /tmp/$PROJECT_NAME/android/
yarn install --non-interactive
- name: Install iOS dependencies - Configuration ${{ inputs.flavor }}; New Architecture ${{ inputs.architecture }}; JS Engine ${{ inputs.jsengine }}
shell: bash
run: |
cd /tmp/$PROJECT_NAME/ios
cd packages/helloworld
args=()

if [[ ${{ inputs.architecture }} == "NewArch" ]]; then
export RCT_NEW_ARCH_ENABLED=1
fi

if [[ ${{ inputs.jsengine }} == "JSC" ]]; then
export USE_HERMES=0
if [[ ${{ inputs.architecture }} == "OldArch" ]]; then
args+=(--arch old)
fi

if [[ ${{ inputs.use-frameworks }} == "DynamicFrameworks" ]]; then
export USE_FRAMEWORKS=dynamic
args+=(--frameworks dynamic)
fi

cd ..
bundle install
bundle exec pod install --project-directory=ios
- name: Build template project
if [[ ${{ inputs.jsengine }} == "JSC" ]]; then
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_ENGINE_TARBALL_PATH="$HERMES_PATH" yarn bootstrap ios "${args[@]}" | cat
fi
- name: Build HelloWorld project
shell: bash
run: |
xcodebuild build \
-configuration ${{ inputs.flavor }} \
-workspace /tmp/$PROJECT_NAME/ios/$PROJECT_NAME.xcworkspace \
-scheme $PROJECT_NAME \
-sdk iphonesimulator
cd packages/helloworld
args=()
if [[ ${{ inputs.flavor }} == "Release" ]]; then
args+=(--prod)
fi
yarn build ios "${args[@]}" | cat
yarn bundle ios "${args[@]}" | cat
55 changes: 34 additions & 21 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
run: |
echo "Setting release type to nightly"
echo "RELEASE_TYPE=nightly" >> $GITHUB_OUTPUT

prepare_hermes_workspace:
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -75,6 +76,7 @@ jobs:
cp -r packages/react-native/sdks/hermes/* $HERMES_WS_DIR/hermes/.

echo ${{ steps.hermes-version.outputs.version }}

build_hermesc_apple:
runs-on: macos-13
needs: prepare_hermes_workspace
Expand Down Expand Up @@ -104,6 +106,7 @@ jobs:
cd ./packages/react-native/sdks/hermes || exit 1
. ./utils/build-apple-framework.sh
build_host_hermesc_if_needed

build_apple_slices_hermes:
runs-on: macos-14
needs: [build_hermesc_apple, prepare_hermes_workspace]
Expand Down Expand Up @@ -133,18 +136,19 @@ jobs:
- name: Check if the required artifacts already exist
id: check_if_apple_artifacts_are_there
run: |
if ${{ matrix.flavor == 'Debug' }} && \\
${{ steps.cache_setup.outputs.cache-hit-hermes-tarball-debug == true }} && \
${{ steps.cache_setup.outputs.cache-hit-macos-bin-debug == true }} && \
${{ steps.cache_setup.outputs.cache-hit-dsym-debug == true }} ; then
echo "ARTIFACTS_EXIST=true" >> $GITHUB_ENV
fi
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 ${{ matrix.flavor == 'Release' }} && \\
${{ steps.cache_setup.outputs.cache-hit-hermes-tarball-release == true }} && \
${{ steps.cache_setup.outputs.cache-hit-macos-bin-release == true }} && \
${{ steps.cache_setup.outputs.cache-hit-dsym-release == true }} ; then
if [[ -d "$OSX_BIN" ]] && \
[[ -d "$DSYM" ]] && \
[[ -f "$HERMES" ]]; then

echo "Artifacts are there!"
echo "ARTIFACTS_EXIST=true" >> $GITHUB_ENV
echo "ARTIFACTS_EXIST=true" >> $GITHUB_OUTPUT
fi
- name: Build the Hermes ${{ matrix.slice }} frameworks
if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != true }}
Expand All @@ -160,6 +164,11 @@ jobs:
exit 0
fi

if [[ "$ARTIFACTS_EXIST" ]]; then
echo "[HERMES] Skipping! Artifacts exists already."
exit 0
fi

if [[ "$SLICE" == "macosx" ]]; then
echo "[HERMES] Building Hermes for MacOS"
BUILD_TYPE="${{ matrix.flavor }}" ./utils/build-mac-framework.sh
Expand Down Expand Up @@ -192,6 +201,7 @@ jobs:
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 }}

build_hermes_macos:
runs-on: macos-13
needs: [build_apple_slices_hermes, prepare_hermes_workspace]
Expand Down Expand Up @@ -221,20 +231,20 @@ jobs:
- name: Check if the required artifacts already exist
id: check_if_apple_artifacts_are_there
run: |
if ${{ matrix.flavor == 'Debug' }} &&
${{ steps.cache_setup.outputs.cache-hit-hermes-tarball-debug == true }} && \
${{ steps.cache_setup.outputs.cache-hit-macos-bin-debug == true }} && \
${{ steps.cache_setup.outputs.cache-hit-dsym-debug == true }} ; then
echo "ARTIFACTS_EXIST=true" >> $GITHUB_ENV
fi
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

if ${{ matrix.flavor == 'Release' }} && \\
${{ steps.cache_setup.outputs.cache-hit-hermes-tarball-release == true }} && \
${{ steps.cache_setup.outputs.cache-hit-macos-bin-release == true }} && \
${{ steps.cache_setup.outputs.cache-hit-dsym-release == true }} ; then
echo "Artifacts are there!"
echo "ARTIFACTS_EXIST=true" >> $GITHUB_ENV
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 }}
run: yarn install --non-interactive
Expand Down Expand Up @@ -365,6 +375,7 @@ jobs:
with:
name: hermes-dSYM-${{ matrix.flavor }}
path: /tmp/hermes/dSYM/${{ matrix.flavor }}

build_hermesc_linux:
runs-on: ubuntu-latest
needs: prepare_hermes_workspace
Expand Down Expand Up @@ -409,6 +420,7 @@ jobs:
with:
name: hermes-linux-bin
path: /tmp/hermes/linux64-bin

build_hermesc_windows:
runs-on: windows-2019
needs: prepare_hermes_workspace
Expand Down Expand Up @@ -489,6 +501,7 @@ jobs:
with:
name: hermes-win64-bin
path: D:\tmp\hermes\win64-bin\

build_android:
runs-on: 8-core-ubuntu
needs: [set_release_type]
Expand Down
Loading
Loading