Check each commit at least builds in CI 2020-09-ci-check-commits
authorMatt Corallo <git@bluematt.me>
Tue, 15 Sep 2020 18:39:44 +0000 (14:39 -0400)
committerMatt Corallo <git@bluematt.me>
Tue, 15 Sep 2020 23:24:08 +0000 (19:24 -0400)
.github/workflows/build.yml
ci/check-compiles.sh [new file with mode: 0755]
ci/check-each-commit.sh [new file with mode: 0755]

index 95372d729273d6731102ce17450c7e400e057360..d75607a18bc9bf17b71e0a02ca8cedcbc87f1f79 100644 (file)
@@ -78,6 +78,29 @@ jobs:
           token: f421b687-4dc2-4387-ac3d-dc3b2528af57
           fail_ci_if_error: true
 
+  check_commits:
+    runs-on: ubuntu-latest
+    env:
+      TOOLCHAIN: stable
+    steps:
+      - name: Checkout source code
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+      - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
+        uses: actions-rs/toolchain@v1
+        with:
+          toolchain: ${{ env.TOOLCHAIN }}
+          override: true
+          profile: minimal
+      - name: Fetch full tree and rebase on upstream
+        run: |
+          git remote add upstream https://github.com/rust-bitcoin/rust-lightning
+          git fetch upstream
+          git rebase upstream/main
+      - name: For each commit, run cargo check (including in fuzz)
+        run: ci/check-each-commit.sh upstream/main
+
   fuzz:
     runs-on: ubuntu-latest
     env:
diff --git a/ci/check-compiles.sh b/ci/check-compiles.sh
new file mode 100755 (executable)
index 0000000..177765f
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+set -x
+echo Testing $(git log -1 --oneline)
+cargo check
+cd fuzz && cargo check --features=stdin_fuzz
diff --git a/ci/check-each-commit.sh b/ci/check-each-commit.sh
new file mode 100755 (executable)
index 0000000..e4723c8
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+if [ "$1" = "" ]; then
+       echo "USAGE: $0 remote/head_branch"
+       echo "eg $0 upstream/main"
+       exit 1
+fi
+
+set -e
+set -x
+
+if [ "$(git log --pretty="%H %D" | grep "^[0-9a-f]*.* $1")" = "" ]; then
+       echo "It seems like the current checked-out commit is not based on $1"
+       exit 1
+fi
+git rebase --exec ci/check-compiles.sh $1