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 d559afb

Browse filesBrowse files
committed
Try not to exit the build when timeout is reached
1 parent 9e05f3a commit d559afb
Copy full SHA for d559afb

File tree

3 files changed

+57
-15
lines changed
Filter options

3 files changed

+57
-15
lines changed

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ install: |
8585
python setup.py sdist
8686
else
8787
build_wheel $REPO_DIR $PLAT
88+
ret_code=$?
8889
fi
8990
9091
set +x
@@ -105,8 +106,18 @@ script: |
105106
trap ERR
106107
test "$rc" -eq 0
107108
109+
after_failure: |
110+
# after_failure
111+
echo "Error code after <install>:" $ret_code
112+
108113
after_success: |
109114
# Upload wheels to pypi if tag is set
115+
if [[ $SDIST != 0 ]]; then
116+
echo "Error code after <install>:" $ret_code
117+
if [[ $ret_code != 0 ]]; then
118+
exit $ret_code
119+
fi
120+
fi
110121
111122
set -x; set +e
112123

‎travis_config.sh

Copy file name to clipboardExpand all lines: travis_config.sh
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ echo "=== Loading config.sh === "
77

88
# To see build progress
99
function build_wheel {
10-
build_bdist_wheel $@
10+
if [ -n "$IS_OSX" ]; then
11+
source travis_osx_build.sh
12+
build_bdist_osx_wheel . $@ || return $?
13+
else
14+
build_bdist_wheel $@
15+
fi
1116
}
1217

1318
function bdist_wheel_cmd {
1419
# copied from multibuild's common_utils.sh
1520
# add osx deployment target so it doesnt default to 10.6
1621
local abs_wheelhouse=$1
17-
if [ -n "$IS_OSX" ]; then
18-
source travis_osx_build.sh
19-
build_bdist_osx_wheel . $@ || return $?
20-
else
21-
CI_BUILD=1 pip wheel --verbose --wheel-dir="$PWD/dist" . $BDIST_PARAMS
22-
fi
22+
CI_BUILD=1 pip wheel --verbose --wheel-dir="$PWD/dist" . $BDIST_PARAMS
2323
cp dist/*.whl $abs_wheelhouse
2424
if [ -z "$IS_OSX" ]; then
2525
TOOLS_PATH=/opt/_internal/tools

‎travis_osx_build.sh

Copy file name to clipboardExpand all lines: travis_osx_build.sh
+39-8Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,47 @@ function package_name() {
1010
wheel_name=$name
1111
}
1212

13+
# Terminate the build but ensure saving the cache
14+
function goto_exit {
15+
local EXIT_CODE=${1:-1}
16+
17+
echo "Exiting build"
18+
19+
# Can't just `exit` because that would terminate the build without saving the cache
20+
# Have to replace further actions with no-ops
21+
22+
local MESSAGE=""; if [ "$EXIT_CODE" -ne 0 ]; then
23+
MESSAGE='Building package took too long. Restart the build in Travis UI to continue from cache.'
24+
fi
25+
26+
set +e
27+
28+
eval '
29+
function install_run {'\
30+
"$(if [ -n "$MESSAGE" ]; then
31+
echo ' echo -e "\n'"$MESSAGE"'\n"'
32+
fi)"\
33+
'
34+
# Travis runs user scripts via `eval` i.e. in the same shell process.
35+
# So have to unset errexit in order to get to cache save stage
36+
set +e
37+
return '"$EXIT_CODE"'
38+
}'
39+
}
40+
1341
function pre_build_osx {
1442
local repo_dir=$(abspath ${1:-$REPO_DIR})
1543
local build_dir="$repo_dir/opencv/build"
1644
local num_cpus=$(sysctl -n hw.ncpu)
1745
num_cpus=${num_cpus:-4}
1846
local travis_start_time=$(($TRAVIS_TIMER_START_TIME/10**9))
19-
local time_limit=$((30*60))
47+
local time_limit=$((25*60))
2048

2149
cd "$repo_dir"
2250
git submodule sync
2351
git submodule update --init --recursive opencv
2452
git submodule update --init --recursive opencv_contrib
2553

26-
pip install scikit-build
27-
pip install numpy
28-
2954
if [ ! -d "$build_dir" ]; then
3055
mkdir "$build_dir"
3156
fi
@@ -132,7 +157,8 @@ function pre_build_osx {
132157
# Check time limit (3min should be enough for a module to built)
133158
local projected_time=$(($(date +%s) - travis_start_time + 3 * 60))
134159
if [ $projected_time -ge $time_limit ]; then
135-
echo "*** Not enough time to build $m: $((projected_time/60))m (${projected_time}s)"
160+
ccache -s
161+
goto_exit
136162
return 1
137163
fi
138164
make -j${num_cpus} "$m"
@@ -141,6 +167,7 @@ function pre_build_osx {
141167
fi
142168
done
143169
make -j${num_cpus}
170+
ccache -s
144171
}
145172

146173
function build_osx {
@@ -176,9 +203,13 @@ function build_osx {
176203
function build_bdist_osx_wheel {
177204
local repo_dir=$(abspath ${1:-$REPO_DIR})
178205
[ -z "$repo_dir" ] && echo "repo_dir not defined" && exit 1
206+
local wheelhouse=$(abspath ${WHEEL_SDIR:-wheelhouse})
207+
start_spinner
208+
if [ -n "$(is_function "pre_build")" ]; then pre_build; fi
209+
stop_spinner
210+
pip install scikit-build
211+
pip install numpy
179212
pre_build_osx "$repo_dir" || return $?
180-
if [ -n "$BUILD_DEPENDS" ]; then
181-
pip install $(pip_opts) $BUILD_DEPENDS
182-
fi
183213
build_osx "$repo_dir"
214+
repair_wheelhouse "$wheelhouse"
184215
}

0 commit comments

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