Skip to content

Commit a0a299d

Browse files
authored
Tomun/yaml (#4)
* Initial yaml Azure DevOps build scripts * Added missing parameter * OCMock framework symlinks were broken * Change syntax of template parameter variable in script * Added env: tag to pass template parameter into bash script * Try again to get variable passed to script * Try removing underscores from variable name. * Try again * Try without quotes * Experiment * Cleaned up script
1 parent 76bf7dc commit a0a299d

14 files changed

+246
-0
lines changed

.ado/ado-test-cleanup.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
# Script used by the Azure DevOps build agent to cleanup the packager and web socket server
5+
# after the XCode test step has completed
6+
7+
# kill whatever is occupying port 8081 (packager)
8+
lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill
9+
# kill whatever is occupying port 5555 (web socket server)
10+
lsof -i tcp:5555 | awk 'NR!=1 {print $2}' | xargs kill
11+
12+
osascript <<'EOF'
13+
tell application "Terminal"
14+
set winlist to windows where name contains "React Packager" or name contains "Metro Bundler" or name contains "Web Socket Test Server"
15+
repeat with win in winlist
16+
tell application "Terminal" to close win
17+
end repeat
18+
end tell
19+
EOF
20+
21+
# clear packager cache
22+
rm -fr $TMPDIR/react-*
23+
24+
# clear watchman state
25+
rm -rf /usr/local/var/run/watchman/*
26+
watchman watch-del-all
27+
28+
# dump the log files created by launchPackager.command and launchWebSocketServer.command
29+
THIS_DIR=$(dirname "$0")
30+
PACKAGER_LOG="${THIS_DIR}/launchPackager.log"
31+
WEBSOCKET_LOG="${THIS_DIR}/../IntegrationTests/launchWebSocketServer.log"
32+
if [ -f "$PACKAGER_LOG" ]; then
33+
cat "$PACKAGER_LOG"
34+
fi
35+
if [ -f "$WEBSOCKET_LOG" ]; then
36+
cat "$WEBSOCKET_LOG"
37+
fi

.ado/ado-test-setup.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
# Script used by the Azure DevOps build agent to start the packager and web socket server
5+
6+
THIS_DIR=$PWD
7+
8+
# Start the packager
9+
osascript -e "tell application \"Terminal\" to do script \"cd ${THIS_DIR}; export SERVERS_NO_WAIT=1; ./scripts/launchPackager.command\""
10+
11+
# Start the WebSocket test server
12+
osascript -e "tell application \"Terminal\" to do script \"cd ${THIS_DIR}; export SERVERS_NO_WAIT=1; ./IntegrationTests/launchWebSocketServer.command\""

.ado/apple-pr.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This file defines the Apple PR build steps used during the CI loop
2+
name: $(Date:yyyyMMdd).$(Rev:.r)
3+
4+
trigger: none # will disable CI builds entirely
5+
6+
pr:
7+
- master
8+
9+
jobs:
10+
- job: AppleRNPR
11+
displayName: Apple React Native PR
12+
strategy:
13+
matrix:
14+
ios:
15+
packager_platform: 'ios'
16+
xcode_sdk: iphonesimulator
17+
xcode_scheme: 'RNTester'
18+
xcode_destination: 'platform=iOS Simulator,OS=latest,name=iPhone 5s'
19+
tvos:
20+
packager_platform: 'ios'
21+
xcode_sdk: appletvsimulator
22+
xcode_scheme: 'RNTester-tvOS'
23+
xcode_destination: 'platform=tvOS Simulator,OS=latest,name=Apple TV'
24+
macos:
25+
packager_platform: 'macos'
26+
xcode_sdk: macosx
27+
xcode_scheme: 'RNTester-macOS'
28+
xcode_destination: 'platform=macOS,arch=x86_64'
29+
pool:
30+
demands: ['xcode', 'sh', 'npm']
31+
timeoutInMinutes: 60 # how long to run the job before automatically cancelling
32+
cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them
33+
steps:
34+
- template: templates/apple-job-react-native.yml
35+
parameters:
36+
packager_platform: $(packager_platform)
37+
xcode_sdk: $(xcode_sdk)
38+
xcode_configuration: $(xcode_configuration)
39+
xcode_scheme: $(xcode_scheme)
40+
xcode_actions: $(xcode_actions)
41+
xcode_destination: $(xcode_destination)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#
2+
# Task Group: ISS Install Apple certs and provisioning profiles
3+
#
4+
steps:
5+
- task: InstallAppleCertificate@2
6+
displayName: 'Install an Apple certificate BudiOSDevCert.p12'
7+
inputs:
8+
certSecureFile: '18ab5b38-0542-459f-a6d4-295fbdbbd08f'
9+
10+
- task: InstallAppleCertificate@2
11+
displayName: 'Install an Apple certificate BudMacDevCert.p12'
12+
inputs:
13+
certSecureFile: '321fd796-a04d-461d-a674-f00fda7f2295'
14+
15+
- task: InstallAppleProvisioningProfile@1
16+
displayName: 'Install an Apple provisioning profile iOS_Team_Provisioning_Profile.mobileprovision'
17+
inputs:
18+
provProfileSecureFile: '7dd1fc59-ccab-4c54-a8ac-f792efc4a855'
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
parameters:
2+
packager_platform: ''
3+
xcode_sdk: ''
4+
xcode_configuration: ''
5+
xcode_scheme: ''
6+
xcode_actions: ''
7+
xcode_destination: ''
8+
9+
steps:
10+
# Clean DerivedData
11+
- script: |
12+
rm -rf $(Build.Repository.LocalPath)/DerivedData
13+
displayName: 'Clean DerivedData'
14+
15+
# Install the required components specified in the Brewfile file.
16+
- script: 'brew bundle'
17+
displayName: 'brew bundle'
18+
19+
# Task Group: XCode select proper version
20+
- template: apple-xcode-select.yml
21+
22+
# Task Group: ISS Install Apple certs and provisioning profiles
23+
- template: apple-install-certs.yml
24+
25+
- task: CmdLine@2
26+
displayName: npm install
27+
inputs:
28+
script: npm install
29+
30+
- task: ShellScript@2
31+
displayName: 'Setup packager and WebSocket test server'
32+
inputs:
33+
scriptPath: '.ado/ado-test-setup.sh'
34+
disableAutoCwd: true
35+
cwd: ''
36+
37+
- bash: |
38+
echo Preparing the packager for platform $PLATFORM
39+
curl --retry-connrefused --connect-timeout 5 --max-time 10 --retry 10 --retry-delay 5 --retry-max-time 120 "http://localhost:8081/IntegrationTests/IntegrationTestsApp.bundle?platform=${PLATFORM}&dev=true" -o /dev/null
40+
env:
41+
PLATFORM: ${{ parameters.packager_platform }}
42+
displayName: 'curl the packager'
43+
44+
- template: apple-xcode-build.yml
45+
parameters:
46+
xcode_sdk: ${{ parameters.xcode_sdk }}
47+
xcode_configuration: Debug
48+
xcode_workspacePath: RNTester/RNTester.xcodeproj
49+
xcode_scheme: ${{ parameters.xcode_scheme }}
50+
xcode_actions: 'build test'
51+
xcode_useXcpretty: true
52+
xcode_destination: ${{ parameters.xcode_destination }}
53+
54+
- template: apple-xcode-build.yml
55+
parameters:
56+
xcode_sdk: ${{ parameters.xcode_sdk }}
57+
xcode_configuration: Release
58+
xcode_workspacePath: RNTester/RNTester.xcodeproj
59+
xcode_scheme: ${{ parameters.xcode_scheme }}
60+
xcode_actions: 'build'
61+
xcode_useXcpretty: false
62+
xcode_destination: ${{ parameters.xcode_destination }}
63+
64+
- task: ShellScript@2
65+
displayName: 'Cleanup packager and WebSocket test server'
66+
inputs:
67+
scriptPath: '.ado/ado-test-cleanup.sh'
68+
disableAutoCwd: true
69+
cwd: ''
70+
condition: always()

.ado/templates/apple-xcode-build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
parameters:
2+
xcode_sdk: ''
3+
xcode_configuration: ''
4+
xcode_workspacePath: ''
5+
xcode_scheme: ''
6+
xcode_actions: ''
7+
xcode_useXcpretty: false
8+
xcode_destination: ''
9+
xcode_extraArgs: ''
10+
11+
steps:
12+
- task: Xcode@5
13+
displayName: 'XCode ${{ parameters.xcode_actions }} ${{ parameters.xcode_configuration }} ${{ parameters.xcode_sdk }} ${{ parameters.xcode_scheme }}'
14+
inputs:
15+
actions: '${{ parameters.xcode_actions }}'
16+
configuration: ${{ parameters.xcode_configuration }}
17+
sdk: ${{ parameters.xcode_sdk }}
18+
xcWorkspacePath: ${{ parameters.xcode_workspacePath }}
19+
scheme: ${{ parameters.xcode_scheme }}
20+
xcodeVersion: 10
21+
signingOption: auto
22+
packageApp: false
23+
teamId: '$(XCodeSigningMicrosoftTeamID)'
24+
args: '-destination "${{ parameters.xcode_destination }}" ONLY_ACTIVE_ARCH=NO -verbose -UseModernBuildSystem=NO -derivedDataPath DerivedData ${{ parameters.xcode_extraArgs }}'
25+
exportPath: '$(agent.builddirectory)/output/${{ parameters.xcode_sdk }}/${{ parameters.xcode_configuration }}'
26+
useXcpretty: ${{ parameters.xcode_useXcpretty }}
27+
publishJUnitResults: ${{ parameters.xcode_useXcpretty }}
28+
xctoolReporter: 'junit:test-results.xml'

.ado/templates/apple-xcode-select.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#
2+
# Task Group: XCode select proper version
3+
#
4+
steps:
5+
# The XCODE_10_DEVELOPER_DIR variable is defined in the Hosted Agents and is used by the Xcode@5 tasks.
6+
# The 'OE Mac Pool' agents do not define this variable, so manually set it here if it is not defined.
7+
- script: |
8+
if [ -z $XCODE_10_DEVELOPER_DIR ]; then
9+
DIR='/Applications/Xcode_10.1.app/Contents/Developer/'
10+
if [ ! -d $DIR ]; then
11+
DIR='/Applications/Xcode.app/Contents/Developer/'
12+
fi
13+
if [ -d $DIR ]; then
14+
echo "##vso[task.setvariable variable=XCODE_10_DEVELOPER_DIR;]$DIR"
15+
else
16+
(>&2 echo "No Xcode found.")
17+
fi
18+
fi
19+
displayName: 'Ensure XCODE_10_DEVELOPER_DIR'
20+
failOnStderr: true
21+
22+
# The DEVELOPER_DIR variable is used by xcodebuild to specify the version of Xcode to use.
23+
# Set the variable here so that npm components and CMake build steps get the latest XCode version
24+
# instead of whatever version is the default on the build agent.
25+
- script: |
26+
echo "##vso[task.setvariable variable=DEVELOPER_DIR;]$XCODE_10_DEVELOPER_DIR"
27+
displayName: 'Set DEVELOPER_DIR'
28+
29+
- script: |
30+
REQUIRED=10.1
31+
VER=`xcodebuild -version | head -n1 | cut -d' ' -f2`
32+
if (( $(echo "$VER >= $REQUIRED" | bc -l) )); then
33+
echo "XCode version $VER is active."
34+
else
35+
(>&2 echo "Must have XCode $REQUIRED or later.")
36+
fi
37+
displayName: 'Check XCode version'
38+
failOnStderr: true

Brewfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
brew "node@8", link: true
2+
brew "watchman"

RNTester/RNTesterUnitTests/OCMock.framework/Headers

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Headers

RNTester/RNTesterUnitTests/OCMock.framework/Modules

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Modules

RNTester/RNTesterUnitTests/OCMock.framework/OCMock

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/OCMock

RNTester/RNTesterUnitTests/OCMock.framework/Resources

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Resources

RNTester/RNTesterUnitTests/OCMock.framework/Versions/A/OCMock

100644100755
File mode changed.

RNTester/RNTesterUnitTests/OCMock.framework/Versions/Current

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A

0 commit comments

Comments
 (0)