mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-17 01:58:57 +02:00
Merge bitcoin/bitcoin#35441: ci: inline runner selection
726e196ef2ci: inline runner selection (will) Pull request description: 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 will make the changes needed for "a fork also wanting to use warp runners" slightly larger, but I think that number of people is zero. ACKs for top commit: m3dwards: ACK726e196ef2Tree-SHA512: 14f3f22fbc53b3f65fce48bd08aef8db8d60a37409fd8b4b5b128073cf81408f7d3135c1e78fe3f93af8c88b3ee8c1b770e445b1ee7d5650ea91b329bc7ff777
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
|
||||
@@ -372,7 +353,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
|
||||
@@ -439,8 +420,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 }}
|
||||
|
||||
@@ -555,7 +535,7 @@ 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
|
||||
@@ -563,7 +543,7 @@ jobs:
|
||||
provider: ${{ matrix.provider || needs.runners.outputs.provider }}
|
||||
|
||||
- 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
|
||||
@@ -583,12 +563,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