Skip to content

Commit 737aac8

Browse files
committed
Merge bitcoin/bitcoin#28497: ci: Reintroduce fixed "test-each-commit" job
27b636a ci: Reintroduce fixed "test-each-commit" job (Hennadii Stepanov) Pull request description: This is a fixed version of bitcoin/bitcoin#28279: > Currently, if a pull request has more than one commit, previous commits may fail to compile, or may fail the tests. This is problematic, because it breaks git-bisect, or worse. > > Fix this by adding a CI task for this. The new job checks at most 6 commits of a pull request, excluding the top one. The maximum number of tested commits is 6, which derives from the time [constrains](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes). For historical context, please see: - bitcoin/bitcoin#28279 - bitcoin/bitcoin#28477 - bitcoin/bitcoin#28478 **A note for reviewers:** To test scripts locally, ensure that you works with a _shallow_ copy of the repo. ACKs for top commit: MarcoFalke: lgtm ACK 27b636a Tree-SHA512: 0c69ced13509fa0ed2dd6ef13f4c710d678e31b294b6318b59ab1ba899086a71b5c893aaf70e143036349329167bf8e16bdca319b2c761e2aef6222d0db1470c
2 parents a5979a8 + 27b636a commit 737aac8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/ci.yml

+22
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,28 @@ env:
2323
MAKEJOBS: '-j10'
2424

2525
jobs:
26+
test-each-commit:
27+
name: 'test each commit'
28+
runs-on: ubuntu-22.04
29+
if: github.event_name == 'pull_request' && github.event.pull_request.commits != 1
30+
timeout-minutes: 360 # Use maximum time, see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes. Assuming a worst case time of 1 hour per commit, this leads to a --max-count=6 below.
31+
env:
32+
MAX_COUNT: 6
33+
steps:
34+
- run: echo "FETCH_DEPTH=$((${{ github.event.pull_request.commits }} + 2))" >> "$GITHUB_ENV"
35+
- uses: actions/checkout@v4
36+
with:
37+
ref: ${{ github.event.pull_request.head.sha }}
38+
fetch-depth: ${{ env.FETCH_DEPTH }}
39+
- run: |
40+
git checkout HEAD~
41+
echo "COMMIT_AFTER_LAST_MERGE=$(git log $(git log --merges -1 --format=%H)..HEAD --format=%H --max-count=${{ env.MAX_COUNT }} | tail -1)" >> "$GITHUB_ENV"
42+
- run: sudo apt install clang ccache build-essential libtool autotools-dev automake pkg-config bsdmainutils python3-zmq libevent-dev libboost-dev libsqlite3-dev libdb++-dev systemtap-sdt-dev libminiupnpc-dev libnatpmp-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools qtwayland5 libqrencode-dev -y
43+
- name: Compile and run tests
44+
run: |
45+
# Use clang++, because it is a bit faster and uses less memory than g++
46+
git rebase --exec "echo Running test-one-commit on \$( git log -1 ) && ./autogen.sh && CC=clang CXX=clang++ ./configure && make clean && make -j $(nproc) check && ./test/functional/test_runner.py -j $(( $(nproc) * 2 ))" ${{ env.COMMIT_AFTER_LAST_MERGE }}~1
47+
2648
macos-native-x86_64:
2749
name: 'macOS 13 native, x86_64, no depends, sqlite only, gui'
2850
# Use latest image, but hardcode version to avoid silent upgrades (and breaks).

0 commit comments

Comments
 (0)