diff options
author | Sjors Provoost <sjors@sprovoost.nl> | 2024-06-25 14:42:20 +0200 |
---|---|---|
committer | Sjors Provoost <sjors@sprovoost.nl> | 2024-06-25 20:03:44 +0200 |
commit | 576828e732bacb61b608cd89f669a2936d3e8d00 (patch) | |
tree | b72eec9197c09c6fe0e1356af6c77dd709d70ca3 /.github | |
parent | e9bfbb5414ab14ca14d8edcfdf77f28c9ed67c33 (diff) |
ci: test-each-commit merge base optional
The ci "test-each-commit" job fetches the PR branch being tested with a depth of (# of commits in PR + 2), and then tries to run tests on commits after the most recent merge commit.
When a PR is opened against a bitcoin core branch, a merge commit is always guaranteed to exist within the fetch depth, because bitcoin core branches always point at merge commits.
However, in fork repositories, pull requests can be opened based on other branches that don't contain recent merge commits, and this will currently cause git rev-list to fail with fatal: bad revision '^^@'.
Work around this problem by not requiring a recent merge commit, and just testing on all fetched commits if a merge commit can't be found.
Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/ci.yml | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54795332e8..ab9704c0af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,13 @@ jobs: # and the ^ prefix is used to exclude these parents and all their # ancestors from the rev-list output as described in: # https://git-scm.com/docs/git-rev-list - echo "TEST_BASE=$(git rev-list -n$((${{ env.MAX_COUNT }} + 1)) --reverse HEAD ^$(git rev-list -n1 --merges HEAD)^@ | head -1)" >> "$GITHUB_ENV" + MERGE_BASE=$(git rev-list -n1 --merges HEAD) + EXCLUDE_MERGE_BASE_ANCESTORS= + # MERGE_BASE can be empty due to limited fetch-depth + if test -n "$MERGE_BASE"; then + 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: | sudo apt-get update sudo apt-get 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 qtbase5-dev qttools5-dev qttools5-dev-tools qtwayland5 libqrencode-dev -y |