diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 067ee137..8d8a978b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -53,6 +53,7 @@ jobs: uses: dtolnay/rust-toolchain@nightly - name: Running test script env: + DO_FMT: true DO_BENCH: true AS_DEPENDENCY: false DO_NO_STD: true diff --git a/bitcoin/contrib/test.sh b/bitcoin/contrib/test.sh index 3d91bd20..adcd1c70 100755 --- a/bitcoin/contrib/test.sh +++ b/bitcoin/contrib/test.sh @@ -111,6 +111,16 @@ then ) fi +# Run formatter if told to. +if [ "$DO_FMT" = true ]; then + if [ "$NIGHTLY" = false ]; then + echo "DO_FMT requires a nightly toolchain (consider using RUSTUP_TOOLCHAIN)" + exit 1 + fi + rustup component add rustfmt + cargo fmt --check +fi + # Bench if told to, only works with non-stable toolchain (nightly, beta). if [ "$DO_BENCH" = true ] then diff --git a/hashes/contrib/test.sh b/hashes/contrib/test.sh index 4bea1767..466644a0 100755 --- a/hashes/contrib/test.sh +++ b/hashes/contrib/test.sh @@ -89,6 +89,16 @@ if [ "$DO_ASAN" = true ]; then cargo test --lib --no-default-features --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu fi +# Run formatter if told to. +if [ "$DO_FMT" = true ]; then + if [ "$NIGHTLY" = false ]; then + echo "DO_FMT requires a nightly toolchain (consider using RUSTUP_TOOLCHAIN)" + exit 1 + fi + rustup component add rustfmt + cargo fmt --check +fi + # Bench if told to, only works with non-stable toolchain (nightly, beta). if [ "$DO_BENCH" = true ] then diff --git a/internals/contrib/test.sh b/internals/contrib/test.sh index f83302f7..13f2d3d8 100755 --- a/internals/contrib/test.sh +++ b/internals/contrib/test.sh @@ -52,3 +52,13 @@ fi if [ "$DO_DOCS" = true ]; then RUSTDOCFLAGS="-D warnings" cargo +stable doc --all-features fi + +# Run formatter if told to. +if [ "$DO_FMT" = true ]; then + if [ "$NIGHTLY" = false ]; then + echo "DO_FMT requires a nightly toolchain (consider using RUSTUP_TOOLCHAIN)" + exit 1 + fi + rustup component add rustfmt + cargo fmt --check +fi