diff --git a/.ado/Brewfile b/.ado/Brewfile index fe53a9df8fa83a..bfe131072dcace 100644 --- a/.ado/Brewfile +++ b/.ado/Brewfile @@ -1 +1,2 @@ brew "xcbeautify" +brew "ccache" diff --git a/.ado/jobs/build-test-rntester.yml b/.ado/jobs/build-test-rntester.yml index 5c3dd7ba568735..30950b4e93287d 100644 --- a/.ado/jobs/build-test-rntester.yml +++ b/.ado/jobs/build-test-rntester.yml @@ -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: @@ -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' diff --git a/.ado/scripts/xcodebuild.sh b/.ado/scripts/xcodebuild.sh old mode 100644 new mode 100755 index e9b6521af70281..243cd0fd8e38e2 --- a/.ado/scripts/xcodebuild.sh +++ b/.ado/scripts/xcodebuild.sh @@ -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]+)\)' @@ -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]+)\)' @@ -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" \ @@ -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 diff --git a/.ado/templates/apple-xcode-build.yml b/.ado/templates/apple-xcode-build.yml deleted file mode 100644 index b96577b0a690da..00000000000000 --- a/.ado/templates/apple-xcode-build.yml +++ /dev/null @@ -1,13 +0,0 @@ -parameters: - xcode_sdk: '' - xcode_configuration: 'debug' - xcode_workspacePath: '' - xcode_scheme: '' - xcode_actions: '' - -steps: - - task: CmdLine@2 - displayName: Xcode ${{ parameters.xcode_actions }} ${{ parameters.xcode_configuration }} ${{ parameters.xcode_sdk }} ${{ parameters.xcode_scheme }} ${{ parameters.xcode_displayNameTags }} - inputs: - script: | - set -eox pipefail && xcodebuild -sdk ${{ parameters.xcode_sdk }} -configuration ${{ parameters.xcode_configuration }} -workspace ${{ parameters.xcode_workspacePath }} -scheme ${{ parameters.xcode_scheme }} ${{ parameters.xcode_actions }} CODE_SIGNING_ALLOWED=no ${{ parameters.xcode_extraArgs }} | xcbeautify --report junit