Build using bix from nixpkgs
#447
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build using `bix` from nixpkgs | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| jobs: | |
| check: | |
| name: nixpkgs (${{ matrix.system }}, ${{ matrix.toolchain }}) | |
| runs-on: ${{ matrix.runner_label }} | |
| outputs: | |
| bitcoin-commit: ${{ steps.bitcoin-commit.outputs.commit }} | |
| permissions: | |
| id-token: write | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - system: x86_64-linux | |
| runner_label: ubuntu-latest | |
| toolchain: clang | |
| devshell: ./bix | |
| cmake_preset: default | |
| - system: aarch64-linux | |
| runner_label: ubuntu-24.04-arm | |
| toolchain: clang | |
| devshell: ./bix | |
| cmake_preset: default | |
| - system: aarch64-linux | |
| runner_label: ubuntu-24.04-arm | |
| toolchain: clang-strict-align-ubsan | |
| devshell: .#clang-sanitizer | |
| build_name_suffix: strict-align-ubsan | |
| cmake_preset: strict-align-ubsan | |
| - system: aarch64-linux | |
| runner_label: ubuntu-24.04-arm | |
| toolchain: gcc | |
| devshell: .#gcc | |
| cmake_preset: default | |
| - system: aarch64-darwin | |
| runner_label: macos-latest | |
| toolchain: clang | |
| devshell: ./bix | |
| cmake_preset: darwin | |
| env: | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| CDASH_BUILD_NAME_PREFIX: nixpkgs | |
| CTEST_CMAKE_GENERATOR: Ninja | |
| steps: | |
| - name: Checkout Nightly Repo | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| - name: Checkout Bix Repo | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: bitcoin-dev-tools/bix | |
| path: bix | |
| fetch-depth: 1 | |
| - name: Checkout Bitcoin Repo | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: bitcoin/bitcoin | |
| path: bitcoin | |
| fetch-depth: 1 | |
| - name: Get Bitcoin commit hash | |
| id: bitcoin-commit | |
| run: | | |
| BITCOIN_COMMIT=$(cd bitcoin && git rev-parse HEAD) | |
| echo "commit=$BITCOIN_COMMIT" >> $GITHUB_OUTPUT | |
| - name: Cache ccache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ env.CCACHE_DIR }} | |
| key: ccache-${{ matrix.system }}-${{ github.run_id }} | |
| restore-keys: | | |
| ccache-${{ matrix.system }}- | |
| - name: Install Nix | |
| uses: DeterminateSystems/nix-installer-action@main | |
| with: | |
| determinate: true | |
| extra-conf: | | |
| lazy-trees = true | |
| fallback = true | |
| extra-platforms = x86_64-darwin | |
| - name: Set Up Cachix | |
| uses: cachix/cachix-action@v15 | |
| with: | |
| name: nix-dev-shell | |
| authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
| - name: Run `nix flake update` | |
| if: matrix.devshell == './bix' | |
| working-directory: bix | |
| run: nix flake update | |
| - name: Run `nix flake check` | |
| if: matrix.devshell == './bix' | |
| working-directory: bix | |
| run: nix flake check | |
| - name: Build and test | |
| env: | |
| CDASH_BUILD_NAME_SUFFIX: ${{ matrix.build_name_suffix }} | |
| CTEST_CONFIGURE_PRESET: ${{ matrix.cmake_preset }} | |
| run: | | |
| nix develop ${{ matrix.devshell }} --system ${{ matrix.system }} --no-write-lock-file --command bash -c " | |
| set -eux | |
| export CCACHE_DIR=${{ env.CCACHE_DIR }} | |
| ctest --verbose -S ./scripts/build-unit-test.cmake -DCTEST_SOURCE_DIRECTORY=./bitcoin -DCTEST_SITE=${{ github.repository }} | |
| " | |
| vulture: | |
| name: Python dead code (vulture) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Bitcoin Repo | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: bitcoin/bitcoin | |
| fetch-depth: 1 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: false | |
| - name: Run vulture | |
| run: uvx vulture --min-confidence=100 $(git ls-files -- '*.py') | |
| notify-failure: | |
| if: failure() || cancelled() | |
| needs: [check, vulture] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| steps: | |
| - name: Create failure issue | |
| run: | | |
| BITCOIN_COMMIT="${{ needs.check.outputs.bitcoin-commit }}" | |
| BITCOIN_COMMIT_SHORT="${BITCOIN_COMMIT:0:7}" | |
| gh issue create \ | |
| --label "ci-failure" \ | |
| --title "Nightly CI Failure - $(date +%Y-%m-%d)" \ | |
| --body "**Nightly CI Build Failed** | |
| **Workflow Run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| **This Repo Commit:** ${{ github.sha }} | |
| **Branch:** ${{ github.ref_name }} | |
| **Triggered by:** ${{ github.event_name }} | |
| **Bitcoin Commit:** [\`${BITCOIN_COMMIT_SHORT}\`](https://github.com/bitcoin/bitcoin/commit/${BITCOIN_COMMIT}) | |
| cc: @willcl-ark" \ | |
| --repo ${{ github.repository }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} |