diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 434b5e16718..df46a53ea87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: