Enable formatting in CI
Enable formatting in CI by doing: - Add a section to the `test.sh` scripts to run the formatter (guarded by the env variable `DO_FMT`) for all crates (bitcoin, hashes, internals). - Add `DO_FMT` to the nightly `Tests` CI job.
This commit is contained in:
parent
61c560baba
commit
c1360067e9
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue