Skip to content

Commit 44d931f

Browse files
rbtcollinsDarunada
authored andcommitted
Do all builds together in CI
This may help CI performance by reducing thrashing.
1 parent 06fb8bc commit 44d931f

File tree

1 file changed

+33
-14
lines changed

1 file changed

+33
-14
lines changed

ci/run.bash

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ if [ "$TARGET" = arm-linux-androideabi ]; then
3030
export CFLAGS='-march=armv7'
3131
fi
3232

33-
cargo build --locked --release --target "$TARGET" "${FEATURES[@]}"
34-
35-
runtest () {
36-
cargo test --locked --release --target "$TARGET" "${FEATURES[@]}" "$@"
33+
target_cargo() {
34+
cmd="$1"
35+
shift
36+
cargo "${cmd}" --locked --release --target "$TARGET" "${FEATURES[@]}" "$@"
3737
}
3838

39-
run_download_pkg_test() {
39+
target_cargo build
40+
41+
download_pkg_test() {
4042
features=('--no-default-features' '--features' 'curl-backend,reqwest-backend,reqwest-default-tls')
4143
case "$TARGET" in
4244
# these platforms aren't supported by ring:
@@ -49,21 +51,38 @@ run_download_pkg_test() {
4951
* ) features+=('--features' 'reqwest-rustls-tls') ;;
5052
esac
5153

52-
cargo test --locked --release --target "$TARGET" "${features[@]}" -p download
54+
cargo "$1" --locked --release --target "$TARGET" "${features[@]}" -p download
5355
}
5456

55-
if [ -z "$SKIP_TESTS" ]; then
56-
cargo run --locked --release --target "$TARGET" "${FEATURES[@]}" -- --dump-testament
57-
run_download_pkg_test
58-
runtest --bin rustup-init
59-
runtest --lib --all
60-
runtest --doc --all
57+
# Machines have 7GB of RAM, and our target/ contents is large enough that
58+
# thrashing will occur if we build-run-build-run rather than
59+
# build-build-build-run-run-run.
60+
build_test() {
61+
cmd="$1"
62+
shift
63+
download_pkg_test "${cmd}"
64+
target_cargo "${cmd}" --bin rustup-init
65+
target_cargo "${cmd}" --lib --all
66+
if [ "build" != "${cmd}" ]; then
67+
target_cargo "${cmd}" --doc --all
68+
fi
6169

62-
runtest --test dist -- --test-threads 1
70+
if [ "build" = "${cmd}" ]; then
71+
target_cargo "${cmd}" --test dist
72+
else
73+
# free runners have 2 or 3(mac) cores
74+
target_cargo "${cmd}" --test dist -- --test-threads 2
75+
fi
6376

6477
find tests -maxdepth 1 -type f ! -path '*/dist.rs' -name '*.rs' \
6578
| sed -e 's@^tests/@@;s@\.rs$@@g' \
6679
| while read -r test; do
67-
runtest --test "${test}"
80+
target_cargo "${cmd}" --test "${test}"
6881
done
82+
}
83+
84+
if [ -z "$SKIP_TESTS" ]; then
85+
cargo run --locked --release --target "$TARGET" "${FEATURES[@]}" -- --dump-testament
86+
build_test build
87+
build_test test
6988
fi

0 commit comments

Comments
 (0)