diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2020-05-18 22:50:36 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2020-06-15 02:13:39 +0200 |
commit | 0de049e153f2c984ebbddfbe47381c9bc0818b5a (patch) | |
tree | a480b11b1cab15d69b15267ce77700dec9974c13 | |
parent | 8078ad6f46e79930317719a514c9b87561f76a56 (diff) |
ci: always try to find a nightly toolchain with rustfmt.
-rwxr-xr-x | ci/assert-rustfmt.sh | 7 | ||||
-rwxr-xr-x | ci/script.sh | 8 |
2 files changed, 8 insertions, 7 deletions
diff --git a/ci/assert-rustfmt.sh b/ci/assert-rustfmt.sh index de8ede82..785530cb 100755 --- a/ci/assert-rustfmt.sh +++ b/ci/assert-rustfmt.sh @@ -3,10 +3,11 @@ set -xeu cd "$(dirname "$0")/.." -rustup update nightly -rustup component add rustfmt --toolchain nightly +TOOLCHAIN="nightly-$(curl https://rust-lang.github.io/rustup-components-history/$(rustup target list --installed | tail -1)/rustfmt)" +rustup update "$TOOLCHAIN" +rustup component add rustfmt --toolchain "$TOOLCHAIN" # Run `rustfmt` on the crate! If `rustfmt` can't make a long line shorter, it # prints an error and exits non-zero, so tell it to kindly shut its yapper and # make sure it doesn't cause us to exit this whole script non-zero. -rustup run nightly cargo fmt -- --check +rustup run "$TOOLCHAIN" cargo fmt -- --check diff --git a/ci/script.sh b/ci/script.sh index e5f64f96..967defc1 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -17,10 +17,10 @@ fi case "$BINDGEN_JOB" in "test") # Need rustfmt to compare the test expectations. - rustup update nightly - rustup component add rustfmt - rustup component add --toolchain nightly rustfmt - RUSTFMT="$(rustup which rustfmt)" + TOOLCHAIN="nightly-$(curl https://rust-lang.github.io/rustup-components-history/$(rustup target list --installed | tail -1)/rustfmt)" + rustup update "$TOOLCHAIN" + rustup component add rustfmt --toolchain "$TOOLCHAIN" + RUSTFMT="$(rustup which --toolchain "$TOOLCHAIN" rustfmt)" export RUSTFMT cargo test "$BINDGEN_PROFILE" $NO_DEFAULT_FEATURES --features "$BINDGEN_FEATURES" ./ci/assert-no-diff.sh |