From 6dd27ac6df9aa2decf4bba18db78e2c86696224e Mon Sep 17 00:00:00 2001 From: Yash Atreya <44857776+yash-atreya@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:29:59 +0530 Subject: [PATCH] chore: add scripts --- scripts/changelog.sh | 24 ++++++++++++++++++++++++ scripts/check_no_std.sh | 24 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100755 scripts/changelog.sh create mode 100755 scripts/check_no_std.sh diff --git a/scripts/changelog.sh b/scripts/changelog.sh new file mode 100755 index 0000000..8055e61 --- /dev/null +++ b/scripts/changelog.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -eo pipefail + +run_unless_dry_run() { + if [ "$DRY_RUN" = "true" ]; then + echo "skipping due to dry run: $*" >&2 + else + "$@" + fi +} + +root=$WORKSPACE_ROOT +crate=$CRATE_ROOT +crate_glob="${crate#"$root/"}/**" + +if [[ "$crate" = */tests/* || "$crate" = *test-utils* ]]; then + exit 0 +fi + +command=(git cliff --workdir "$root" --config "$root/cliff.toml" "${@}") +run_unless_dry_run "${command[@]}" --output "$root/CHANGELOG.md" +if [ -n "$crate" ] && [ "$root" != "$crate" ]; then + run_unless_dry_run "${command[@]}" --include-path "$crate_glob" --output "$crate/CHANGELOG.md" +fi diff --git a/scripts/check_no_std.sh b/scripts/check_no_std.sh new file mode 100755 index 0000000..1aa49ec --- /dev/null +++ b/scripts/check_no_std.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -eo pipefail + +no_std_packages=( + alloy-eips + alloy-genesis + alloy-serde + alloy-consensus +) + +for package in "${no_std_packages[@]}"; do + cmd="cargo +stable build -p $package --target riscv32imac-unknown-none-elf --no-default-features" + if [ -n "$CI" ]; then + echo "::group::$cmd" + else + printf "\n%s:\n %s\n" "$package" "$cmd" + fi + + $cmd + + if [ -n "$CI" ]; then + echo "::endgroup::" + fi +done