-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: reinstate rustfmt script, detach from CI
- Loading branch information
1 parent
357c73e
commit f1e1e56
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
if [[ -n "${CI:-}" ]]; then | ||
echo "This script should not be run in a CI environment, as it installs toolchains out of cache." | ||
exit 1 | ||
fi | ||
|
||
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")" | ||
TOOLCHAIN=$(grep "EXTRA_RUST_TOOLCHAINS:" "${SCRIPT_DIR}"/../.github/workflows/main.yml | awk '{print $2}') | ||
|
||
function install_rustfmt() { | ||
rustup toolchain install "${TOOLCHAIN}" | ||
rustup component add --toolchain "${TOOLCHAIN}" rustfmt | ||
} | ||
|
||
rustup toolchain list | grep -q "${TOOLCHAIN}" || install_rustfmt | ||
|
||
cargo +"${TOOLCHAIN}" fmt --all -- "$@" |