From fa0d0be05c0e012e29a4640c3066c81066cd6d2e Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Fri, 4 Apr 2025 08:50:25 +0200 Subject: [PATCH 1/2] ci: Merge master in test-each-commit task (take 2) * Run git config earlier and only once * Run git merge in the yaml, before calling the bash script * Run git reset in the yaml as well, for symmetry * Replace "git merge --abort" with "git reset --hard", because it does not fail when already up to date and no merge was started. --- .github/ci-test-each-commit-exec.sh | 6 ------ .github/workflows/ci.yml | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/ci-test-each-commit-exec.sh b/.github/ci-test-each-commit-exec.sh index 61aa42ea0bb..1b081243a2c 100755 --- a/.github/ci-test-each-commit-exec.sh +++ b/.github/ci-test-each-commit-exec.sh @@ -11,15 +11,9 @@ 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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7849d3369d..ae2ade3f5c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,13 +73,15 @@ jobs: 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 + git config user.email "ci@example.com" + git config user.name "CI" - 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 - git rebase --exec "./.github/ci-test-each-commit-exec.sh" ${{ env.TEST_BASE }} + git rebase --exec "git merge --no-commit origin/master && ./.github/ci-test-each-commit-exec.sh && git reset --hard" ${{ env.TEST_BASE }} macos-native-arm64: name: ${{ matrix.job-name }} From fa10a1ded5b747e9db6d6c1942fceb279f1abedc Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Fri, 4 Apr 2025 10:48:58 +0200 Subject: [PATCH 2/2] ci: Use GITHUB_BASE_REF over hard-coded master --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae2ade3f5c6..1d6521a3f45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: 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 + git fetch origin "${GITHUB_BASE_REF}" git config user.email "ci@example.com" git config user.name "CI" - run: | @@ -81,7 +81,7 @@ jobs: - name: Compile and run tests run: | # Run tests on commits after the last merge commit and before the PR head commit - git rebase --exec "git merge --no-commit origin/master && ./.github/ci-test-each-commit-exec.sh && git reset --hard" ${{ env.TEST_BASE }} + git rebase --exec "git merge --no-commit origin/${GITHUB_BASE_REF} && ./.github/ci-test-each-commit-exec.sh && git reset --hard" ${{ env.TEST_BASE }} macos-native-arm64: name: ${{ matrix.job-name }}