From 1282e1cfad6d0e4be12e8ac4c971127ebfe78abe Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 2 Oct 2020 15:52:26 +0200 Subject: [PATCH] Do less work on CI rustfmt and clippy are now basically guaranteed to be available on Nightly, so run them unconditionally and only there. --- .builds/1.43.0.yml | 2 +- .builds/beta.yml | 10 ++-------- .builds/nightly.yml | 15 +++------------ .builds/stable.yml | 10 ++-------- 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/.builds/1.43.0.yml b/.builds/1.43.0.yml index d5d17bfb..f494cfd2 100644 --- a/.builds/1.43.0.yml +++ b/.builds/1.43.0.yml @@ -6,7 +6,7 @@ sources: tasks: - rustup: | # We specify --profile minimal because we'd otherwise download docs - rustup toolchain install 1.43.0 --profile minimal -c rustfmt -c clippy + rustup toolchain install 1.43.0 --profile minimal rustup default 1.43.0 - test: | cd ruma diff --git a/.builds/beta.yml b/.builds/beta.yml index 844a9e40..2f75701c 100644 --- a/.builds/beta.yml +++ b/.builds/beta.yml @@ -6,7 +6,7 @@ sources: tasks: - rustup: | # We specify --profile minimal because we'd otherwise download docs - rustup toolchain install beta --profile minimal -c rustfmt -c clippy + rustup toolchain install beta --profile minimal rustup default beta - test: | cd ruma @@ -15,12 +15,6 @@ tasks: # tools, so capture tool exit codes and set the task exit code manually set +e - cargo fmt --all -- --check - fmt_exit=$? - - cargo clippy --all --all-targets --all-features --quiet -- -D warnings - clippy_exit=$? - cargo test --all --quiet test_exit=$? @@ -45,4 +39,4 @@ tasks: popd - exit $(( $fmt_exit || $clippy_exit || $test_exit || $id_test_1_exit || $id_test_2_exit || $client_api_exit )) + exit $(( $test_exit || $id_test_1_exit || $id_test_2_exit || $client_api_exit )) diff --git a/.builds/nightly.yml b/.builds/nightly.yml index a31d2a3c..a863f239 100644 --- a/.builds/nightly.yml +++ b/.builds/nightly.yml @@ -5,13 +5,8 @@ sources: - https://github.com/ruma/ruma tasks: - rustup: | - rustup toolchain install nightly --profile minimal + rustup toolchain install nightly --profile minimal -c rustfmt,clippy rustup default nightly - - # Try installing rustfmt & clippy for nightly, but don't fail the build - # if they are not available - rustup component add rustfmt || true - rustup component add clippy || true - test: | cd ruma @@ -19,14 +14,10 @@ tasks: # tools, so capture tool exit codes and set the task exit code manually set +e - if ( rustup component list | grep -q rustfmt ); then - cargo fmt --all -- --check - fi + cargo fmt --all -- --check fmt_exit=$? - if ( rustup component list | grep -q clippy ); then - cargo clippy --all --all-targets --all-features --quiet -- -D warnings - fi + cargo clippy --all --all-targets --all-features --quiet -- -D warnings clippy_exit=$? exit $(( $fmt_exit || $clippy_exit )) diff --git a/.builds/stable.yml b/.builds/stable.yml index 98f7f780..8102d7cf 100644 --- a/.builds/stable.yml +++ b/.builds/stable.yml @@ -6,7 +6,7 @@ sources: tasks: - rustup: | # We specify --profile minimal because we'd otherwise download docs - rustup toolchain install stable --profile minimal -c rustfmt -c clippy + rustup toolchain install stable --profile minimal rustup default stable - test: | cd ruma @@ -15,12 +15,6 @@ tasks: # tools, so capture tool exit codes and set the task exit code manually set +e - cargo fmt --all -- --check - fmt_exit=$? - - cargo clippy --all --all-targets --all-features --quiet -- -D warnings - clippy_exit=$? - cargo test --all --quiet test_exit=$? @@ -45,6 +39,6 @@ tasks: popd - exit $(( $fmt_exit || $clippy_exit || $test_exit || $id_test_1_exit || $id_test_2_exit || $client_api_exit )) + exit $(( $test_exit || $id_test_1_exit || $id_test_2_exit || $client_api_exit )) # TODO: Add audit task once cargo-audit binary releases are available. # See https://github.com/RustSec/cargo-audit/issues/66