From cec005e5aa3dfbc075a51564e6b3e1d4eaf075fa Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 14 Nov 2024 11:40:30 +0100 Subject: [PATCH] Split the check-charon-pin job in two --- .github/workflows/ci.yml | 12 ++++++++++-- ...n-pin.sh => ci-check-charon-pin-is-forward.sh} | 10 +--------- scripts/ci-check-charon-pin-is-merged.sh | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 11 deletions(-) rename scripts/{ci-check-charon-pin.sh => ci-check-charon-pin-is-forward.sh} (60%) create mode 100755 scripts/ci-check-charon-pin-is-merged.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8175d6b16..d9045dfc7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,13 +54,21 @@ jobs: - uses: actions/checkout@v4 - run: nix develop --command bash -c "cd tests/lean && make" - check-charon-pin: + charon-pin-is-forward: runs-on: [self-hosted, linux, nix] steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # deep clone in order to get access to other commits - - run: nix develop --command ./scripts/ci-check-charon-pin.sh + - run: nix develop --command ./scripts/ci-check-charon-pin-is-forward.sh + + charon-pin-is-merged: + runs-on: [self-hosted, linux, nix] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # deep clone in order to get access to other commits + - run: nix develop --command ./scripts/ci-check-charon-pin-is-merged.sh userdocs: runs-on: [self-hosted, linux, nix] diff --git a/scripts/ci-check-charon-pin.sh b/scripts/ci-check-charon-pin-is-forward.sh similarity index 60% rename from scripts/ci-check-charon-pin.sh rename to scripts/ci-check-charon-pin-is-forward.sh index 4aacd96ed..ec1255b55 100755 --- a/scripts/ci-check-charon-pin.sh +++ b/scripts/ci-check-charon-pin-is-forward.sh @@ -1,7 +1,5 @@ #!/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. +# Checks that the charon pin moves forward from the previous pin, to ensure we don't regress the Charon version. 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)" @@ -9,14 +7,8 @@ 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 diff --git a/scripts/ci-check-charon-pin-is-merged.sh b/scripts/ci-check-charon-pin-is-merged.sh new file mode 100755 index 000000000..fe7ca3536 --- /dev/null +++ b/scripts/ci-check-charon-pin-is-merged.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Checks that the charon pin 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 "$NEW_CHARON_PIN" "$CHARON_MAIN"; then + echo "Error: commit $NEW_CHARON_PIN is not merged into Charon." + exit 1 +fi