Skip to content

Commit ccdf523

Browse files
authored
ci.sh uses positive rather than negative flags (pantsbuild#6342)
This makes it much easier to reason about what's happening, and keeps .travis.yml more concise.
1 parent 68f4b59 commit ccdf523

File tree

3 files changed

+56
-56
lines changed

3 files changed

+56
-56
lines changed

.travis.yml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -154,73 +154,73 @@ matrix:
154154
env:
155155
- SHARD="Self checks, lint, and JVM tests"
156156
script:
157-
- ./build-support/bin/ci.sh -x -celpn "${SHARD}"
157+
- ./build-support/bin/ci.sh -fkmrjt "${SHARD}"
158158

159159
- <<: *default_test_config
160160
env:
161161
- SHARD="Py2 - Unit tests for pants and pants-plugins"
162162
script:
163-
- ./build-support/bin/ci.sh -x -efkmrjcnt "${SHARD}"
163+
- ./build-support/bin/ci.sh -lp "${SHARD}"
164164

165165
- <<: *default_test_config
166166
env:
167167
- SHARD="Py3 - Unit tests for pants and pants-plugins"
168168
script:
169-
- ./build-support/bin/ci.sh -x -3efkmrjcnt "${SHARD}"
169+
- ./build-support/bin/ci.sh -3lp "${SHARD}"
170170

171171
- <<: *default_test_config
172172
env:
173173
- SHARD="Python contrib tests - shard 1"
174174
script:
175-
- ./build-support/bin/ci.sh -x -efkmrcjlpt -y 0/2 "${SHARD}"
175+
- ./build-support/bin/ci.sh -n -y 0/2 "${SHARD}"
176176

177177
- <<: *default_test_config
178178
env:
179179
- SHARD="Python contrib tests - shard 2"
180180
script:
181-
- ./build-support/bin/ci.sh -x -efkmrcjlpt -y 1/2 "${SHARD}"
181+
- ./build-support/bin/ci.sh -n -y 1/2 "${SHARD}"
182182

183183
- <<: *default_test_config
184184
env:
185185
- SHARD="Python integration tests for pants - shard 1"
186186
script:
187-
- ./build-support/bin/ci.sh -x -efkmrjlpnt -i 0/7 "${SHARD}"
187+
- ./build-support/bin/ci.sh -c -i 0/7 "${SHARD}"
188188

189189
- <<: *default_test_config
190190
env:
191191
- SHARD="Python integration tests for pants - shard 2"
192192
script:
193-
- ./build-support/bin/ci.sh -x -efkmrjlpnt -i 1/7 "${SHARD}"
193+
- ./build-support/bin/ci.sh -c -i 1/7 "${SHARD}"
194194

195195
- <<: *default_test_config
196196
env:
197197
- SHARD="Python integration tests for pants - shard 3"
198198
script:
199-
- ./build-support/bin/ci.sh -x -efkmrjlpnt -i 2/7 "${SHARD}"
199+
- ./build-support/bin/ci.sh -c -i 2/7 "${SHARD}"
200200

201201
- <<: *default_test_config
202202
env:
203203
- SHARD="Python integration tests for pants - shard 4"
204204
script:
205-
- ./build-support/bin/ci.sh -x -efkmrjlpnt -i 3/7 "${SHARD}"
205+
- ./build-support/bin/ci.sh -c -i 3/7 "${SHARD}"
206206

207207
- <<: *default_test_config
208208
env:
209209
- SHARD="Python integration tests for pants - shard 5"
210210
script:
211-
- ./build-support/bin/ci.sh -x -efkmrjlpnt -i 4/7 "${SHARD}"
211+
- ./build-support/bin/ci.sh -c -i 4/7 "${SHARD}"
212212

213213
- <<: *default_test_config
214214
env:
215215
- SHARD="Python integration tests for pants - shard 6"
216216
script:
217-
- ./build-support/bin/ci.sh -x -efkmrjlpnt -i 5/7 "${SHARD}"
217+
- ./build-support/bin/ci.sh -c -i 5/7 "${SHARD}"
218218

219219
- <<: *default_test_config
220220
env:
221221
- SHARD="Python integration tests for pants - shard 7"
222222
script:
223-
- ./build-support/bin/ci.sh -x -efkmrjlpnt -i 6/7 "${SHARD}"
223+
- ./build-support/bin/ci.sh -c -i 6/7 "${SHARD}"
224224

225225
# Rust on linux
226226
- os: linux
@@ -244,8 +244,7 @@ matrix:
244244
- ulimit -c unlimited
245245
- ulimit -n 8192
246246
script:
247-
- ./build-support/bin/ci.sh -bcfjklmnprtx
248-
247+
- ./build-support/bin/ci.sh -be
249248
# Rust on macOS
250249
- os: osx
251250
# Fuse actually works on this image. It hangs on many others.
@@ -266,8 +265,7 @@ matrix:
266265
- ulimit -n 8192
267266
script:
268267
# Platform-specific tests currently need a pants pex, so we bootstrap here (no -b) and set -z to run the platform-specific tests.
269-
- ./build-support/bin/ci.sh -cfjklmnprtxz
270-
268+
- ./build-support/bin/ci.sh -ez
271269
deploy:
272270
# See: https://docs.travis-ci.com/user/deployment/s3/
273271
provider: s3

build-support/bin/ci.sh

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,37 @@ function usage() {
1313
cat <<EOF
1414
Runs commons tests for local or hosted CI.
1515
16-
Usage: $0 (-h|-3fxbkmsrjlpuyncia)
16+
Usage: $0 (-h|-3fxbkmrjlpuneycitz)
1717
-h print out this help message
1818
-3 After pants is bootstrapped, set --python-setup-interpreter-constraints such that any
1919
python tests run with Python 3.
20-
-f skip python code formatting checks
21-
-x skip bootstrap clean-all (assume bootstrapping from a
20+
-f run python code formatting checks
21+
-x run bootstrap clean-all (assume bootstrapping from a
2222
fresh clone)
2323
-b skip bootstrapping pants from local sources
24-
-k skip bootstrapped pants self compile check
25-
-m skip sanity checks of bootstrapped pants and repo BUILD
24+
-k run bootstrapped pants self compile check
25+
-m run sanity checks of bootstrapped pants and repo BUILD
2626
files
27-
-r skip doc generation tests
28-
-j skip core jvm tests
29-
-l skip internal backends python tests
30-
-p skip core python tests
27+
-r run doc generation tests
28+
-j run core jvm tests
29+
-l run internal backends python tests
30+
-p run core python tests
3131
-u SHARD_NUMBER/TOTAL_SHARDS
3232
if running core python tests, divide them into
3333
TOTAL_SHARDS shards and just run those in SHARD_NUMBER
3434
to run only even tests: '-u 0/2', odd: '-u 1/2'
35-
-n skip contrib python tests
36-
-e skip rust tests
35+
-n run contrib python tests
36+
-e run rust tests
3737
-y SHARD_NUMBER/TOTAL_SHARDS
3838
if running contrib python tests, divide them into
3939
TOTAL_SHARDS shards and just run those in SHARD_NUMBER
4040
to run only even tests: '-u 0/2', odd: '-u 1/2'
41-
-c skip pants integration tests (includes examples and testprojects)
41+
-c run pants integration tests (includes examples and testprojects)
4242
-i SHARD_NUMBER/TOTAL_SHARDS
4343
if running integration tests, divide them into
4444
TOTAL_SHARDS shards and just run those in SHARD_NUMBER
4545
to run only even tests: '-i 0/2', odd: '-i 1/2'
46-
-t skip lint
46+
-t run lint
4747
-z test platform-specific behavior
4848
EOF
4949
if (( $# > 0 )); then
@@ -68,22 +68,22 @@ while getopts "h3fxbkmrjlpeu:ny:ci:tz" opt; do
6868
case ${opt} in
6969
h) usage ;;
7070
3) python_three="true" ;;
71-
f) skip_pre_commit_checks="true" ;;
72-
x) skip_bootstrap_clean="true" ;;
73-
b) skip_bootstrap="true" ;;
71+
f) run_pre_commit_checks="true" ;;
72+
x) run_bootstrap_clean="true" ;;
73+
b) run_bootstrap="false" ;;
7474
k) bootstrap_compile_args=() ;;
75-
m) skip_sanity_checks="true" ;;
76-
r) skip_docs="true" ;;
77-
j) skip_jvm="true" ;;
78-
l) skip_internal_backends="true" ;;
79-
p) skip_python="true" ;;
75+
m) run_sanity_checks="true" ;;
76+
r) run_docs="true" ;;
77+
j) run_jvm="true" ;;
78+
l) run_internal_backends="true" ;;
79+
p) run_python="true" ;;
8080
u) python_unit_shard=${OPTARG} ;;
81-
e) skip_rust_tests="true" ;;
82-
n) skip_contrib="true" ;;
81+
e) run_rust_tests="true" ;;
82+
n) run_contrib="true" ;;
8383
y) python_contrib_shard=${OPTARG} ;;
84-
c) skip_integration="true" ;;
84+
c) run_integration="true" ;;
8585
i) python_intg_shard=${OPTARG} ;;
86-
t) skip_lint="true" ;;
86+
t) run_lint="true" ;;
8787
z) test_platform_specific_behavior="true" ;;
8888
*) usage "Invalid option: -${OPTARG}" ;;
8989
esac
@@ -104,16 +104,16 @@ case "${OSTYPE}" in
104104
;;
105105
esac
106106

107-
if [[ "${skip_pre_commit_checks:-false}" == "false" ]]; then
107+
if [[ "${run_pre_commit_checks:-false}" == "true" ]]; then
108108
start_travis_section "PreCommit" "Running pre-commit checks"
109109
FULL_CHECK=1 ./build-support/bin/pre-commit.sh || exit 1
110110
end_travis_section
111111
fi
112112

113-
if [[ "${skip_bootstrap:-false}" == "false" ]]; then
113+
if [[ "${run_bootstrap:-true}" == "true" ]]; then
114114
start_travis_section "Bootstrap" "Bootstrapping pants"
115115
(
116-
if [[ "${skip_bootstrap_clean:-false}" == "false" ]]; then
116+
if [[ "${run_bootstrap_clean:-false}" == "true" ]]; then
117117
./build-support/python/clean.sh || die "Failed to clean before bootstrapping pants."
118118
fi
119119
./pants ${bootstrap_compile_args[@]} binary \
@@ -134,7 +134,7 @@ if [[ "${python_three:-false}" == "true" ]]; then
134134
./pants.pex clean-all
135135
fi
136136

137-
if [[ "${skip_sanity_checks:-false}" == "false" ]]; then
137+
if [[ "${run_sanity_checks:-false}" == "true" ]]; then
138138
start_travis_section "SanityCheck" "Sanity checking bootstrapped pants and repo BUILD files"
139139
sanity_tests=(
140140
"bash-completion"
@@ -153,29 +153,29 @@ if [[ "${skip_sanity_checks:-false}" == "false" ]]; then
153153
end_travis_section
154154
fi
155155

156-
if [[ "${skip_lint:-false}" == "false" ]]; then
156+
if [[ "${run_lint:-false}" == "true" ]]; then
157157
start_travis_section "Lint" "Running lint checks"
158158
(
159159
./pants.pex --tag=-nolint lint contrib:: examples:: src:: tests:: zinc::
160160
) || die "Lint check failure"
161161
end_travis_section
162162
fi
163163

164-
if [[ "${skip_docs:-false}" == "false" ]]; then
164+
if [[ "${run_docs:-false}" == "true" ]]; then
165165
start_travis_section "DocGen" "Running site doc generation test"
166166
./build-support/bin/publish_docs.sh || die "Failed to generate site docs."
167167
end_travis_section
168168
fi
169169

170-
if [[ "${skip_jvm:-false}" == "false" ]]; then
170+
if [[ "${run_jvm:-false}" == "true" ]]; then
171171
start_travis_section "CoreJVM" "Running core jvm tests"
172172
(
173173
./pants.pex doc test {src,tests}/{java,scala}:: zinc::
174174
) || die "Core jvm test failure"
175175
end_travis_section
176176
fi
177177

178-
if [[ "${skip_internal_backends:-false}" == "false" ]]; then
178+
if [[ "${run_internal_backends:-false}" == "true" ]]; then
179179
start_travis_section "BackendTests" "Running internal backend python tests"
180180
(
181181
./pants.pex test.pytest \
@@ -184,7 +184,7 @@ if [[ "${skip_internal_backends:-false}" == "false" ]]; then
184184
end_travis_section
185185
fi
186186

187-
if [[ "${skip_python:-false}" == "false" ]]; then
187+
if [[ "${run_python:-false}" == "true" ]]; then
188188
if [[ "0/1" != "${python_unit_shard}" ]]; then
189189
shard_desc=" [shard ${python_unit_shard}]"
190190
fi
@@ -202,7 +202,7 @@ if [[ "${skip_python:-false}" == "false" ]]; then
202202
end_travis_section
203203
fi
204204

205-
if [[ "${skip_contrib:-false}" == "false" ]]; then
205+
if [[ "${run_contrib:-false}" == "true" ]]; then
206206
if [[ "0/1" != "${python_contrib_shard}" ]]; then
207207
shard_desc=" [shard ${python_contrib_shard}]"
208208
fi
@@ -215,7 +215,7 @@ if [[ "${skip_contrib:-false}" == "false" ]]; then
215215
end_travis_section
216216
fi
217217

218-
if [[ "${skip_rust_tests:-false}" == "false" ]]; then
218+
if [[ "${run_rust_tests:-false}" == "true" ]]; then
219219
start_travis_section "RustTests" "Running Pants rust tests"
220220
(
221221
test_threads_flag=""
@@ -244,7 +244,7 @@ if [[ "${test_platform_specific_behavior:-false}" == 'true' ]]; then
244244
fi
245245

246246

247-
if [[ "${skip_integration:-false}" == "false" ]]; then
247+
if [[ "${run_integration:-false}" == "true" ]]; then
248248
if [[ "0/1" != "${python_intg_shard}" ]]; then
249249
shard_desc=" [shard ${python_intg_shard}]"
250250
fi

src/docs/howto_develop.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,15 @@ feature, you might explore `tests/python/pants_tests/.../BUILD`.
147147

148148
Before [[contributing a change to Pants|pants('src/docs:howto_contribute')]],
149149
make sure it passes **all** of our continuous integration (CI) tests: everything builds,
150-
all tests pass. To try all the CI tests in a few configurations, you can run the same script
151-
that our Travis CI does. This can take a while, but it's a good idea to run it before you
152-
contribute a change or merge it to master:
150+
all tests pass. Our tests are hard and slow to run all of locally, so we recommend that you create
151+
a pull request, and allow travis to run them. You can reproduce failures by running
153152

154153
:::bash
155154
$ ./build-support/bin/ci.sh
156155

156+
with whatever relevant flags reproduce the failure (`./build-support/bin/ci.sh -h` will list the
157+
available flags).
158+
157159
To run just Pants' *unit* tests (skipping the can-be-slow integration tests), filter out
158160
the python tests tagged with 'integration':
159161

0 commit comments

Comments
 (0)