Skip to content

Commit

Permalink
Update RNTA script for RNM use
Browse files Browse the repository at this point in the history
  • Loading branch information
Saadnajmi committed May 16, 2024
1 parent 952b1ff commit 16a1b3e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 43 deletions.
1 change: 1 addition & 0 deletions .ado/Brewfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
brew "xcbeautify"
brew "ccache"
35 changes: 20 additions & 15 deletions .ado/jobs/build-test-rntester.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,31 @@ jobs:
- task: CmdLine@2
displayName: yarn install
inputs:
script: yarn install --immutable
script: |
set -eox pipefail
yarn install --immutable
- task: CmdLine@2
displayName: pod install
inputs:
script: |
set -eox pipefail
cd packages/rn-tester
bundle install
bundle exec pod install
bundle exec pod install --verbose
env:
RCT_NEW_ARCH_ENABLED: ${{ slice.new_arch_enabled }}
USE_HERMES: ${{ slice.use_hermes }}

- task: CmdLine@2
displayName: Build ${{ slice.scheme }}
inputs:
script: |
set -eox pipefail
./.ado/scripts/xcodebuild.sh packages/rn-tester/RNTesterPods.xcworkspace ${{ slice.sdk }} ${{ slice.scheme }} build
env:
CCACHE_DISABLE: 1

- task: ShellScript@2
displayName: 'Setup packager and WebSocket test server'
inputs:
Expand All @@ -131,19 +143,12 @@ jobs:
PLATFORM: ${{ slice.packager_platform }}
displayName: 'curl the packager'
- template: /.ado/templates/apple-xcode-build.yml@self
parameters:
xcode_sdk: ${{ slice.sdk }}
xcode_workspacePath: packages/rn-tester/RNTesterPods.xcworkspace
xcode_scheme: ${{ slice.scheme }}
xcode_actions: 'build'

- template: /.ado/templates/apple-xcode-build.yml@self
parameters:
xcode_sdk: ${{ slice.sdk }}
xcode_workspacePath: packages/rn-tester/RNTesterPods.xcworkspace
xcode_scheme: ${{ slice.scheme }}
xcode_actions: 'test'
- task: CmdLine@2
displayName: Test ${{ slice.scheme }}
inputs:
script: |
set -eox pipefail
./.ado/scripts/xcodebuild.sh packages/rn-tester/RNTesterPods.xcworkspace ${{ slice.sdk }} ${{ slice.scheme }} test
- task: ShellScript@2
displayName: 'Cleanup packager and WebSocket test server'
Expand Down
27 changes: 12 additions & 15 deletions .ado/scripts/xcodebuild.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
set -eox pipefail

workspace=$1
action=$2
shift 2
sdk=$2
scheme=$3
action=$4

platform=$(grep -o '\w\+/ReactTestApp.xcodeproj' "$workspace/contents.xcworkspacedata")
shift 4

if [[ $platform == ios/* ]]; then

if [[ $sdk == iphoneos || $sdk == iphonesimulator ]]; then
if [[ $action == 'test' || $action == 'test-without-building' ]]; then
device=$(xcrun simctl list devices iPhone available)
re='iPhone [0-9]+ \(([-0-9A-Fa-f]+)\)'
Expand All @@ -17,12 +19,9 @@ if [[ $platform == ios/* ]]; then
else
destination='-destination "generic/platform=iOS Simulator"'
fi

skip_testing='-skip-testing:ReactTestAppTests/ReactNativePerformanceTests'
elif [[ $platform == macos/* ]]; then
elif [[ $sdk == macosx ]]; then
destination=''
skip_testing=''
elif [[ $platform == visionos/* ]]; then
elif [[ $sdk == xros || $sdk == xrsimulator ]]; then
if [[ $action == 'test' || $action == 'test-without-building' ]]; then
device=$(xcrun simctl list devices visionOS available)
re='Apple Vision Pro \(([-0-9A-Fa-f]+)\)'
Expand All @@ -32,20 +31,18 @@ elif [[ $platform == visionos/* ]]; then
else
destination='-destination "generic/platform=visionOS Simulator"'
fi

skip_testing='-skip-testing:ReactTestAppTests/ReactNativePerformanceTests'
else
echo "Cannot detect platform: $workspace"
echo "Cannot detect sdk: $sdk"
exit 1
fi

build_cmd=$(
echo xcodebuild \
-workspace "$workspace" \
-scheme ReactTestApp \
-scheme "$scheme" \
-sdk "$sdk" \
"$destination" \
-derivedDataPath $(dirname $workspace)/build \
"$skip_testing" \
CODE_SIGNING_ALLOWED=NO \
COMPILER_INDEX_STORE_ENABLE=NO \
"$action" \
Expand Down Expand Up @@ -73,7 +70,7 @@ if ! command -v xcbeautify 1> /dev/null; then
brew install xcbeautify
fi

eval "$build_cmd" | xcbeautify
eval "$build_cmd" | xcbeautify --report junit

if [[ "$CCACHE_DISABLE" != "1" ]]; then
ccache --show-stats --verbose
Expand Down
13 changes: 0 additions & 13 deletions .ado/templates/apple-xcode-build.yml

This file was deleted.

0 comments on commit 16a1b3e

Please sign in to comment.