Skip to content

Commit

Permalink
[CI] Refactor Apple CI (#3118)
Browse files Browse the repository at this point in the history
* [CI] Update to macOS 13 / Xcode 15

* Dont pre boot simulator

* yarn dedupe

* (test) Determine iOS SDK version

* Degrade to iOS 16.4

* Test

* no boot

* macos too

* Back to iOS 17.0

* Update to react-native 0.71.14

* Downgrade to Xcode 14.2

* Undo yarn lock and package json changes

* more downgrade

* Switch back to internal

* more slight changes

* No android update.. again
  • Loading branch information
Saadnajmi authored Oct 20, 2023
1 parent a62457e commit a55dd40
Show file tree
Hide file tree
Showing 12 changed files with 321 additions and 300 deletions.
4 changes: 2 additions & 2 deletions .ado/azure-pipelines.publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ variables:
- group: InfoSec-SecurityResults
- name: tags
value: production,externalfacing
- template: variables/vars.yml

jobs:
- job: NPMPublish
Expand Down Expand Up @@ -88,8 +89,7 @@ jobs:
- job: NuGetPublish
displayName: NuGet Publish
pool:
vmImage: 'internal-macos12'
demands: ['xcode', 'sh', 'npm']
vmImage: $(VmImageApple)
variables:
- name: BUILDSECMON_OPT_IN
value: true
Expand Down
61 changes: 32 additions & 29 deletions .ado/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pr:
- main

variables:
CI: true
- template: variables/vars.yml

jobs:
# Dedicated task to build JS code, including jest tests, snapshot testing, and linting, because these things can be super
Expand Down Expand Up @@ -67,8 +67,7 @@ jobs:
- job: macOSPR
displayName: macOS PR
pool:
vmImage: 'internal-macos12'
demands: ['xcode', 'sh', 'npm']
vmImage: $(VmImageApple)
variables:
platform: 'macos'
timeoutInMinutes: 60 # how long to run the job before automatically cancelling
Expand All @@ -78,14 +77,6 @@ jobs:
- checkout: self
persistCredentials: true

# Clean Derived Data
- script: |
rm -rf $(Build.Repository.LocalPath)/DerivedData
displayName: 'Clean DerivedData'
- script: |
sudo gem install cocoapods
displayName: 'Install Cocoapods Environment'
- template: templates/setup-repo-min-build.yml

- script: |
Expand All @@ -95,13 +86,20 @@ jobs:
# Select proper Xcode version
- template: templates/apple-xcode-select.yml
parameters:
xcode_version: $(xcode_version)
xcode_path: $(xcode_path)

- bash: |
echo "pod install $(platform)"
pod install
workingDirectory: apps/fluent-tester/$(platform)
displayName: 'pod install $(platform)'
- script: |
brew install xcbeautify
displayName: 'Install xcbeautify'
- bash: |
echo "yarn $(platform)"
yarn $(platform)
Expand All @@ -113,8 +111,7 @@ jobs:
- job: iOSPR
displayName: iOS PR
pool:
vmImage: 'internal-macos12'
demands: ['xcode', 'sh', 'npm']
vmImage: $(VmImageApple)
variables:
platform: 'ios'
timeoutInMinutes: 60 # how long to run the job before automatically cancelling
Expand All @@ -124,14 +121,6 @@ jobs:
- checkout: self
persistCredentials: true

# Clean Derived Data
- script: |
rm -rf $(Build.Repository.LocalPath)/DerivedData
displayName: 'Clean DerivedData'
- script: |
sudo gem install cocoapods
displayName: 'Install Cocoapods Environment'
- template: templates/setup-repo-min-build.yml

- script: |
Expand All @@ -141,25 +130,39 @@ jobs:
# Select proper Xcode version
- template: templates/apple-xcode-select.yml
parameters:
xcode_version: $(xcode_version)
xcode_path: $(xcode_path)

- bash: |
echo "pod install $(platform)"
pod install
workingDirectory: apps/fluent-tester/$(platform)
displayName: 'pod install $(platform)'
- bash: |
echo "Pre boot simulator"
UDID=$(xcrun simctl create test-iphone com.apple.CoreSimulator.SimDeviceType.iPhone-14 com.apple.CoreSimulator.SimRuntime.iOS-16-2)
xcrun simctl boot $UDID
workingDirectory: apps/fluent-tester
displayName: 'Boot simulator'
- script: |
brew install xcbeautify
displayName: 'Install xcbeautify'
- script: |
xcrun simctl list
displayName: 'List Simulators'
- script: |
xcrun --sdk iphonesimulator --show-sdk-version
displayName: 'Determine iOS SDK version'
# - script: |
# NEW_DEVICE=$(xcrun simctl create "Test Phone" "$(ios_simulator)" iOS$(ios_version))
# echo "🤖 Created ${NEW_DEVICE}"
# xcrun simctl boot ${NEW_DEVICE}
# displayName: 'Boot Simulator'

- bash: |
echo "yarn $(platform)"
yarn $(platform) --simulator "iPhone 14"
yarn $(platform) --simulator "$(ios_simulator)"
workingDirectory: apps/fluent-tester
displayName: 'yarn $(platform)x'
displayName: 'yarn $(platform)'
- template: templates/e2e-testing-ios.yml

Expand Down
10 changes: 0 additions & 10 deletions .ado/scripts/xcode_select_current_version.sh

This file was deleted.

3 changes: 2 additions & 1 deletion .ado/templates/android-dep-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ steps:
targetType: 'inline'
script: |
#!/usr/bin/env bash
set -ex
# Install AVD files
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-27;default;x86_64'
Expand All @@ -20,7 +21,7 @@ steps:
emulator_config=~/.android/avd/android_emulator.avd/config.ini
# The following is to support empty OR populated config.ini files,
# the state of which is dependant on the version of the emulator used (which we don't control),
# Replace existing config (NOTE we're on MacOS so sed works differently!)
# Replace existing config (NOTE we're on macOS so sed works differently!)
sed -i .bak 's/hw.lcd.density=.*/hw.lcd.density=420/' "$emulator_config"
sed -i .bak 's/hw.lcd.height=.*/hw.lcd.height=1920/' "$emulator_config"
sed -i .bak 's/hw.lcd.width=.*/hw.lcd.width=1080/' "$emulator_config"
Expand Down
6 changes: 6 additions & 0 deletions .ado/templates/apple-nuget-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ parameters:
type: boolean
default: false

variables:
- template: variables/vars.yml

steps:
- checkout: self
persistCredentials: true
Expand All @@ -21,6 +24,9 @@ steps:
# Select proper Xcode version
- template: apple-xcode-select.yml
parameters:
xcode_version: $(xcode_version)
xcode_path: $(xcode_path)

# Pod Install iOS
- bash: |
Expand Down
11 changes: 6 additions & 5 deletions .ado/templates/apple-xcode-select.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#
# Task Group: Xcode select proper version
#

parameters:
xcode_path_override: '' # Leaving this blank results in the repo default being applied
xcode_version: ''
xcode_path: ''

steps:
- bash: .ado/scripts/xcode_select_current_version.sh
displayName: 'Switch to current version of Xcode'
- bash: |
sudo xcode-select --switch '${{ parameters.xcode_path }}'
displayName: Switch Xcode version ${{ parameters.xcode_version }}
failOnStderr: true
env:
XCODE_PATH_OVERRIDE: ${{ parameters.xcode_path_override }}
6 changes: 6 additions & 0 deletions .ado/variables/vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
variables:
VmImageApple: internal-macos12
xcode_version: 'Xcode 14.2'
xcode_path: '/Applications/Xcode_14.2.app'
ios_version: '16.2.0'
ios_simulator: 'iPhone 14'
4 changes: 2 additions & 2 deletions apps/E2E/wdio.conf.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ exports.config = {
{
maxInstances: 1, // Maximum number of total parallel running workers.
platformName: 'iOS',
// Keep this in sync with the simulator we run in Azure Pipelines
// Keep this in sync with the simulator we run in Azure Pipelines, defined in `.ado/variables/vars.yml`
'appium:platformVersion': '16.2',
'appium:deviceName': 'iPhone 14',
'appium:automationName': 'XCUITest',
Expand Down Expand Up @@ -140,7 +140,7 @@ exports.config = {
*/
afterTest: (test, context, results) => {
const resultString = results.passed ? 'Passed' : 'Failed';
console.log(`\nTest Case: "${test.description}".\nResult: "${resultString}".\nDuration: "${(results.duration/600).toFixed(2)}s". \n`);
console.log(`\nTest Case: "${test.description}".\nResult: "${resultString}".\nDuration: "${(results.duration / 600).toFixed(2)}s". \n`);

// if test passed, ignore, else take and save screenshot. Unless it's the first test that boots the app,
// it may be useful to have a screenshot of the app on load.
Expand Down
18 changes: 9 additions & 9 deletions apps/fluent-tester/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ PODS:
- FRNAvatar (0.19.7):
- MicrosoftFluentUI (= 0.13.1)
- React
- FRNDatePicker (0.8.0):
- FRNDatePicker (0.9.1):
- MicrosoftFluentUI (= 0.13.1)
- React
- FRNFontMetrics (0.4.1):
Expand Down Expand Up @@ -493,13 +493,13 @@ PODS:
- React-Core
- React-cxxreact
- ReactCommon/turbomodule/core
- ReactTestApp-DevSupport (2.5.16):
- ReactTestApp-DevSupport (2.5.26):
- React-Core
- React-jsi
- ReactTestApp-Resources (1.0.0-dev)
- RNCPicker (2.5.0):
- RNCPicker (2.5.1):
- React-Core
- RNSVG (13.13.0):
- RNSVG (13.14.0):
- React-Core
- Yoga (1.14.0)

Expand Down Expand Up @@ -653,7 +653,7 @@ SPEC CHECKSUMS:
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
FRNAppearanceAdditions: ae112fef1bf92d0282c66b53eac14c1de22c97d2
FRNAvatar: 1db3235b5e4320685b7bc5e69f507632189b0f82
FRNDatePicker: 78b02a5ba9d7559d553b358271b1ec18ebecb1ec
FRNDatePicker: 9101a588417cf7351a619480f9eb7da8bfc10559
FRNFontMetrics: 41579c8c7cef1f816a894b6d3968461ef599f5c1
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
MicrosoftFluentUI: dde98d8ed3fc306d9ddd0a6f0bc0c1f24fe5275e
Expand Down Expand Up @@ -687,12 +687,12 @@ SPEC CHECKSUMS:
React-runtimeexecutor: 35cec6420c9d4144b0d06f9fdb093cf8f02bd52c
ReactCommon: 56296d2632e8eb53e94a2b7c0d05db694e164ca7
ReactNativeHost: 5caf8c9381f26c453fabbe8c3b87f6a013a3c459
ReactTestApp-DevSupport: 444613e05eef80e5d2ecb5302e44b9a7abc597fa
ReactTestApp-DevSupport: 092f0caf9902efaaba73b4a20f153e64bcee6daf
ReactTestApp-Resources: 3a5202e2bbbd3fb589d54d15f296a52a5659855f
RNCPicker: 32ca102146bc7d34a8b93a998d9938d9f9ec7898
RNSVG: ed492aaf3af9ca01bc945f7a149d76d62e73ec82
RNCPicker: 529d564911e93598cc399b56cc0769ce3675f8c8
RNSVG: d00c8f91c3cbf6d476451313a18f04d220d4f396
Yoga: 135109c9b8c5d1a8af3a58d21cd4c7aa7f3bf555

PODFILE CHECKSUM: b9fd154312c68d8d92a9ba6e8a2cac9fcf88b104

COCOAPODS: 1.12.1
COCOAPODS: 1.13.0
Loading

0 comments on commit a55dd40

Please sign in to comment.