Skip to content

Instantly share code, notes, and snippets.

@taiki-e
Last active August 11, 2019 12:57
Show Gist options
  • Save taiki-e/92dfbd5d7ca1ef897fa4a019bec7cc8c to your computer and use it in GitHub Desktop.
Save taiki-e/92dfbd5d7ca1ef897fa4a019bec7cc8c to your computer and use it in GitHub Desktop.
pin-project ci.sh
#!/bin/bash
# A script to run exactly the same checks done by CI.
#
# Usage
#
# ```sh
# source ci.sh
# ```
cargo update
rustup toolchain install nightly
# displayName: rustfmt
# ci\azure-rustfmt.yml
echo "Running 'cargo fmt --all -- --check'"
rustup component add rustfmt
RUSTFLAGS=-Dwarnings cargo fmt --all -- --check
# displayName: minrust linux
# ci\azure-test.yml
echo "Running 'cargo +1.33.0 check --all'"
rustup toolchain install 1.33.0
RUSTFLAGS=-Dwarnings cargo +1.33.0 check --all
RUSTFLAGS=-Dwarnings cargo +1.33.0 check --all --all-features
# displayName: stable linux
# ci\azure-test.yml
echo "Running 'cargo +stable check --all'"
rustup toolchain install stable
RUSTFLAGS=-Dwarnings cargo +stable check --all
RUSTFLAGS=-Dwarnings cargo +stable check --all --all-features
# displayName: beta linux
# ci\azure-test.yml
echo "Running 'cargo +beta check --all'"
rustup toolchain install beta
RUSTFLAGS=-Dwarnings cargo +beta check --all
RUSTFLAGS=-Dwarnings cargo +beta check --all --all-features
# displayName: nightly linux
# ci\azure-test.yml
echo "Running 'cargo +nightly test --all'"
RUSTFLAGS=-Dwarnings cargo +nightly test --all
RUSTFLAGS=-Dwarnings cargo +nightly test --all --all-features
echo "Running 'cargo check -Zminimal-versions'"
RUSTFLAGS=-Dwarnings cargo +nightly update -Zminimal-versions
RUSTFLAGS=-Dwarnings cargo +nightly check --all --all-features
cargo update
# displayName: clippy
# ci\azure-clippy.yml
echo "Running 'cargo clippy --all --all-features'"
if rustup component add clippy --toolchain nightly; then
RUSTFLAGS=-Dwarnings cargo +nightly clippy --all --all-features
else
target=`curl https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/clippy`
echo "'clippy' is unavailable on the toolchain 'nightly', use the toolchain 'nightly-$target' instead"
rustup toolchain install nightly-$target
rustup component add clippy --toolchain nightly-$target
RUSTFLAGS=-Dwarnings cargo +nightly-$target clippy --all --all-features
fi
# displayName: rustdoc
# ci\azure-rustdoc.yml
echo "Running 'cargo doc --all --all-features'"
RUSTDOCFLAGS=-Dwarnings cargo +nightly doc --no-deps --all --all-features
# displayName: compile-test
# ci\azure-compile-test.yml
echo "Running 'cargo test (compile-test)'"
cargo clean
RUSTFLAGS='--cfg compile_test' cargo test +nightly -p pin-project --all-features --test compile-test
#!/bin/bash
# A script to run a simplified version of the checks done by CI.
#
# Usage
#
# ```sh
# source ci.sh
# ```
cargo update
rustup toolchain install nightly
# displayName: rustfmt
# ci\azure-rustfmt.yml
echo "Running 'cargo fmt --all -- --check'"
rustup component add rustfmt
RUSTFLAGS=-Dwarnings cargo fmt --all -- --check
# displayName: nightly linux
# ci\azure-test.yml
echo "Running 'cargo +nightly test --all'"
RUSTFLAGS=-Dwarnings cargo +nightly test --all
RUSTFLAGS=-Dwarnings cargo +nightly test --all --all-features
# displayName: clippy
# ci\azure-clippy.yml
echo "Running 'cargo clippy --all --all-features'"
rustup component add clippy --toolchain nightly
RUSTFLAGS=-Dwarnings cargo +nightly clippy --all --all-features
# displayName: rustdoc
# ci\azure-rustdoc.yml
echo "Running 'cargo doc --all --all-features'"
RUSTDOCFLAGS=-Dwarnings cargo +nightly doc --no-deps --all --all-features
# displayName: compile-test
# ci\azure-compile-test.yml
echo "Running 'cargo test (compile-test)'"
cargo clean
RUSTFLAGS='--cfg compile_test' cargo test +nightly -p pin-project --all-features --test compile-test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment