Merge bitcoin/bitcoin#32203: ci: Merge master in test-each-commit task

faa807bdf8 ci: Merge master in test-each-commit task (MarcoFalke)

Pull request description:

  The `test-each-commit` task will often fail, when the CI config yaml is updated along with code changes.

  This is because, GitHub seems to be merging the CI config on a fresh pull with the current target branch (`master`). However, the code changes are not.

  A tedious workaround would be for every developer to rebase on every intermittent (https://github.com/bitcoin/bitcoin/issues/31946#issuecomment-2740911853) and non-intermittent CI issue.

  However, fix this instead by merging with `master`.

ACKs for top commit:
  laanwj:
    ACK faa807bdf8
  hebasto:
    ACK faa807bdf8.

Tree-SHA512: 4849bd558dc6cdc7d86b95164ccee32ab7c08c9b7d31cf8ec5c8e9a2251fc819630f8fa9b929ed39e8e033c67bb006f0beb33e0de216e1224680be88c5fa0161
This commit is contained in:
Hennadii Stepanov 2025-04-04 07:19:30 +01:00
commit b34d49a27e
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 28 additions and 2 deletions

25
.github/ci-test-each-commit-exec.sh vendored Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
#
# Copyright (c) The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
export LC_ALL=C.UTF-8
set -o errexit -o pipefail -o xtrace
echo "Running test-one-commit on $( git log -1 )"
git config user.email "ci@example.com"
git config user.name "CI"
git merge --no-commit origin/master
# Use clang++, because it is a bit faster and uses less memory than g++
CC=clang CXX=clang++ cmake -B build -DWERROR=ON -DWITH_ZMQ=ON -DBUILD_GUI=ON -DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DWITH_BDB=ON -DWITH_USDT=ON -DCMAKE_CXX_FLAGS='-Wno-error=unused-member-function'
cmake --build build -j "$( nproc )" && ctest --output-on-failure --stop-on-failure --test-dir build -j "$( nproc )"
./build/test/functional/test_runner.py -j $(( $(nproc) * 2 )) --combinedlogslen=99999999
git merge --abort

View file

@ -71,14 +71,15 @@ jobs:
EXCLUDE_MERGE_BASE_ANCESTORS=^${MERGE_BASE}^@
fi
echo "TEST_BASE=$(git rev-list -n$((${{ env.MAX_COUNT }} + 1)) --reverse HEAD $EXCLUDE_MERGE_BASE_ANCESTORS | head -1)" >> "$GITHUB_ENV"
- run: |
git fetch origin master
- run: |
sudo apt-get update
sudo apt-get install clang ccache build-essential cmake ninja-build pkgconf python3-zmq libevent-dev libboost-dev libsqlite3-dev libdb++-dev systemtap-sdt-dev libzmq3-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev -y
- name: Compile and run tests
run: |
# Run tests on commits after the last merge commit and before the PR head commit
# Use clang++, because it is a bit faster and uses less memory than g++
git rebase --exec "echo Running test-one-commit on \$( git log -1 ) && CC=clang CXX=clang++ cmake -B build -DWERROR=ON -DWITH_ZMQ=ON -DBUILD_GUI=ON -DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DWITH_BDB=ON -DWITH_USDT=ON -DCMAKE_CXX_FLAGS='-Wno-error=unused-member-function' && cmake --build build -j $(nproc) && ctest --output-on-failure --stop-on-failure --test-dir build -j $(nproc) && ./build/test/functional/test_runner.py -j $(( $(nproc) * 2 )) --combinedlogslen=99999999" ${{ env.TEST_BASE }}
git rebase --exec "./.github/ci-test-each-commit-exec.sh" ${{ env.TEST_BASE }}
macos-native-arm64:
name: ${{ matrix.job-name }}