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 85a0964

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

File tree

3 files changed

+57
-12
lines changed
Filter options

3 files changed

+57
-12
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
+14-10Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ echo "=== Loading config.sh === "
77

88
# To see build progress
99
function build_wheel {
10-
build_bdist_wheel $@
10+
build_bdist_wheel $@ || return $?
1111
}
1212

1313
function bdist_wheel_cmd {
@@ -16,19 +16,23 @@ function bdist_wheel_cmd {
1616
local abs_wheelhouse=$1
1717
if [ -n "$IS_OSX" ]; then
1818
source travis_osx_build.sh
19-
build_bdist_osx_wheel . $@ || return $?
19+
build_bdist_osx_wheel . $@
2020
else
2121
CI_BUILD=1 pip wheel --verbose --wheel-dir="$PWD/dist" . $BDIST_PARAMS
2222
fi
23-
cp dist/*.whl $abs_wheelhouse
24-
if [ -z "$IS_OSX" ]; then
25-
TOOLS_PATH=/opt/_internal/tools
26-
/opt/python/cp37-cp37m/bin/python -m venv $TOOLS_PATH
27-
source $TOOLS_PATH/bin/activate
28-
python patch_auditwheel_whitelist.py
29-
deactivate
23+
local err_code=$?
24+
if [ -n "$USE_CCACHE" ]; then ccache -s; fi
25+
if [ $err_code -eq 0 ]; then
26+
cp dist/*.whl $abs_wheelhouse
27+
if [ -z "$IS_OSX" ]; then
28+
TOOLS_PATH=/opt/_internal/tools
29+
/opt/python/cp37-cp37m/bin/python -m venv $TOOLS_PATH
30+
source $TOOLS_PATH/bin/activate
31+
python patch_auditwheel_whitelist.py
32+
deactivate
33+
fi
3034
fi
31-
if [ -n "$USE_CCACHE" -a -z "$BREW_BOOTSTRAP_MODE" ]; then ccache -s; fi
35+
return $err_code
3236
}
3337

3438
if [ -n "$IS_OSX" ]; then

‎travis_osx_build.sh

Copy file name to clipboardExpand all lines: travis_osx_build.sh
+32-2Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,43 @@ 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 '"$cmd"' { return 0; }
30+
function repair_wheelhouse { return 0; }
31+
function install_run {'\
32+
"$(if [ -n "$MESSAGE" ]; then
33+
echo \
34+
' echo -e "\n'"$MESSAGE"'\n"'
35+
fi)"\
36+
'
37+
# Travis runs user scripts via `eval` i.e. in the same shell process.
38+
# So have to unset errexit in order to get to cache save stage
39+
set +e; return '"$EXIT_CODE"'
40+
}'
41+
}
42+
1343
function pre_build_osx {
1444
local repo_dir=$(abspath ${1:-$REPO_DIR})
1545
local build_dir="$repo_dir/opencv/build"
1646
local num_cpus=$(sysctl -n hw.ncpu)
1747
num_cpus=${num_cpus:-4}
1848
local travis_start_time=$(($TRAVIS_TIMER_START_TIME/10**9))
19-
local time_limit=$((30*60))
49+
local time_limit=$((25*60))
2050

2151
cd "$repo_dir"
2252
git submodule sync
@@ -132,7 +162,7 @@ function pre_build_osx {
132162
# Check time limit (3min should be enough for a module to built)
133163
local projected_time=$(($(date +%s) - travis_start_time + 3 * 60))
134164
if [ $projected_time -ge $time_limit ]; then
135-
echo "*** Not enough time to build $m: $((projected_time/60))m (${projected_time}s)"
165+
goto_exit
136166
return 1
137167
fi
138168
make -j${num_cpus} "$m"

0 commit comments

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