From a98e946332969aaba893bfa1ebdd178f163549b3 Mon Sep 17 00:00:00 2001 From: Steven Normore Date: Thu, 4 Jul 2024 10:31:19 -0400 Subject: [PATCH] chore(hakari): add dev scripts for check and update --- dev/build | 1 - dev/checks | 1 + dev/hakari-check | 22 ++++++++++++++++++++++ dev/hakari-update | 18 ++++++++++++++++++ dev/test | 3 +-- 5 files changed, 42 insertions(+), 3 deletions(-) create mode 100755 dev/hakari-check create mode 100755 dev/hakari-update diff --git a/dev/build b/dev/build index cd733e993..d4db9442f 100755 --- a/dev/build +++ b/dev/build @@ -1,6 +1,5 @@ #!/bin/bash set -eou pipefail -script_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" set -x cargo build "$@" diff --git a/dev/checks b/dev/checks index 800894d4b..e7c3e0082 100755 --- a/dev/checks +++ b/dev/checks @@ -2,6 +2,7 @@ set -eou pipefail dev/fmt-check +dev/hakari-check dev/clippy dev/build dev/test diff --git a/dev/hakari-check b/dev/hakari-check new file mode 100755 index 000000000..9dac35196 --- /dev/null +++ b/dev/hakari-check @@ -0,0 +1,22 @@ +#!/bin/bash +set -eou pipefail + +# Install cargo-binstall if necessary +if ! cargo --list | grep -q binstall; then + # The workspace toolchain is using rust 1.77.0, so we need to install a version of + # cargo-binstall that is compatible with that. + cargo install cargo-binstall --version "<1.7.0" +fi + +# Install cargo-hakari using cargo binstall if necessary +if ! cargo --list | grep -q hakari; then + cargo binstall cargo-hakari --no-confirm --force +fi + +set -x + +# Check that workspace-hack Cargo.toml is up-to-date +cargo hakari generate --diff + +# Check that all workspace crates depend on workspace-hack +cargo hakari manage-deps --dry-run diff --git a/dev/hakari-update b/dev/hakari-update new file mode 100755 index 000000000..b1ec743d7 --- /dev/null +++ b/dev/hakari-update @@ -0,0 +1,18 @@ +#!/bin/bash +set -eou pipefail + +# Install cargo-binstall if necessary +if ! cargo --list | grep -q binstall; then + # The workspace toolchain is using rust 1.77.0, so we need to install a version of + # cargo-binstall that is compatible with that. + cargo install cargo-binstall --version "<1.7.0" +fi + +# Install cargo-hakari using cargo binstall if necessary +if ! cargo --list | grep -q hakari; then + cargo binstall cargo-hakari --no-confirm --force +fi + +set -x +cargo hakari generate +cargo hakari manage-deps diff --git a/dev/test b/dev/test index 9f3407c0a..149160930 100755 --- a/dev/test +++ b/dev/test @@ -1,6 +1,5 @@ #!/bin/bash set -eou pipefail -script_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" # Install cargo-binstall if necessary if ! cargo --list | grep -q binstall; then @@ -11,7 +10,7 @@ fi # Install cargo-nextest using cargo binstall if necessary if ! cargo --list | grep -q nextest; then - cargo binstall cargo-nextest --no-confirm + cargo binstall cargo-nextest --no-confirm --force fi # Run workspace tests