summaryrefslogtreecommitdiff
path: root/scripts/ci-check-charon-pin.sh
diff options
context:
space:
mode:
authorNadrieril2024-05-28 16:05:56 +0200
committerGuillaume Boisseau2024-05-29 09:58:47 +0200
commitb5046454b47aba598a42d3d775d2ec54dc57c75a (patch)
tree418e762725695887dd927d32669ae01e007bad10 /scripts/ci-check-charon-pin.sh
parentacd9eb9caa74d4def48527cfa8b7f12eb78f92ad (diff)
ci: Check correctness of the charon pinned commit
Diffstat (limited to '')
-rwxr-xr-xscripts/ci-check-charon-pin.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/ci-check-charon-pin.sh b/scripts/ci-check-charon-pin.sh
new file mode 100755
index 00000000..4aacd96e
--- /dev/null
+++ b/scripts/ci-check-charon-pin.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+# Checks that the charon pin:
+# - moves forward from the previous pin, to ensure we don't regress the charon version;
+# - is merged into Charon.
+
+NEW_CHARON_PIN="$(cat flake.lock | jq -r .nodes.charon.locked.rev)"
+OLD_CHARON_PIN="$(git show origin/main:flake.lock | jq -r .nodes.charon.locked.rev)"
+echo "This PR updates the charon pin from $OLD_CHARON_PIN to $NEW_CHARON_PIN"
+
+git clone https://github.com/AeneasVerif/charon
+cd charon
+CHARON_MAIN="$(git rev-parse HEAD)"
+
+if ! git merge-base --is-ancestor "$OLD_CHARON_PIN" "$NEW_CHARON_PIN"; then
+ echo "Error: the new charon pin does not have the old one as its ancestor. The pin must only move forward."
+ exit 1
+fi
+
+if ! git merge-base --is-ancestor "$NEW_CHARON_PIN" "$CHARON_MAIN"; then
+ echo "Error: commit $NEW_CHARON_PIN is not merged into Charon."
+ exit 1
+fi