Skip to content

Commit

Permalink
[PLAT-12987] FIx React Native CLI iOS test (#2250)
Browse files Browse the repository at this point in the history
    Fix the React Native CLI iOS tests to ensure that they run on CI
    Ensure that CI tests fail if the Maze Runner tests fail
  • Loading branch information
joshedney authored Nov 1, 2024
1 parent 893a162 commit 7c5f5ee
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
3 changes: 1 addition & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
steps:

#
# License audit
#
- label: ":copyright: License Audit"
Expand All @@ -19,6 +17,7 @@ steps:
- docker-compose#v4.12.0:
run: minimal-packager
artifact_paths: min_packages.tar

- label: ":docker: Build and publish JS packages"
key: "publish-js"
timeout_in_minutes: 30
Expand Down
11 changes: 9 additions & 2 deletions scripts/react-native-cli-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = {
}

common.changeDir(`${destFixtures}/${rnVersion}`)
const bugsnagCliCommand = './node_modules/.bin/bugsnag-cli upload react-native-android --upload-api-root-url=http://localhost:9339 --overwrite'
const bugsnagCliCommand = 'npm run bugsnag:upload-rn-android -- --overwrite'
common.run(bugsnagCliCommand, true)

// Finally, copy the APK back to the host
Expand Down Expand Up @@ -89,9 +89,16 @@ module.exports = {
// Clean and build the archive
common.changeDir(`${initialDir}/${fixturesDir}/${rnVersion}/ios`)
common.run(`rm -rf ../${rnVersion}.xcarchive`, true)
common.run('pod install || pod install --repo-update', true)
common.run('bundle install')
common.run('bundle exec pod install || bundle exec pod install --repo-update', true)
const buildCmd = `xcodebuild -workspace ${rnVersion}.xcworkspace -scheme ${rnVersion} -configuration Release -sdk iphoneos build`
common.run(buildCmd, true)
const archiveCmd = `xcrun xcodebuild -scheme "${rnVersion}" -workspace "${rnVersion}.xcworkspace" -configuration Release -archivePath "../${rnVersion}.xcarchive" -allowProvisioningUpdates archive`
common.run(archiveCmd, true)

common.changeDir(`${initialDir}/${fixturesDir}/${rnVersion}`)
const bugsnagCliCommand = 'npm run bugsnag:upload-rn-ios -- --overwrite'
common.run(bugsnagCliCommand, true)
} catch (e) {
console.error(e, e.stack)
process.exit(1)
Expand Down
4 changes: 2 additions & 2 deletions test/react-native-cli/features/fixtures/rn0_69/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '2.7.5'

gem 'cocoapods', '~> 1.11', '>= 1.11.2'
gem 'xcodeproj', '< 1.26.0'
gem 'cocoapods', '1.14.3'
gem 'xcodeproj', '< 1.26.0'
15 changes: 2 additions & 13 deletions test/react-native-cli/scripts/init-and-build-test.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
VERSION=$1
set -euo pipefail

function check_status {
if [[ $1 != 0 ]]; then
popd
exit $1
fi
}
VERSION=$1

# Build the app within Maze Runner, checking for the source map upload
mkdir -p build
pushd test/react-native-cli
bundle install
REACT_NATIVE_VERSION=$VERSION bundle exec maze-runner features/build-app-tests/build-ios-app.feature

# TODO: Reinstate as part of PLAT-6764
#check_status $?

# Export the IPA separately from MazeRunner (running it inside failed for an unknown reason)
cd features/fixtures
xcrun --log xcodebuild -exportArchive -archivePath "${VERSION}/${VERSION}.xcarchive" -exportPath output -verbose -exportOptionsPlist exportOptions.plist
check_status $?

# Clear the archive away
rm -rf ${VERSION}/${VERSION}.xcarchive

# Copy file to build directory, ensuring the exit code bubbles up
cp output/${VERSION}.ipa ../../../../build
STATUS=$?
popd
exit $STATUS

0 comments on commit 7c5f5ee

Please sign in to comment.