Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1# Copyright (c) 2023-present The Bitcoin Core developers2# Distributed under the MIT software license, see the accompanying3# file COPYING or https://opensource.org/license/mit.5name: CI6on:7# See: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request.8pull_request:9# See: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#push.10push:11branches:12- '**'13tags-ignore:14- '**'16concurrency:17group: ${{ github.event_name != 'pull_request' && github.run_id || github.ref }}18cancel-in-progress: true20env:21CI_FAILFAST_TEST_LEAVE_DANGLING: 1 # GHA does not care about dangling processes and setting this variable avoids killing the CI script itself on error23defaults:24run:25# Enforce fail-fast behavior for all platforms.26# See: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference27shell: bash29jobs:30test-each-commit:31name: 'test ancestor commits'32runs-on: ${{ github.repository == 'bitcoin/bitcoin' && 'warp-ubuntu-latest-x64-8x' || 'ubuntu-latest' }}33env:34TEST_RUNNER_PORT_MIN: "14000" # Use a larger port range to avoid colliding with other CI services.35if: github.event_name == 'pull_request' && github.event.pull_request.commits != 136timeout-minutes: 360 # Use maximum time, see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes.37steps:38- name: Determine fetch depth39run: echo "FETCH_DEPTH=$((${{ github.event.pull_request.commits }} + 2))" >> "$GITHUB_ENV"40- &ANNOTATION_PR_NUMBER41name: Annotate with pull request number42# This annotation is machine-readable and can be used to assign a check43# run to its corresponding pull request. Running in all check runs is44# required, because check re-runs discard the annotations of other45# tasks in the test suite.46run: |47if [ "${{ github.event_name }}" = "pull_request" ]; then48echo "::notice title=debug_pull_request_number_str::${{ github.event.number }}"49fi50- uses: actions/checkout@v651with:52ref: ${{ github.event.pull_request.head.sha }}53fetch-depth: ${{ env.FETCH_DEPTH }}54- name: Determine commit range55run: |56# Checkout HEAD~ and find the test base commit.57# Checkout HEAD~ because it would be wasteful to rerun58# tests on the PR head commit that are already run59# by other jobs.60git checkout HEAD~61# Moreover, pull requests that contain a merge commit62# are generally draft pull requests that merge in other63# pull requests, so only check the relevant commits64# after the last merge commit. A merge commit could65# also be a subtree merge commit, which may be66# worthwhile to check. However, it is rare that the67# subtree merge commit is not the top commit (which68# would be skipped anyway by this task, because it is69# run by all other tasks). Also, `git rebase --exec`70# does not work on merge commits, so if this was71# important to check, the logic would have to be72# rewritten.73#74# Figure out test base commit by listing ancestors of75# HEAD, excluding ancestors of the most recent merge76# commit, ordering them from oldest to newest, and77# taking the first one.78#79# In the command below, the ^@ suffix is used to refer80# to all parents of the merge commit as described in:81# https://git-scm.com/docs/git-rev-parse#_other_rev_parent_shorthand_notations82# and the ^ prefix is used to exclude these parents83# and all their ancestors from the rev-list output84# as described in:85# https://git-scm.com/docs/git-rev-list86MERGE_BASE=$(git rev-list -n1 --merges HEAD)87EXCLUDE_MERGE_BASE_ANCESTORS=88# MERGE_BASE can be empty due to limited fetch-depth89if test -n "$MERGE_BASE"; then90EXCLUDE_MERGE_BASE_ANCESTORS=^${MERGE_BASE}^@91fi92echo "TEST_BASE=$(git rev-list -n${{ github.event.pull_request.commits }} --reverse HEAD $EXCLUDE_MERGE_BASE_ANCESTORS | head -1)" >> "$GITHUB_ENV"93- run: |94git fetch origin "${GITHUB_BASE_REF}"95git config user.email "[email protected]"96git config user.name "CI"97- run: |98sudo apt-get update99sudo apt-get install clang mold ccache build-essential cmake ninja-build pkgconf python3-zmq libboost-dev libsqlite3-dev systemtap-sdt-dev libzmq3-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev capnproto libcapnp-dev -y100sudo pip3 install --break-system-packages pycapnp101- name: Compile and run tests102run: |103# Run tests on commits after the last merge commit and before the PR head commit104git rebase --exec "git merge --no-commit origin/${GITHUB_BASE_REF} && python3 ./.github/ci-test-each-commit-exec.py && git reset --hard" ${{ env.TEST_BASE }}106macos-native-arm64:107name: ${{ matrix.job-name }}108# Use any image to support the xcode-select below, but hardcode version to avoid silent upgrades (and breaks).109# See: https://github.com/actions/runner-images#available-images.110runs-on: macos-15112# When a contributor maintains a fork of the repo, any pull request they make113# to their own fork, or to the main repository, will trigger two CI runs:114# one for the branch push and one for the pull request.115# This can be avoided by setting SKIP_BRANCH_PUSH=true as a custom env variable116# in Github repository settings.117if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}119timeout-minutes: 120121strategy:122fail-fast: false123matrix:124job-type: [standard, fuzz]125include:126- job-type: standard127file-env: './ci/test/00_setup_env_mac_native.sh'128job-name: 'macOS native'129- job-type: fuzz130file-env: './ci/test/00_setup_env_mac_native_fuzz.sh'131job-name: 'macOS native, fuzz'133env:134DANGER_RUN_CI_ON_HOST: 1135BASE_ROOT_DIR: ${{ github.workspace }}/repo_archive137steps:138- *ANNOTATION_PR_NUMBER140- &CHECKOUT141name: Checkout142uses: actions/checkout@v6143with:144# Ensure the latest merged pull request state is used, even on re-runs.145ref: &CHECKOUT_REF_TMPL ${{ github.event_name == 'pull_request' && github.ref || '' }}147- name: Clang version148run: |149# Use the latest Xcode supported by the version of macOS denoted in150# doc/release-notes-empty-template.md and providing at least the151# minimum clang version denoted in doc/dependencies.md.152# See: https://developer.apple.com/documentation/xcode-release-notes/xcode-16_2-release-notes153sudo xcode-select --switch /Applications/Xcode_16.2.app154clang --version156- name: Install Homebrew packages157env:158HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1159run: |160# A workaround for "The `brew link` step did not complete successfully" error.161brew install --quiet python@3 || brew link --overwrite python@3162brew install --quiet coreutils ninja pkgconf ccache boost zeromq qt@6 qrencode capnp164- name: Set Ccache directory165run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV"167- name: Restore Ccache cache168id: ccache-cache169uses: actions/cache/restore@v5170with:171path: ${{ env.CCACHE_DIR }}172key: ${{ github.job }}-${{ matrix.job-type }}-ccache-${{ github.run_id }}173restore-keys: ${{ github.job }}-${{ matrix.job-type }}-ccache-175- name: Create git archive176run: |177git log -1178git archive --format=tar --prefix=repo_archive/ --output=repo.tar HEAD179tar -xf repo.tar181- name: CI script182run: |183cd repo_archive184./ci/test_run_all.sh185env:186FILE_ENV: ${{ matrix.file-env }}188- name: Save Ccache cache189uses: actions/cache/save@v5190if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.ccache-cache.outputs.cache-hit != 'true'191with:192path: ${{ env.CCACHE_DIR }}193# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache194key: ${{ steps.ccache-cache.outputs.cache-primary-key }}196windows-native-dll:197name: ${{ matrix.job-name }}198runs-on: windows-2025-vs2026200if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}202env:203PYTHONUTF8: 1204TEST_RUNNER_TIMEOUT_FACTOR: 40206strategy:207fail-fast: false208matrix:209job-type: [standard, fuzz]210include:211- job-type: standard212job-name: 'Windows native, VS'213- job-type: fuzz214job-name: 'Windows native, fuzz, VS'216steps:217- *ANNOTATION_PR_NUMBER219- *CHECKOUT221- &IMPORT_VS_ENV222name: Import Visual Studio env vars223run: py -3 .github/ci-windows.py "standard" github_import_vs_env225- name: Get tool information226run: |227set -o errexit -o pipefail -o xtrace -o nounset229cmake -version | tee cmake_version230echo '---'231msbuild.exe -version | tee msbuild_version232echo "${VCToolsVersion-}" | tee toolset_version233py -3 --version234bash --version236- name: Restore vcpkg downloads cache237id: vcpkg-downloads-cache238uses: actions/cache/restore@v5239with:240path: |241~/AppData/Local/vcpkg/downloads/*242!~/AppData/Local/vcpkg/downloads/tools243key: ${{ github.job }}-vcpkg-downloads-${{ hashFiles('vcpkg.json') }}245- name: Restore vcpkg binary cache246uses: actions/cache/restore@v5247id: vcpkg-binary-cache248with:249path: ~/AppData/Local/vcpkg/archives250key: ${{ github.job }}-vcpkg-binary-release-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.