mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-16 09:39:52 +02:00
ci: inline runner selection
We are currently sometimes backlogged on waiting for runner selection. Selecting Warp or GitHub-hosted runners directly from the repository context avoids serializing all CI jobs behind a metadata job. This keeps forks on public runners while allowing upstream jobs to schedule immediately on the intended runner labels.
This commit is contained in:
57
.github/workflows/ci.yml
vendored
57
.github/workflows/ci.yml
vendored
@@ -19,7 +19,6 @@ concurrency:
|
||||
|
||||
env:
|
||||
CI_FAILFAST_TEST_LEAVE_DANGLING: 1 # GHA does not care about dangling processes and setting this variable avoids killing the CI script itself on error
|
||||
REPO_USE_WARP_RUNNERS: 'bitcoin/bitcoin' # Use warp runners for this repo, instead of falling back to the slow GHA runners
|
||||
|
||||
defaults:
|
||||
run:
|
||||
@@ -28,12 +27,16 @@ defaults:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
runners:
|
||||
name: '[meta] determine runners'
|
||||
runs-on: ubuntu-slim
|
||||
outputs:
|
||||
provider: ${{ steps.runners.outputs.provider }}
|
||||
test-each-commit:
|
||||
name: 'test ancestor commits'
|
||||
runs-on: ${{ github.repository == 'bitcoin/bitcoin' && 'warp-ubuntu-latest-x64-8x' || 'ubuntu-latest' }}
|
||||
env:
|
||||
TEST_RUNNER_PORT_MIN: "14000" # Use a larger port range to avoid colliding with other CI services.
|
||||
if: github.event_name == 'pull_request' && github.event.pull_request.commits != 1
|
||||
timeout-minutes: 360 # Use maximum time, see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes.
|
||||
steps:
|
||||
- name: Determine fetch depth
|
||||
run: echo "FETCH_DEPTH=$((${{ github.event.pull_request.commits }} + 2))" >> "$GITHUB_ENV"
|
||||
- &ANNOTATION_PR_NUMBER
|
||||
name: Annotate with pull request number
|
||||
# This annotation is machine-readable and can be used to assign a check
|
||||
@@ -44,28 +47,6 @@ jobs:
|
||||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||
echo "::notice title=debug_pull_request_number_str::${{ github.event.number }}"
|
||||
fi
|
||||
- id: runners
|
||||
run: |
|
||||
if [[ "${REPO_USE_WARP_RUNNERS}" == "${{ github.repository }}" ]]; then
|
||||
echo "provider=warp" >> "$GITHUB_OUTPUT"
|
||||
echo "::notice title=Runner Selection::Using Warp Runners"
|
||||
else
|
||||
echo "provider=gha" >> "$GITHUB_OUTPUT"
|
||||
echo "::notice title=Runner Selection::Using GitHub-hosted runners"
|
||||
fi
|
||||
|
||||
test-each-commit:
|
||||
name: 'test ancestor commits'
|
||||
needs: runners
|
||||
runs-on: ${{ needs.runners.outputs.provider == 'warp' && 'warp-ubuntu-latest-x64-8x' || 'ubuntu-latest' }}
|
||||
env:
|
||||
TEST_RUNNER_PORT_MIN: "14000" # Use a larger port range to avoid colliding with other CI services.
|
||||
if: github.event_name == 'pull_request' && github.event.pull_request.commits != 1
|
||||
timeout-minutes: 360 # Use maximum time, see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes.
|
||||
steps:
|
||||
- name: Determine fetch depth
|
||||
run: echo "FETCH_DEPTH=$((${{ github.event.pull_request.commits }} + 2))" >> "$GITHUB_ENV"
|
||||
- *ANNOTATION_PR_NUMBER
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
@@ -324,8 +305,8 @@ jobs:
|
||||
|
||||
windows-cross:
|
||||
name: 'Windows-cross to x86_64, ${{ matrix.crt }}'
|
||||
needs: [runners, record-frozen-commit]
|
||||
runs-on: ${{ needs.runners.outputs.provider == 'warp' && 'warp-ubuntu-latest-x64-4x' || 'ubuntu-latest' }}
|
||||
needs: record-frozen-commit
|
||||
runs-on: ${{ github.repository == 'bitcoin/bitcoin' && 'warp-ubuntu-latest-x64-4x' || 'ubuntu-latest' }}
|
||||
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
|
||||
|
||||
strategy:
|
||||
@@ -359,7 +340,7 @@ jobs:
|
||||
id: restore-cache
|
||||
uses: ./.github/actions/cache/restore
|
||||
with:
|
||||
provider: ${{ needs.runners.outputs.provider }}
|
||||
provider: ${{ github.repository == 'bitcoin/bitcoin' && 'warp' || 'gha' }}
|
||||
|
||||
- name: Configure Docker
|
||||
uses: ./.github/actions/configure-docker
|
||||
@@ -370,7 +351,7 @@ jobs:
|
||||
- name: Save caches
|
||||
uses: ./.github/actions/cache/save
|
||||
with:
|
||||
provider: ${{ needs.runners.outputs.provider }}
|
||||
provider: ${{ github.repository == 'bitcoin/bitcoin' && 'warp' || 'gha' }}
|
||||
|
||||
- name: Upload built executables
|
||||
uses: actions/upload-artifact@v7
|
||||
@@ -437,8 +418,7 @@ jobs:
|
||||
|
||||
ci-matrix:
|
||||
name: ${{ matrix.name }}
|
||||
needs: runners
|
||||
runs-on: ${{ needs.runners.outputs.provider == 'warp' && matrix.warp-runner || matrix.fallback-runner }}
|
||||
runs-on: ${{ github.repository == 'bitcoin/bitcoin' && matrix.warp-runner || matrix.fallback-runner }}
|
||||
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
|
||||
timeout-minutes: ${{ matrix.timeout-minutes }}
|
||||
|
||||
@@ -553,13 +533,13 @@ jobs:
|
||||
id: restore-cache
|
||||
uses: ./.github/actions/cache/restore
|
||||
with:
|
||||
provider: ${{ matrix.provider || needs.runners.outputs.provider }}
|
||||
provider: ${{ matrix.provider || (github.repository == 'bitcoin/bitcoin' && 'warp' || 'gha') }}
|
||||
|
||||
- name: Configure Docker
|
||||
uses: ./.github/actions/configure-docker
|
||||
|
||||
- name: Clear unnecessary files
|
||||
if: ${{ needs.runners.outputs.provider == 'gha' && true || false }} # Only needed on GHA runners
|
||||
if: ${{ github.repository != 'bitcoin/bitcoin' || matrix.provider == 'gha' }} # Only needed on GHA runners
|
||||
uses: ./.github/actions/clear-files
|
||||
|
||||
- name: Enable bpfcc script
|
||||
@@ -579,12 +559,11 @@ jobs:
|
||||
- name: Save caches
|
||||
uses: ./.github/actions/cache/save
|
||||
with:
|
||||
provider: ${{ matrix.provider || needs.runners.outputs.provider }}
|
||||
provider: ${{ matrix.provider || (github.repository == 'bitcoin/bitcoin' && 'warp' || 'gha') }}
|
||||
|
||||
lint:
|
||||
name: 'lint'
|
||||
needs: runners
|
||||
runs-on: ${{ needs.runners.outputs.provider == 'warp' && 'warp-ubuntu-latest-x64-2x' || 'ubuntu-latest' }}
|
||||
runs-on: ${{ github.repository == 'bitcoin/bitcoin' && 'warp-ubuntu-latest-x64-2x' || 'ubuntu-latest' }}
|
||||
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
|
||||
timeout-minutes: 20
|
||||
env:
|
||||
|
||||
Reference in New Issue
Block a user