Maintainer note: SKIP_BRANCH_PUSH=true
must be set in Cirrus for bitcoin-core/gui
before merging this. See https://cirrus-ci.com/github/bitcoin-core/gui
-> Settings.
I find myself making pull requests against my fork (mostly on top of #28983, or asking others to do so. Currently only the Github actions are run on forks, because we use self-hosted runners for the Cirrus tasks.
While setting up my own self-hosted runners for my fork, I ran into a number of issues. Some of those were addressed by #29441, but remaining issues are:
-
When PRs are opened in the fork, cirrus CI jobs are run twice because PRs and branches reside in the same repository, rather than a main repository and a fork repository, as is the case with bitcoin/bitcoin PRs. Fix this by adding a
SKIP_BRANCH_PUSH
configuration option that allows skipping CI runs not directly associated with a PR. The fix is a generalization of #20328, which fixed a similar problem for the bitcoin-core/gui mirror repository, and it allows removing a hardcoded reference to that repository.Github actions jobs will still run twice despite this change, see #29274 (comment). Initially this PR tried to prevent that with https://github.com/bitcoin/bitcoin/commit/b9fdd0dc75b5b4944dffc700b0391b38465f754a, but this had some potentially negative side effects, see #29274 (comment), so that commit was dropped for now.
-
When PRs are opened in the fork, the “test-each-commit” github action can fail due to not being able to find a recent merge commit. This problem doesn’t happen in the bitcoin/bitcoin repository because branches in this repository used as the base for pull requests always point at merge commits.
This PR replaces #29259 using the self hosted workers via Cirrus instead of Github.
You can see this PR in action on this pull request to my fork: https://github.com/Sjors/bitcoin/pull/30
To test it yourself:
- spin up at least two self hosted runners. Either use a seperate VM for each, or give them their own user.
- Install Podman and other CI dependencies (see .cirrus.yml)
- Give Cirrus access to your fork at https://cirrus-ci.com/settings/github/YOU
- Get a token from Cirrus and use it to start your worker(s)
- Optionally set SKIP_BRANCH_PUSH=true
and NO_ARM=trueenv variables (see .cirrus.yml) make a pull request to your own fork, with this PR as the base branch
Security wise: when dealing with code from strangers on the internet, review it first before running the CI. There’s a Cirrus check-box that requires approval for people without write access to trigger CI.