|
| 1 | +name: test_ios_rntester |
| 2 | +description: Test iOS RNTester |
| 3 | +inputs: |
| 4 | + jsengine: |
| 5 | + description: Which JavaScript engine to use. Must be one of "Hermes", "JSC". |
| 6 | + default: Hermes |
| 7 | + use-frameworks: |
| 8 | + description: The dependency building and linking strategy to use. Must be one of "StaticLibraries", "DynamicFrameworks" |
| 9 | + default: StaticLibraries |
| 10 | + architecture: |
| 11 | + description: The React Native architecture to Test. RNTester has always Fabric enabled, but we want to run integration test with the old arch setup |
| 12 | + default: NewArch |
| 13 | + ruby-version: |
| 14 | + description: The version of ruby that must be used |
| 15 | + default: 2.6.10 |
| 16 | + run-unit-tests: |
| 17 | + description: whether unit tests should run or not. |
| 18 | + default: false |
| 19 | + hermes-tarball-artifacts-dir: |
| 20 | + description: The directory where the hermes tarball artifacts are stored |
| 21 | + default: /tmp/hermes/hermes-runtime-darwin |
| 22 | + flavor: |
| 23 | + description: The flavor of the build. Must be one of "Debug", "Release". |
| 24 | + default: Debug |
| 25 | + hermes-version: |
| 26 | + description: The version of hermes |
| 27 | + required: true |
| 28 | + react-native-version: |
| 29 | + description: The version of react-native |
| 30 | + required: true |
| 31 | +runs: |
| 32 | + using: composite |
| 33 | + steps: |
| 34 | + - name: Setup xcode |
| 35 | + uses: ./.github/actions/setup-xcode |
| 36 | + - name: Setup node.js |
| 37 | + uses: ./.github/actions/setup-node |
| 38 | + - name: Run yarn |
| 39 | + shell: bash |
| 40 | + run: yarn install --non-interactive |
| 41 | + - name: Cache setup |
| 42 | + id: cache_setup |
| 43 | + uses: ./.github/actions/cache_setup |
| 44 | + with: |
| 45 | + hermes-version: ${{ inputs.hermes-version }} |
| 46 | + react-native-version: ${{ inputs.react-native-version }} |
| 47 | + - name: Setup ruby |
| 48 | + |
| 49 | + with: |
| 50 | + ruby-version: ${{ inputs.ruby-version }} |
| 51 | + - name: Prepare IOS Tests |
| 52 | + if: ${{ inputs.run-unit-tests == true }} |
| 53 | + uses: ./.github/actions/prepare_ios_tests |
| 54 | + - name: Set HERMES_ENGINE_TARBALL_PATH envvar if Hermes tarball is present |
| 55 | + shell: bash |
| 56 | + run: | |
| 57 | + HERMES_TARBALL_ARTIFACTS_DIR=${{ inputs.hermes-tarball-artifacts-dir }} |
| 58 | + if [ ! -d $HERMES_TARBALL_ARTIFACTS_DIR ]; then |
| 59 | + echo "Hermes tarball artifacts dir not present ($HERMES_TARBALL_ARTIFACTS_DIR). Build Hermes from source." |
| 60 | + exit 0 |
| 61 | + fi |
| 62 | +
|
| 63 | + if [ ! -d ~/react-native ]; then |
| 64 | + echo "No React Native checkout found. Run `checkout` first." |
| 65 | + exit 0 |
| 66 | + fi |
| 67 | +
|
| 68 | + TARBALL_FILENAME=$(node ./packages/react-native/scripts/hermes/get-tarball-name.js --buildType "${{ inputs.flavor }}") |
| 69 | + TARBALL_PATH=$HERMES_TARBALL_ARTIFACTS_DIR/$TARBALL_FILENAME |
| 70 | +
|
| 71 | + echo "Looking for $TARBALL_FILENAME in $HERMES_TARBALL_ARTIFACTS_DIR" |
| 72 | + echo "$TARBALL_PATH" |
| 73 | +
|
| 74 | + if [ ! -f $TARBALL_PATH ]; then |
| 75 | + echo "Hermes tarball not present ($TARBALL_PATH). Build Hermes from source." |
| 76 | + exit 0 |
| 77 | + fi |
| 78 | +
|
| 79 | + echo "Found Hermes tarball at $TARBALL_PATH" |
| 80 | + echo "HERMES_ENGINE_TARBALL_PATH=$TARBALL_PATH" >> $GITHUB_ENV |
| 81 | + - name: Print Hermes version |
| 82 | + shell: bash |
| 83 | + run: | |
| 84 | + HERMES_TARBALL_ARTIFACTS_DIR=${{ inputs.hermes-tarball-artifacts-dir }} |
| 85 | + TARBALL_FILENAME=$(node ./packages/react-native/scripts/hermes/get-tarball-name.js --buildType "${{ inputs.flavor }}") |
| 86 | + TARBALL_PATH=$HERMES_TARBALL_ARTIFACTS_DIR/$TARBALL_FILENAME |
| 87 | + if [[ -e $TARBALL_PATH ]]; then |
| 88 | + tar -xf $TARBALL_PATH |
| 89 | + echo 'print(HermesInternal?.getRuntimeProperties?.()["OSS Release Version"])' > test.js |
| 90 | + ./destroot/bin/hermes test.js |
| 91 | + rm test.js |
| 92 | + rm -rf destroot |
| 93 | + else |
| 94 | + echo 'No Hermes tarball found.' |
| 95 | + fi |
| 96 | + - name: Setup xcode build cache |
| 97 | + uses: ./.github/actions/setup_xcode_build_cache |
| 98 | + with: |
| 99 | + hermes-version: ${{ inputs.hermes-version }} |
| 100 | + - name: Install CocoaPods dependencies |
| 101 | + shell: bash |
| 102 | + run: | |
| 103 | + if [[ ${{ inputs.jsengine }} == "JSC" ]]; then |
| 104 | + export USE_HERMES=0 |
| 105 | + fi |
| 106 | +
|
| 107 | + if [[ ${{ inputs.use-frameworks }} == "DynamicFrameworks" ]]; then |
| 108 | + export USE_FRAMEWORKS=dynamic |
| 109 | + fi |
| 110 | +
|
| 111 | + if [[ ${{ inputs.architecture }} == "NewArch" ]]; then |
| 112 | + export RCT_NEW_ARCH_ENABLED=1 |
| 113 | + fi |
| 114 | +
|
| 115 | + cd packages/rn-tester |
| 116 | +
|
| 117 | + bundle install |
| 118 | + bundle exec pod install |
| 119 | + - name: Build RNTester |
| 120 | + if: ${{ inputs.run-unit-tests != true }} |
| 121 | + shell: bash |
| 122 | + run: | |
| 123 | + xcodebuild build \ |
| 124 | + -workspace packages/rn-tester/RNTesterPods.xcworkspace \ |
| 125 | + -scheme RNTester \ |
| 126 | + -sdk iphonesimulator |
| 127 | + - name: "Run Tests: iOS Unit and Integration Tests" |
| 128 | + if: ${{ inputs.run-unit-tests == true }} |
| 129 | + shell: bash |
| 130 | + run: node ./scripts/circleci/run_with_retry.js 3 yarn test-ios |
| 131 | + - name: Zip Derived data folder |
| 132 | + if: ${{ inputs.run-unit-tests == true }} |
| 133 | + shell: bash |
| 134 | + run: | |
| 135 | + echo "zipping tests results" |
| 136 | + cd /Users/distiller/Library/Developer/Xcode |
| 137 | + XCRESULT_PATH=$(find . -name '*.xcresult') |
| 138 | + tar -zcvf xcresults.tar.gz $XCRESULT_PATH |
| 139 | + - name: Upload artifact |
| 140 | + |
| 141 | + if: ${{ inputs.run-unit-tests == true }} |
| 142 | + with: |
| 143 | + name: xcresults |
| 144 | + path: /Users/distiller/Library/Developer/Xcode/xcresults.tar.gz |
| 145 | + - name: Report bundle size |
| 146 | + if: ${{ inputs.run-unit-tests == true }} |
| 147 | + uses: ./.github/actions/report_bundle_size |
| 148 | + with: |
| 149 | + platform: ios |
| 150 | + - name: Store test results |
| 151 | + if: ${{ inputs.run-unit-tests == true }} |
| 152 | + |
| 153 | + with: |
| 154 | + name: test-results |
| 155 | + path: ./reports/junit |
0 commit comments