From b017e98eb9936fb0f3e12f24250bfaf2f7bc6ab9 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Wed, 3 Jul 2024 11:46:04 -0700 Subject: [PATCH 1/9] Add submodule pin check to CI This checks that submodules are ancestors of origin/HEAD so that non-merged branches aren't accidentally checked in. --- .github/workflows/submodule-pin-check.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/submodule-pin-check.yml diff --git a/.github/workflows/submodule-pin-check.yml b/.github/workflows/submodule-pin-check.yml new file mode 100644 index 0000000000..43984f1158 --- /dev/null +++ b/.github/workflows/submodule-pin-check.yml @@ -0,0 +1,15 @@ +name: Merge Checks + +on: + pull_request: + branches: [ master ] + types: [synchronize, opened, reopened, labeled, unlabeled] + +jobs: + submodule-pin-check: + name: Submodule Pin Check + runs-on: ubuntu-latest + steps: + - name: Check all submodules are under origin/HEAD + run: git submodule foreach git merge-base --is-ancestor HEAD origin/HEAD + From b64dc4fcc611592653d7b3f7b032afb0bb780ebf Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Wed, 3 Jul 2024 12:02:50 -0700 Subject: [PATCH 2/9] Add checkout step --- .github/workflows/submodule-pin-check.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/submodule-pin-check.yml b/.github/workflows/submodule-pin-check.yml index 43984f1158..050eea4b25 100644 --- a/.github/workflows/submodule-pin-check.yml +++ b/.github/workflows/submodule-pin-check.yml @@ -10,6 +10,9 @@ jobs: name: Submodule Pin Check runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Check all submodules are under origin/HEAD run: git submodule foreach git merge-base --is-ancestor HEAD origin/HEAD From 9e45391518493f4bfebd0e52e207572b0db9fb8d Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Wed, 3 Jul 2024 12:05:41 -0700 Subject: [PATCH 3/9] Check out submodules --- .github/workflows/submodule-pin-check.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/submodule-pin-check.yml b/.github/workflows/submodule-pin-check.yml index 050eea4b25..86a69c94cd 100644 --- a/.github/workflows/submodule-pin-check.yml +++ b/.github/workflows/submodule-pin-check.yml @@ -12,6 +12,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + submodules: recursive - name: Check all submodules are under origin/HEAD run: git submodule foreach git merge-base --is-ancestor HEAD origin/HEAD From 30870b5a05af710cf56d03208ecd17bb626ae2db Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Wed, 3 Jul 2024 12:12:16 -0700 Subject: [PATCH 4/9] Update arbitrator/langs/bf pin --- arbitrator/langs/bf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrator/langs/bf b/arbitrator/langs/bf index 062b87bad1..cb5750580f 160000 --- a/arbitrator/langs/bf +++ b/arbitrator/langs/bf @@ -1 +1 @@ -Subproject commit 062b87bad1ec00d42b9cc2b5ee41e63cd6ff1cbb +Subproject commit cb5750580f6990b5166ffce83de11b766a25ca31 From bbd649e664d4a1c47b0b09986015c6a548ddb12c Mon Sep 17 00:00:00 2001 From: Tristan-Wilson <87238672+Tristan-Wilson@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:55:22 -0700 Subject: [PATCH 5/9] Update .github/workflows/submodule-pin-check.yml Co-authored-by: Gabriel de Quadros Ligneul <8294320+gligneul@users.noreply.github.com> --- .github/workflows/submodule-pin-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submodule-pin-check.yml b/.github/workflows/submodule-pin-check.yml index 86a69c94cd..ac0b8fba89 100644 --- a/.github/workflows/submodule-pin-check.yml +++ b/.github/workflows/submodule-pin-check.yml @@ -1,4 +1,4 @@ -name: Merge Checks +name: Submodule Pin Check on: pull_request: From c3999026cff51e75226072a300467cdc7f07126a Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Mon, 8 Jul 2024 04:44:35 -0700 Subject: [PATCH 6/9] Remove check for labeled/unlabeled --- .github/workflows/submodule-pin-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submodule-pin-check.yml b/.github/workflows/submodule-pin-check.yml index ac0b8fba89..b37cc7b9d5 100644 --- a/.github/workflows/submodule-pin-check.yml +++ b/.github/workflows/submodule-pin-check.yml @@ -3,7 +3,7 @@ name: Submodule Pin Check on: pull_request: branches: [ master ] - types: [synchronize, opened, reopened, labeled, unlabeled] + types: [synchronize, opened, reopened] jobs: submodule-pin-check: From fc3402e43f3f5975fba15c26ed7d114bd09822c3 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Tue, 9 Jul 2024 11:25:36 +0200 Subject: [PATCH 7/9] Support different branches for submodule pin check --- .github/workflows/submodule-pin-check.sh | 22 ++++++++++++++++++++++ .github/workflows/submodule-pin-check.yml | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 .github/workflows/submodule-pin-check.sh diff --git a/.github/workflows/submodule-pin-check.sh b/.github/workflows/submodule-pin-check.sh new file mode 100755 index 0000000000..a246e2e3e9 --- /dev/null +++ b/.github/workflows/submodule-pin-check.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +declare -Ar exceptions=( + [contracts]=origin/develop + [nitro-testnode]=origin/master +) + +divergent=0 +for mod in `git submodule --quiet foreach 'echo $name'`; do + branch=origin/HEAD + if [[ -v exceptions[$mod] ]]; then + branch=${exceptions[$mod]} + fi + + if ! git -C $mod merge-base --is-ancestor HEAD $branch; then + echo $mod diverges from $branch + divergent=1 + fi +done + +exit $divergent + diff --git a/.github/workflows/submodule-pin-check.yml b/.github/workflows/submodule-pin-check.yml index b37cc7b9d5..56dd2148f8 100644 --- a/.github/workflows/submodule-pin-check.yml +++ b/.github/workflows/submodule-pin-check.yml @@ -16,5 +16,5 @@ jobs: submodules: recursive - name: Check all submodules are under origin/HEAD - run: git submodule foreach git merge-base --is-ancestor HEAD origin/HEAD + run: ${{ github.workspace }}/.github/workflows/submodule-pin-check.sh From 919b73742cfd0c01faf7afee40d761a2c11b981c Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Tue, 9 Jul 2024 11:30:41 +0200 Subject: [PATCH 8/9] Fetch submodule branches --- .github/workflows/submodule-pin-check.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/submodule-pin-check.yml b/.github/workflows/submodule-pin-check.yml index 56dd2148f8..e459bad34d 100644 --- a/.github/workflows/submodule-pin-check.yml +++ b/.github/workflows/submodule-pin-check.yml @@ -13,8 +13,9 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: + fetch-depth: 0 submodules: recursive - - name: Check all submodules are under origin/HEAD + - name: Check all submodules are ancestors of origin/HEAD or configured branch run: ${{ github.workspace }}/.github/workflows/submodule-pin-check.sh From a464232191be272f487ec248fcd8d994a2131083 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Wed, 10 Jul 2024 13:25:26 +0200 Subject: [PATCH 9/9] Add exceptions for some arbitrator submodules --- .github/workflows/submodule-pin-check.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/submodule-pin-check.sh b/.github/workflows/submodule-pin-check.sh index a246e2e3e9..aecb287ce1 100755 --- a/.github/workflows/submodule-pin-check.sh +++ b/.github/workflows/submodule-pin-check.sh @@ -3,6 +3,10 @@ declare -Ar exceptions=( [contracts]=origin/develop [nitro-testnode]=origin/master + + #TODO Rachel to check these are the intended branches. + [arbitrator/langs/c]=origin/vm-storage-cache + [arbitrator/tools/wasmer]=origin/adopt-v4.2.8 ) divergent=0