Skip to content

Commit 6d47fed

Browse files
committed
Use travis conditionals to shrink the matrix
Ensures that we shouldn't schedule unnecessary builds on PRs/master
1 parent 5ab83d0 commit 6d47fed

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

.travis.yml

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ matrix:
1111
- os: linux
1212
env: TARGET=i686-unknown-linux-gnu
1313
DOCKER=alexcrichton/rust-slave-dist:2015-10-20b
14+
if: branch != master
1415
- os: linux
1516
env: TARGET=x86_64-unknown-linux-gnu
1617
DOCKER=alexcrichton/rust-slave-dist:2015-10-20b
1718
NO_ADD=1
18-
ALLOW_PR=1
1919

2020
# Cross builds happen in the `rust-slave-linux-cross` image to ensure that
2121
# we use the right cross compilers for these targets. That image should
@@ -24,90 +24,111 @@ matrix:
2424
env: TARGET=arm-unknown-linux-gnueabi
2525
DOCKER=alexcrichton/rust-slave-linux-cross:2016-11-11
2626
SKIP_TESTS=1
27+
if: branch != master
2728
- os: linux
2829
env: TARGET=arm-unknown-linux-gnueabihf
2930
DOCKER=alexcrichton/rust-slave-linux-cross:2016-11-11
3031
SKIP_TESTS=1
32+
if: branch != master
3133
- os: linux
3234
env: TARGET=armv7-unknown-linux-gnueabihf
3335
DOCKER=alexcrichton/rust-slave-linux-cross:2016-11-11
3436
SKIP_TESTS=1
37+
if: branch != master
3538
- os: linux
3639
env: TARGET=aarch64-unknown-linux-gnu
3740
DOCKER=alexcrichton/rust-slave-linux-cross:2016-11-11
3841
SKIP_TESTS=1
42+
if: branch != master
3943
- os: linux
4044
env: TARGET=x86_64-unknown-freebsd
4145
DOCKER=alexcrichton/rust-slave-linux-cross:2016-11-11
4246
SKIP_TESTS=1
47+
if: branch != master
4348
- os: linux
4449
env: TARGET=x86_64-unknown-netbsd
4550
DOCKER=alexcrichton/rust-slave-linux-cross:2016-11-11
4651
SKIP_TESTS=1
52+
if: branch != master
4753
- os: linux
4854
env: TARGET=powerpc-unknown-linux-gnu
4955
DOCKER=powerpc-unknown-linux-gnu
5056
SKIP_TESTS=1
57+
if: branch != master
5158
- os: linux
5259
env: TARGET=powerpc64-unknown-linux-gnu
5360
DOCKER=powerpc64-unknown-linux-gnu
5461
SKIP_TESTS=1
62+
if: branch != master
5563
- os: linux
5664
env: TARGET=powerpc64le-unknown-linux-gnu
5765
DOCKER=powerpc64le-unknown-linux-gnu
5866
SKIP_TESTS=1
67+
if: branch != master
5968
- os: linux
6069
env: TARGET=mips-unknown-linux-gnu
6170
DOCKER=mips-unknown-linux-gnu
6271
SKIP_TESTS=1
72+
if: branch != master
6373
- os: linux
6474
env: TARGET=mipsel-unknown-linux-gnu
6575
DOCKER=mipsel-unknown-linux-gnu
6676
SKIP_TESTS=1
77+
if: branch != master
6778
- os: linux
6879
env: TARGET=mips64-unknown-linux-gnuabi64
6980
DOCKER=mips64-unknown-linux-gnuabi64
7081
SKIP_TESTS=1
82+
if: branch != master
7183
- os: linux
7284
env: TARGET=mips64el-unknown-linux-gnuabi64
7385
DOCKER=mips64el-unknown-linux-gnuabi64
7486
SKIP_TESTS=1
87+
if: branch != master
7588
- os: linux
7689
env: TARGET=s390x-unknown-linux-gnu
7790
DOCKER=s390x-unknown-linux-gnu
7891
SKIP_TESTS=1
92+
if: branch != master
7993

8094
# Android use a local docker image
8195
- os: linux
8296
env: TARGET=arm-linux-androideabi
8397
DOCKER=android
8498
SKIP_TESTS=1
99+
if: branch != master
85100
- os: linux
86101
env: TARGET=armv7-linux-androideabi
87102
DOCKER=android
88103
SKIP_TESTS=1
104+
if: branch != master
89105
- os: linux
90106
env: TARGET=aarch64-linux-android
91107
DOCKER=android
92108
SKIP_TESTS=1
109+
if: branch != master
93110
- os: linux
94111
env: TARGET=i686-linux-android
95112
DOCKER=android
96113
SKIP_TESTS=1
114+
if: branch != master
97115
- os: linux
98116
env: TARGET=x86_64-linux-android
99117
DOCKER=android
100118
SKIP_TESTS=1
119+
if: branch != master
101120

102121
# On OSX we want to target 10.7 so we ensure that the appropriate
103122
# environment variable is set to tell the linker what we want.
104123
- os: osx
105124
env: TARGET=i686-apple-darwin
106125
MACOSX_DEPLOYMENT_TARGET=10.7
126+
if: branch != master
107127
- os: osx
108128
env: TARGET=x86_64-apple-darwin
109129
MACOSX_DEPLOYMENT_TARGET=10.7
110130
NO_ADD=1
131+
if: branch != master
111132

112133
cache:
113134
# We're going to download things we don't necessarily want to cache into the `target` directory, so
@@ -116,29 +137,17 @@ cache:
116137
- target/$TARGET/openssl/openssl-install
117138
- target/release/deps
118139

119-
branches:
120-
only:
121-
- master
122-
- stable
123-
- auto
124-
125140
install:
126141
- if [ -z "$NO_ADD" ]; then rustup target add $TARGET; fi
127142

128143
script:
129144
- mkdir -p target/$TARGET;
130145
- >
131-
if [[ "$TRAVIS_PULL_REQUEST" != "false" && "$ALLOW_PR" != "1" ]]; then
132-
echo 'skipping PR build';
133-
elif [[ "$TRAVIS_BRANCH" == "master" && "$ALLOW_PR" != "1" ]]; then
134-
echo 'skipping master build';
135-
else
136-
if [ ! -z "$DOCKER" ]; then
137-
sh ci/build-run-docker.sh "$DOCKER" "$TARGET" "$SKIP_TESTS";
138-
else
139-
PATH=$HOME/rust/bin:$PATH sh ci/run.sh;
140-
fi
141-
fi
146+
if [ ! -z "$DOCKER" ]; then
147+
sh ci/build-run-docker.sh "$DOCKER" "$TARGET" "$SKIP_TESTS";
148+
else
149+
PATH=$HOME/rust/bin:$PATH sh ci/run.sh;
150+
fi
142151
143152
before_deploy:
144153
- bash ci/prepare-deploy-travis.sh

0 commit comments

Comments
 (0)