mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
1c33774990
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53177 This action is used only when running tests for RNTester. Now that we are using prebuilds, this is a liability, because Cocoapods and Xcode would not update the binary if a new one is provided. With prebuild, this caching does not provide a lot of benefits, so we can remove it. ## Changelog [Internal] - Reviewed By: cortinico Differential Revision: D79893870 fbshipit-source-id: 0773f910f418cf9ebd5d557d563160993084e83a
167 lines
6.1 KiB
YAML
167 lines
6.1 KiB
YAML
name: test-ios-rntester
|
|
description: Test iOS RNTester
|
|
inputs:
|
|
use-frameworks:
|
|
description: The dependency building and linking strategy to use. Must be one of "StaticLibraries", "DynamicFrameworks"
|
|
default: StaticLibraries
|
|
ruby-version:
|
|
description: The version of ruby that must be used
|
|
default: 2.6.10
|
|
run-unit-tests:
|
|
description: whether unit tests should run or not.
|
|
default: "false"
|
|
hermes-tarball-artifacts-dir:
|
|
description: The directory where the hermes tarball artifacts are stored
|
|
default: /tmp/hermes/hermes-runtime-darwin
|
|
flavor:
|
|
description: The flavor of the build. Must be one of "Debug", "Release".
|
|
default: Debug
|
|
hermes-version:
|
|
description: The version of hermes
|
|
required: true
|
|
react-native-version:
|
|
description: The version of react-native
|
|
required: true
|
|
run-e2e-tests:
|
|
description: Whether we want to run E2E tests or not
|
|
required: false
|
|
default: false
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Setup xcode
|
|
uses: ./.github/actions/setup-xcode
|
|
- name: Setup node.js
|
|
uses: ./.github/actions/setup-node
|
|
- name: Run yarn
|
|
uses: ./.github/actions/yarn-install
|
|
- name: Download Hermes
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: hermes-darwin-bin-${{ inputs.flavor }}
|
|
path: ${{ inputs.hermes-tarball-artifacts-dir }}
|
|
- name: Setup ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: ${{ inputs.ruby-version }}
|
|
- name: Prepare IOS Tests
|
|
if: ${{ inputs.run-unit-tests == 'true' }}
|
|
uses: ./.github/actions/prepare-ios-tests
|
|
- name: Set HERMES_ENGINE_TARBALL_PATH envvar if Hermes tarball is present
|
|
shell: bash
|
|
run: |
|
|
HERMES_TARBALL_ARTIFACTS_DIR=${{ inputs.hermes-tarball-artifacts-dir }}
|
|
if [ ! -d $HERMES_TARBALL_ARTIFACTS_DIR ]; then
|
|
echo "Hermes tarball artifacts dir not present ($HERMES_TARBALL_ARTIFACTS_DIR). Build Hermes from source."
|
|
exit 0
|
|
fi
|
|
|
|
TARBALL_FILENAME=$(node ./packages/react-native/scripts/hermes/get-tarball-name.js --buildType "${{ inputs.flavor }}")
|
|
TARBALL_PATH=$HERMES_TARBALL_ARTIFACTS_DIR/$TARBALL_FILENAME
|
|
|
|
echo "Looking for $TARBALL_FILENAME in $HERMES_TARBALL_ARTIFACTS_DIR"
|
|
echo "$TARBALL_PATH"
|
|
|
|
if [ ! -f $TARBALL_PATH ]; then
|
|
echo "Hermes tarball not present ($TARBALL_PATH). Build Hermes from source."
|
|
exit 0
|
|
fi
|
|
|
|
echo "Found Hermes tarball at $TARBALL_PATH"
|
|
echo "HERMES_ENGINE_TARBALL_PATH=$TARBALL_PATH" >> $GITHUB_ENV
|
|
- name: Print Hermes version
|
|
shell: bash
|
|
run: |
|
|
HERMES_TARBALL_ARTIFACTS_DIR=${{ inputs.hermes-tarball-artifacts-dir }}
|
|
TARBALL_FILENAME=$(node ./packages/react-native/scripts/hermes/get-tarball-name.js --buildType "${{ inputs.flavor }}")
|
|
TARBALL_PATH=$HERMES_TARBALL_ARTIFACTS_DIR/$TARBALL_FILENAME
|
|
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
|
|
else
|
|
echo 'No Hermes tarball found.'
|
|
fi
|
|
- name: Download ReactNativeDependencies
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ReactNativeDependencies${{ inputs.flavor }}.xcframework.tar.gz
|
|
path: /tmp/third-party/
|
|
- name: Print third-party folder
|
|
shell: bash
|
|
run: ls -lR /tmp/third-party
|
|
- name: Download React Native Prebuilds
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ReactCore${{ inputs.flavor }}.xcframework.tar.gz
|
|
path: /tmp/ReactCore
|
|
- name: Print ReactCore folder
|
|
shell: bash
|
|
run: ls -lR /tmp/ReactCore
|
|
- name: Install CocoaPods dependencies
|
|
shell: bash
|
|
run: |
|
|
export HERMES_ENGINE_TARBALL_PATH=$HERMES_ENGINE_TARBALL_PATH
|
|
export RCT_USE_LOCAL_RN_DEP="/tmp/third-party/ReactNativeDependencies${{ inputs.flavor }}.xcframework.tar.gz"
|
|
export RCT_TESTONLY_RNCORE_TARBALL_PATH="/tmp/ReactCore/ReactCore${{ inputs.flavor }}.xcframework.tar.gz"
|
|
|
|
if [[ ${{ inputs.use-frameworks }} == "DynamicFrameworks" ]]; then
|
|
export USE_FRAMEWORKS=dynamic
|
|
fi
|
|
|
|
cd packages/rn-tester
|
|
|
|
bundle install
|
|
bundle exec pod install
|
|
- name: Build RNTester
|
|
shell: bash
|
|
run: |
|
|
xcodebuild \
|
|
-scheme "RNTester" \
|
|
-workspace packages/rn-tester/RNTesterPods.xcworkspace \
|
|
-configuration "${{ inputs.flavor }}" \
|
|
-sdk "iphonesimulator" \
|
|
-destination "generic/platform=iOS Simulator" \
|
|
-derivedDataPath "/tmp/RNTesterBuild"
|
|
|
|
echo "Print path to *.app file"
|
|
APP_PATH=$(find "/tmp/RNTesterBuild" -type d -name "*.app")
|
|
|
|
echo "App found at $APP_PATH"
|
|
echo "app-path=$APP_PATH" >> $GITHUB_ENV
|
|
- name: "Run Tests: iOS Unit and Integration Tests"
|
|
if: ${{ inputs.run-unit-tests == 'true' }}
|
|
shell: bash
|
|
run: yarn test-ios
|
|
|
|
- name: Zip Derived data folder
|
|
if: ${{ inputs.run-unit-tests == 'true' }}
|
|
shell: bash
|
|
run: |
|
|
echo "zipping tests results"
|
|
cd /Users/distiller/Library/Developer/Xcode
|
|
XCRESULT_PATH=$(find . -name '*.xcresult')
|
|
tar -zcvf xcresults.tar.gz $XCRESULT_PATH
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4.3.4
|
|
if: ${{ inputs.run-unit-tests == 'true' }}
|
|
with:
|
|
name: xcresults
|
|
path: /Users/distiller/Library/Developer/Xcode/xcresults.tar.gz
|
|
- name: Upload RNTester App
|
|
if: ${{ inputs.use-frameworks == 'StaticLibraries' && inputs.ruby-version == '2.6.10' }} # This is needed to avoid conflicts with the artifacts
|
|
uses: actions/upload-artifact@v4.3.4
|
|
with:
|
|
name: RNTesterApp-NewArch-${{ inputs.flavor }}
|
|
path: ${{ env.app-path }}
|
|
- name: Store test results
|
|
if: ${{ inputs.run-unit-tests == 'true' }}
|
|
uses: actions/upload-artifact@v4.3.4
|
|
with:
|
|
name: test-results
|
|
path: ./reports/junit
|