summaryrefslogtreecommitdiffstats
path: root/.ci
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2021-01-26 10:09:14 +0100
committerAzul <azul@riseup.net>2021-01-27 09:17:03 +0100
commit320ce805978d45631c2f2180f453dc1b97198f08 (patch)
tree2796e0fd308a4ce3c6feaf15ba413ad55e50d802 /.ci
parent3d8bad0e9d9a6c640159ff666b1d99cc0e9c0c36 (diff)
ci: Leave out last commit in all_commits.
- If there is only one commit do not rebase at all. An empty rebase with --exec will still run the exec command once. - Fixes #628.
Diffstat (limited to '.ci')
-rwxr-xr-x.ci/all_commits.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/.ci/all_commits.sh b/.ci/all_commits.sh
new file mode 100755
index 00000000..b44f48c5
--- /dev/null
+++ b/.ci/all_commits.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+# Test all commits on this branch but the last one.
+#
+# Used in the all_commits ci job to ensure all commits build
+# and tests pass at least for the sequoia-openpgp crate.
+
+# Use dummy identity to make git rebase happy.
+git config user.name "C.I. McTestface"
+git config user.email "ci.mctestface@example.com"
+
+# If the previous commit already is on main we're done.
+git merge-base --is-ancestor HEAD~ origin/main &&
+ echo "All commits tested already" &&
+ exit 0
+
+# Leave out the last commit - it has already been checked.
+git checkout HEAD~
+git rebase origin/main \
+ --exec 'echo ===; echo ===; echo ===; git log -n 1;' \
+ --exec 'cargo test -p sequoia-openpgp' &&
+ echo "All commits passed tests" &&
+ exit 0
+
+# The rebase failed - probably because a test failed.
+git rebase --abort; exit 1