Skip to content

Commit 66b336c

Browse files
authored
Use Travis stages instead of custom timeouts (#2948)
1 parent 5780fa6 commit 66b336c

File tree

1 file changed

+84
-21
lines changed

1 file changed

+84
-21
lines changed

.travis.yml

Lines changed: 84 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,89 @@ env:
3333
- secure: "RLzlMhfLqwSBrZqJOVOd61suXBn+HtUR3vOZfuFYF/Qmjjj5TE41+rObZmzc54hP/ZL+OH6blnibpvfDXlX+eN38ivFQfuxkJIGL68SJsEwNBRwW39Yw6Hl5RdI41MLCH7ByN15wifLp1JKBilHJ7XGMOUjI7P0yl7JjX8GBXUCtJbVLRugo80/yn+XQ1NdnlpbpYHNjMEQFWSODPa3pSK5McWvyQjDZDgS+IkdrZmIYJPMa7bmKH5I/edUPSmXQT905FgEwq9u8XR0SyBopli21EK9l6GkXIIvmDTYz5vT26Apvi2B4Aoazlklg+KNRUJuLGerpt6kbnU0gMSUChVkFfFhOk6GRSN3a/AUfD2FOudvMhet2QvlPHx+GYdEUr5XVo5HW42pHsqfD6eDtHd8VLTsHP0q4C8V85fNMv21lkkehy2ry8fx/RRy6x4O2wg2mua+79UkGKXp75gMKzWEcth34PCFCOu37l2F8R/ANnrQ52K/8vIQ88TtU2OpYX89fHjLojBxu+WKEBGZH2LRPsZBOUHeeO5C/xKDrhZU24ORnMW8wg66Qg5GIX1KI4a8yp73Mpues5hzpJ6wkMuRrQt40ymKndLCjv8KSd+5BfP6Or/KIrzDNYdZaasjk7JNi6rcZmm9d3fTAo+Ja/mjpUCIOo3SX14luzVCJIig="
3434
- DOCKER_BUILD=false
3535

36-
matrix:
37-
- BUILD_TARGET=arm-linux
38-
- BUILD_TARGET=win32
39-
- BUILD_TARGET=win64
40-
- BUILD_TARGET=linux32
41-
- BUILD_TARGET=linux64
42-
- BUILD_TARGET=linux64_nowallet
43-
- BUILD_TARGET=linux64_release DOCKER_BUILD=true
44-
- BUILD_TARGET=mac
36+
stages:
37+
- build depends
38+
- build src
39+
- run tests
40+
- build docker
41+
42+
builddepends: &builddepends
43+
stage: build depends
44+
script:
45+
- $DOCKER_RUN_IN_BUILDER ./ci/build_depends.sh
46+
47+
buildsrc: &buildsrc
48+
stage: build src
49+
script:
50+
- $DOCKER_RUN_IN_BUILDER ./ci/build_depends.sh
51+
- $DOCKER_RUN_IN_BUILDER ./ci/build_src.sh
52+
53+
runtests: &runtests
54+
stage: run tests
55+
script:
56+
- $DOCKER_RUN_IN_BUILDER ./ci/build_depends.sh
57+
- $DOCKER_RUN_IN_BUILDER ./ci/build_src.sh
58+
- $DOCKER_RUN_IN_BUILDER ./ci/test_unittests.sh
59+
- $DOCKER_RUN_IN_BUILDER ./ci/test_integrationtests.sh --jobs=3
60+
61+
builddocker: &builddocker
62+
stage: build docker
63+
script:
64+
# no need to run tests again here
65+
- if [ "$DOCKER_BUILD" = "true" ]; then $DOCKER_RUN_IN_BUILDER ./ci/build_depends.sh && $DOCKER_RUN_IN_BUILDER ./ci/build_src.sh && BUILD_DIR=build-ci/dashcore-$BUILD_TARGET ./docker/build-docker.sh; fi
66+
67+
jobs:
68+
include:
69+
# build depends
70+
- <<: *builddepends
71+
env: BUILD_TARGET=arm-linux
72+
- <<: *builddepends
73+
env: BUILD_TARGET=win32
74+
- <<: *builddepends
75+
env: BUILD_TARGET=win64
76+
- <<: *builddepends
77+
env: BUILD_TARGET=linux32
78+
- <<: *builddepends
79+
env: BUILD_TARGET=linux64
80+
- <<: *builddepends
81+
env: BUILD_TARGET=linux64_nowallet
82+
- <<: *builddepends
83+
env: BUILD_TARGET=linux64_release DOCKER_BUILD=true
84+
- <<: *builddepends
85+
env: BUILD_TARGET=mac
86+
# build source
87+
- <<: *buildsrc
88+
env: BUILD_TARGET=arm-linux
89+
- <<: *buildsrc
90+
env: BUILD_TARGET=win32
91+
- <<: *buildsrc
92+
env: BUILD_TARGET=win64
93+
- <<: *buildsrc
94+
env: BUILD_TARGET=linux32
95+
- <<: *buildsrc
96+
env: BUILD_TARGET=linux64
97+
- <<: *buildsrc
98+
env: BUILD_TARGET=linux64_nowallet
99+
- <<: *buildsrc
100+
env: BUILD_TARGET=linux64_release DOCKER_BUILD=true
101+
- <<: *buildsrc
102+
env: BUILD_TARGET=mac
103+
# run tests (no tests for arm-linux and mac)
104+
- <<: *runtests
105+
env: BUILD_TARGET=win32
106+
- <<: *runtests
107+
env: BUILD_TARGET=win64
108+
- <<: *runtests
109+
env: BUILD_TARGET=linux32
110+
- <<: *runtests
111+
env: BUILD_TARGET=linux64
112+
- <<: *runtests
113+
env: BUILD_TARGET=linux64_nowallet
114+
- <<: *runtests
115+
env: BUILD_TARGET=linux64_release DOCKER_BUILD=true
116+
# build docker
117+
- <<: *builddocker
118+
env: BUILD_TARGET=linux64_release DOCKER_BUILD=true
45119

46120
before_cache:
47121
# Save builder image
@@ -53,6 +127,7 @@ install:
53127
- export JOB_NUMBER="$TRAVIS_JOB_NUMBER"
54128
- export HOST_SRC_DIR=$TRAVIS_BUILD_DIR
55129
- export HOST_CACHE_DIR=$HOME/cache
130+
- export TRAVIS_COMMIT_LOG=`git log --format=fuller -1`
56131
- source ./ci/matrix.sh
57132
- mkdir -p $HOST_CACHE_DIR/docker && mkdir -p $HOST_CACHE_DIR/ccache && mkdir -p $HOST_CACHE_DIR/depends && mkdir -p $HOST_CACHE_DIR/sdk-sources
58133
# Keep this as it makes caching related debugging easier
@@ -67,18 +142,6 @@ before_script:
67142
- python3 -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);'
68143
# Build docker image only for develop branch of the main repo
69144
- if [ "$TRAVIS_REPO_SLUG" != "dashpay/dash" -o "$TRAVIS_BRANCH" != "develop" -o "$TRAVIS_PULL_REQUEST" != "false" ]; then export DOCKER_BUILD="false"; echo DOCKER_BUILD=$DOCKER_BUILD; fi
70-
script:
71-
- export TRAVIS_COMMIT_LOG=`git log --format=fuller -1`
72-
# Our scripts try to be Travis agnostic
73-
- $DOCKER_RUN_IN_BUILDER ./ci/build_depends.sh;
74-
# Gracefully stop build without running into timeouts (which won't update caches) when building depends or source took too long
75-
# Next build should fix this situation as it will start with a populated cache
76-
- if [ $SECONDS -gt 1200 ]; then export TIMEOUT="true"; false; fi # The "false" here ensures that the build is marked as failed even though the whole script returns 0
77-
- test "$TIMEOUT" != "true" && $DOCKER_RUN_IN_BUILDER ./ci/build_src.sh
78-
- test "$TIMEOUT" != "true" && $DOCKER_RUN_IN_BUILDER ./ci/test_unittests.sh
79-
- if [ $SECONDS -gt 1800 -a "$RUN_INTEGRATIONTESTS" = "true" ]; then export TIMEOUT="true"; false; fi # The "false" here ensures that the build is marked as failed even though the whole script returns 0
80-
- test "$TIMEOUT" != "true" && $DOCKER_RUN_IN_BUILDER ./ci/test_integrationtests.sh --jobs=3
81-
- test "$TIMEOUT" != "true" && if [ "$DOCKER_BUILD" = "true" ]; then BUILD_DIR=build-ci/dashcore-$BUILD_TARGET ./docker/build-docker.sh; fi
82145
after_script:
83146
- echo $TRAVIS_COMMIT_RANGE
84147
- echo $TRAVIS_COMMIT_LOG

0 commit comments

Comments
 (0)