Skip to content

Commit

Permalink
feat: reinstate rustfmt script, detach from CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilad Chase committed Dec 24, 2024
1 parent 440c12c commit 16695f1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions scripts/rust_fmt.sh
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 "$@"

0 comments on commit 16695f1

Please sign in to comment.