Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9d020bc

Browse filesBrowse files
committed
Use 2 stages for MacOS builds
* Add a dedicated stage to each OSX build to download/build brew packages * Remove bottle building logic and the corresponding trace output from the project build stage
1 parent e93bb93 commit 9d020bc
Copy full SHA for 9d020bc

File tree

3 files changed

+135
-34
lines changed
Filter options

3 files changed

+135
-34
lines changed

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+108-20Lines changed: 108 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,144 +34,232 @@ cache:
3434
# `cache: ccache: true` has no effect if `language:` is not `c` or `cpp`
3535
- $HOME/.ccache
3636

37+
# Add more cache stages (s2 etc) and corresponding OSX jobs like s1
38+
# if brew builds start to take longer than one Travis time limit
39+
stages:
40+
- s1
41+
- final
42+
3743
matrix:
3844
fast_finish: true
3945
include:
4046

4147
# default builds for MacOS
42-
- os: osx
48+
- &osx-10
49+
os: osx
4350
osx_image: xcode8.3
4451
env:
4552
- MB_PYTHON_VERSION=2.7
4653
- ENABLE_CONTRIB=0
4754
- ENABLE_HEADLESS=0
48-
- os: osx
55+
stage: final
56+
- <<: *osx-10
57+
stage: s1
58+
- &osx-30
59+
os: osx
4960
osx_image: xcode8.3
5061
env:
5162
- MB_PYTHON_VERSION=3.4
5263
- ENABLE_CONTRIB=0
5364
- ENABLE_HEADLESS=0
54-
- os: osx
65+
stage: final
66+
- <<: *osx-30
67+
stage: s1
68+
- &osx-40
69+
os: osx
5570
osx_image: xcode8.3
5671
env:
5772
- MB_PYTHON_VERSION=3.5
5873
- ENABLE_CONTRIB=0
5974
- ENABLE_HEADLESS=0
60-
- os: osx
75+
stage: final
76+
- <<: *osx-40
77+
stage: s1
78+
- &osx-50
79+
os: osx
6180
osx_image: xcode8.3
6281
env:
6382
- MB_PYTHON_VERSION=3.6
6483
- ENABLE_CONTRIB=0
6584
- ENABLE_HEADLESS=0
66-
- os: osx
85+
stage: final
86+
- <<: *osx-50
87+
stage: s1
88+
- &osx-60
89+
os: osx
6790
osx_image: xcode8.3
6891
env:
6992
- MB_PYTHON_VERSION=3.7
7093
- ENABLE_CONTRIB=0
7194
- ENABLE_HEADLESS=0
7295
- TEST_DEPENDS=numpy==1.14.5
96+
stage: final
97+
- <<: *osx-60
98+
stage: s1
7399

74100
# headless builds for MacOS
75-
- os: osx
101+
- &osx-70
102+
os: osx
76103
osx_image: xcode8.3
77104
env:
78105
- MB_PYTHON_VERSION=2.7
79106
- ENABLE_CONTRIB=0
80107
- ENABLE_HEADLESS=1
81-
- os: osx
108+
stage: final
109+
- <<: *osx-70
110+
stage: s1
111+
- &osx-80
112+
os: osx
82113
osx_image: xcode8.3
83114
env:
84115
- MB_PYTHON_VERSION=3.4
85116
- ENABLE_CONTRIB=0
86117
- ENABLE_HEADLESS=1
87-
- os: osx
118+
stage: final
119+
- <<: *osx-80
120+
stage: s1
121+
- &osx-90
122+
os: osx
88123
osx_image: xcode8.3
89124
env:
90125
- MB_PYTHON_VERSION=3.5
91126
- ENABLE_CONTRIB=0
92127
- ENABLE_HEADLESS=1
93-
- os: osx
128+
stage: final
129+
- <<: *osx-90
130+
stage: s1
131+
- &osx-100
132+
os: osx
94133
osx_image: xcode8.3
95134
env:
96135
- MB_PYTHON_VERSION=3.6
97136
- ENABLE_CONTRIB=0
98137
- ENABLE_HEADLESS=1
99-
- os: osx
138+
stage: final
139+
- <<: *osx-100
140+
stage: s1
141+
- &osx-110
142+
os: osx
100143
osx_image: xcode8.3
101144
env:
102145
- MB_PYTHON_VERSION=3.7
103146
- ENABLE_CONTRIB=0
104147
- ENABLE_HEADLESS=1
105148
- TEST_DEPENDS=numpy==1.14.5
149+
stage: final
150+
- <<: *osx-110
151+
stage: s1
106152

107153
# Contrib builds for MacOS
108-
- os: osx
154+
- &osx-120
155+
os: osx
109156
osx_image: xcode8.3
110157
env:
111158
- MB_PYTHON_VERSION=2.7
112159
- ENABLE_CONTRIB=1
113160
- ENABLE_HEADLESS=0
114-
- os: osx
161+
stage: final
162+
- <<: *osx-120
163+
stage: s1
164+
- &osx-130
165+
os: osx
115166
osx_image: xcode8.3
116167
env:
117168
- MB_PYTHON_VERSION=3.4
118169
- ENABLE_CONTRIB=1
119170
- ENABLE_HEADLESS=0
120-
- os: osx
171+
stage: final
172+
- <<: *osx-130
173+
stage: s1
174+
- &osx-140
175+
os: osx
121176
osx_image: xcode8.3
122177
env:
123178
- MB_PYTHON_VERSION=3.5
124179
- ENABLE_CONTRIB=1
125180
- ENABLE_HEADLESS=0
126-
- os: osx
181+
stage: final
182+
- <<: *osx-140
183+
stage: s1
184+
- &osx-150
185+
os: osx
127186
osx_image: xcode8.3
128187
env:
129188
- MB_PYTHON_VERSION=3.6
130189
- ENABLE_CONTRIB=1
131190
- ENABLE_HEADLESS=0
132-
- os: osx
191+
stage: final
192+
- <<: *osx-150
193+
stage: s1
194+
- &osx-160
195+
os: osx
133196
osx_image: xcode8.3
134197
env:
135198
- MB_PYTHON_VERSION=3.7
136199
- ENABLE_CONTRIB=1
137200
- ENABLE_HEADLESS=0
138201
- TEST_DEPENDS=numpy==1.14.5
202+
stage: final
203+
- <<: *osx-160
204+
stage: s1
139205

140206
# headless contrib builds for MacOS
141-
- os: osx
207+
- &osx-170
208+
os: osx
142209
osx_image: xcode8.3
143210
env:
144211
- MB_PYTHON_VERSION=2.7
145212
- ENABLE_CONTRIB=1
146213
- ENABLE_HEADLESS=1
147-
- os: osx
214+
stage: final
215+
- <<: *osx-170
216+
stage: s1
217+
- &osx-180
218+
os: osx
148219
osx_image: xcode8.3
149220
env:
150221
- MB_PYTHON_VERSION=3.4
151222
- ENABLE_CONTRIB=1
152223
- ENABLE_HEADLESS=1
153-
- os: osx
224+
stage: final
225+
- <<: *osx-180
226+
stage: s1
227+
- &osx-190
228+
os: osx
154229
osx_image: xcode8.3
155230
env:
156231
- MB_PYTHON_VERSION=3.5
157232
- ENABLE_CONTRIB=1
158233
- ENABLE_HEADLESS=1
159-
- os: osx
234+
stage: final
235+
- <<: *osx-190
236+
stage: s1
237+
- &osx-200
238+
os: osx
160239
osx_image: xcode8.3
161240
env:
162241
- MB_PYTHON_VERSION=3.6
163242
- ENABLE_CONTRIB=1
164243
- ENABLE_HEADLESS=1
165-
- os: osx
244+
stage: final
245+
- <<: *osx-200
246+
stage: s1
247+
- &osx-210
248+
os: osx
166249
osx_image: xcode8.3
167250
env:
168251
- MB_PYTHON_VERSION=3.7
169252
- ENABLE_CONTRIB=1
170253
- ENABLE_HEADLESS=1
171254
- TEST_DEPENDS=numpy==1.14.5
255+
stage: final
256+
- <<: *osx-210
257+
stage: s1
172258

173259
# default builds for Linux
174260
- os: linux
261+
# the following jobs will use the same stage name by default
262+
stage: s1
175263
env:
176264
- MB_PYTHON_VERSION=2.7
177265
- ENABLE_CONTRIB=0

‎config.sh

Copy file name to clipboardExpand all lines: config.sh
+23-12Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ if [ -n "$IS_OSX" ]; then
3737
"ffmpeg_opencv 10" \
3838
)
3939

40-
#Contrib adds significantly to project's build time
41-
if [ "$ENABLE_CONTRIB" -eq 1 ]; then
42-
BREW_TIME_LIMIT=$((BREW_TIME_LIMIT - 10*60))
43-
fi
44-
4540
function generate_ffmpeg_formula {
4641
local FF="ffmpeg"
4742
local LFF="ffmpeg_opencv"
@@ -92,9 +87,14 @@ function pre_build {
9287

9388
if [ -n "$IS_OSX" ]; then
9489
echo "Running for OSX"
90+
91+
local CACHE_STAGE; (echo "$TRAVIS_BUILD_STAGE_NAME" | grep -qiF "final") || CACHE_STAGE=1
9592

96-
brew update
97-
brew_add_local_bottles
93+
#after the cache stage, all bottles and Homebrew metadata should be already cached locally
94+
if [ -n "$CACHE_STAGE" ]; then
95+
brew update
96+
brew_add_local_bottles
97+
fi
9898

9999
# Don't query analytical info online on `brew info`,
100100
# this takes several seconds and we don't need it
@@ -104,14 +104,25 @@ function pre_build {
104104
echo 'Installing QT4'
105105
brew tap | grep -qxF cartr/qt4 || brew tap cartr/qt4
106106
brew tap --list-pinned | grep -qxF cartr/qt4 || brew tap-pin cartr/qt4
107-
brew_install_and_cache_within_time_limit qt@4 || { [ $? -gt 1 ] && return 2 || return 0; }
107+
if [ -n "$CACHE_STAGE" ]; then
108+
brew_install_and_cache_within_time_limit qt@4 || { [ $? -gt 1 ] && return 2 || return 0; }
109+
else
110+
brew install qt@4
111+
fi
108112

109113
echo 'Installing FFmpeg'
110114

111-
generate_ffmpeg_formula
112-
local IS_BOTTLE_AVAILABLE; _brew_is_bottle_available ffmpeg_opencv && IS_BOTTLE_AVAILABLE=1 || IS_BOTTLE_AVAILABLE=0
113-
_brew_install_and_cache ffmpeg_opencv "$IS_BOTTLE_AVAILABLE"
114-
#brew_install_and_cache_within_time_limit ffmpeg_opencv || { [ $? -gt 1 ] && return 2 || return 0; }
115+
if [ -n "$CACHE_STAGE" ]; then
116+
generate_ffmpeg_formula
117+
brew_install_and_cache_within_time_limit ffmpeg_opencv || { [ $? -gt 1 ] && return 2 || return 0; }
118+
else
119+
brew install ffmpeg_opencv
120+
fi
121+
122+
if [ -n "$CACHE_STAGE" ]; then
123+
brew_go_bootstrap_mode 0
124+
return 0
125+
fi
115126

116127
# Have to install macpython late to avoid conflict with Homebrew Python update
117128
before_install

‎travis_osx_brew_cache.sh

Copy file name to clipboardExpand all lines: travis_osx_brew_cache.sh
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ BREW_TIME_START=$(($TRAVIS_TIMER_START_TIME/10**9))
1010

1111
# If after a package is built, elapsed time is more than this many seconds, fail the build but save Travis cache
1212
# The cutoff moment should leave enough time till Travis' job time limit to process the main project.
13-
BREW_TIME_LIMIT=$((30*60))
13+
# Since we have moved deps into a separate stage, we don't need to leave time for the project any more
14+
BREW_TIME_LIMIT=$((38*60))
1415
# If a slow-building package is about to be built and the projected build end moment is beyond this many seconds,
1516
# skip that build, fail the Travis job and save Travis cache.
1617
# This cutoff should leave enough time for before_cache and cache save.
@@ -207,6 +208,7 @@ function brew_cache_cleanup {
207208
function brew_go_bootstrap_mode {
208209
# Can be overridden
209210
# Terminate the build but ensure saving the cache
211+
local EXIT_CODE=${1:-1}
210212

211213
echo "Going into cache bootstrap mode"
212214

@@ -223,7 +225,7 @@ function brew_go_bootstrap_mode {
223225
224226
# Travis runs user scripts via `eval` i.e. in the same shell process.
225227
# So have to unset errexit in order to get to cache save stage
226-
set +e; return 1
228+
set +e; return '"$EXIT_CODE"'
227229
}'
228230
}
229231

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.