forked from azawawi/SwiftyZeroMQ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
145 lines (122 loc) · 4.71 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
language: objective-c
osx_image: xcode8.2
env:
global:
- LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8
- PROJECT=SwiftyZeroMQ.xcodeproj
# iOS
- IOS_SDK=iphonesimulator10.3
- IOS_FRAMEWORK_SCHEME="SwiftyZeroMQ-iOS"
# macOS
- MACOS_SDK=macosx10.12
- MACOS_FRAMEWORK_SCHEME="SwiftyZeroMQ-macOS"
# tvOS
- TVOS_SDK=appletvsimulator10.2
- TVOS_FRAMEWORK_SCHEME="SwiftyZeroMQ-tvOS"
# watchOS
- WATCHOS_SDK=watchsimulator3.2
- WATCHOS_FRAMEWORK_SCHEME="SwiftyZeroMQ-watchOS"
matrix:
# iOS 10.0
- DESTINATION="OS=10.0,name=iPhone 6"
SIMULATOR_NAME="iPhone 6 (10.0)"
SCHEME="$IOS_FRAMEWORK_SCHEME"
SDK="$IOS_SDK"
RUN_TESTS="YES"
POD_LINT="YES"
EXAMPLE_PROJECT="Example-iOS"
# iOS 9.0
- DESTINATION="OS=9.0,name=iPhone 5"
SIMULATOR_NAME="iPhone 5 (9.0)"
SCHEME="$IOS_FRAMEWORK_SCHEME"
SDK="$IOS_SDK"
RUN_TESTS="YES"
POD_LINT="NO"
EXAMPLE_PROJECT="Example-iOS"
# macOS, no need for a simulator :)
- DESTINATION="arch=x86_64"
SIMULATOR_NAME=""
SCHEME="$MACOS_FRAMEWORK_SCHEME"
SDK="$MACOS_SDK"
RUN_TESTS="YES"
POD_LINT="NO"
EXAMPLE_PROJECT="Example-macOS"
# tvOS 10.0
- DESTINATION="OS=10.0,name=Apple TV 1080p"
SIMULATOR_NAME="Apple TV 1080p (10.1)"
SCHEME="$TVOS_FRAMEWORK_SCHEME"
SDK="$TVOS_SDK"
RUN_TESTS="YES"
POD_LINT="NO"
EXAMPLE_PROJECT="Example-tvOS"
# tvOS 9.0
- DESTINATION="OS=9.0,name=Apple TV 1080p"
SIMULATOR_NAME="Apple TV 1080p (9.0)"
SCHEME="$TVOS_FRAMEWORK_SCHEME"
SDK="$TVOS_SDK"
RUN_TESTS="YES"
POD_LINT="NO"
EXAMPLE_PROJECT="Example-tvOS"
# watchOS 3.1 (no tests, just build)
- DESTINATION="OS=3.1,name=Apple Watch - 42mm"
SIMULATOR_NAME=""
SCHEME="$WATCHOS_FRAMEWORK_SCHEME"
SDK="$WATCHOS_SDK"
RUN_TESTS="NO"
POD_LINT="NO"
EXAMPLE_PROJECT="Example-watchOS"
# watchOS 2.0 (no tests, just build)
- DESTINATION="OS=2.0,name=Apple Watch - 42mm"
SIMULATOR_NAME=""
SCHEME="$WATCHOS_FRAMEWORK_SCHEME"
SDK="$WATCHOS_SDK"
RUN_TESTS="NO"
POD_LINT="NO"
EXAMPLE_PROJECT="Example-watchOS"
before_install:
# Install CocoaPods
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
script:
# Set pipe fail flag
- set -o pipefail
# show debug information
- xcodebuild -version
- xcodebuild -showsdks
# Prelaunch simulator and wait a bit
# Use simulator id, please see https://github.com/travis-ci/travis-ci/issues/4906
- if [ "$SIMULATOR_NAME" != "" ]; then
echo Finding simulator id for \'$SIMULATOR_NAME\';
SIMULATOR_ID=$(xcrun instruments -s | grep -o "$SIMULATOR_NAME \[.*\]" | grep -o "\[.*\]" | sed "s/^\[\(.*\)\]$/\1/");
echo Opening simulator with id \'$SIMULATOR_ID\';
open -a "simulator" --args -CurrentDeviceUDID $SIMULATOR_ID;
sleep 10;
fi
# Build framework in debug and run tests if specified
- if [ $RUN_TESTS == "YES" ]; then
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty;
else
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty;
fi
# Workaround to random travis CI failure
# See https://github.com/travis-ci/travis-ci/issues/4725
- sleep 10
# Build framework in release and run tests if specified
- if [ $RUN_TESTS == "YES" ]; then
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty;
else
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty;
fi
# Build Example project in Debug
- if [ $EXAMPLE_PROJECT == "Example-watchOS" ]; then
(cd "Examples/$EXAMPLE_PROJECT" && (xcodebuild -project "Example-watchOS.xcodeproj" -scheme "Example-watchOS WatchKit App" -destination "platform=iOS Simulator,OS=10.2,id=8188B40E-F57F-4519-AC47-E43D884B9016" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty));
else
(cd "Examples/$EXAMPLE_PROJECT" && (xcodebuild -project "${EXAMPLE_PROJECT}.xcodeproj" -scheme "$EXAMPLE_PROJECT" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty));
fi
# Run CocoaPods pod validation if specified
- if [ $POD_LINT == "YES" ]; then
pod lib lint;
fi
# Workaround to random travis CI failure
# See https://github.com/travis-ci/travis-ci/issues/4725
- sleep 10