Skip to content

ci: move to Nix

ci: move to Nix #4147

on: [push, pull_request]
name: CI
jobs:
self-care:
name: Flake self-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Nix flake inputs
uses: DeterminateSystems/flake-checker-action@v5
with:
fail-mode: true
continuous-integration:
name: Build, test, check everything
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v5
# Cache Nix artifacts
- uses: cachix/cachix-action@v12
with:
name: bitcoindevkit
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
continue-on-error: true # for forks outside of bitcoindevkit GH org
# Commit checks
- name: Pre-commit checks
run: nix build -L .#ci.pre-commit-check --keep-failed
# Cache Builds
- name: Build and Cache latest Rust
run: nix build -L . --keep-failed
- name: Build and Cache MRSV
run: nix build -L .#MSRV --keep-failed
- name: Build and Cache WASM
run: nix build -L .#WASM --keep-failed
# Rustfmt
- name: Rustfmt
run: nix build -L .#ci.fmt --keep-failed
# Clippy
- name: Clippy
run: nix build -L .#ci.clippy --keep-failed
# Audit
- name: Audit
run: nix build -L .#ci.audit --keep-failed
# Tests: latest
- name: Test workspace all-features latest
run: nix build -L .#ci.latest.all --keep-failed
- name: Test workspace no-default-features latest
run: nix build -L .#ci.latest.noDefault --keep-failed
- name: Test bdk no-std latest
run: nix build -L .#ci.latest.noStdBdk --keep-failed
- name: Test bdk_chain no-std latest
run: nix build -L .#ci.latest.noStdChain --keep-failed
- name: Test bdk_esplora no-std latest
run: nix build -L .#ci.latest.noStdEsplora --keep-failed
# Tests: MSRV
- name: Test workspace all-features MSRV
run: nix build -L .#ci.MSRV.all --keep-failed
- name: Test workspace no-default-features MSRV
run: nix build -L .#ci.MSRV.noDefault --keep-failed
- name: Test bdk no-std MSRV
run: nix build -L .#ci.MSRV.noStdBdk --keep-failed
- name: Test bdk_chain no-std MSRV
run: nix build -L .#ci.MSRV.noStdChain --keep-failed
- name: Test bdk_esplora no-std MSRV
run: nix build -L .#ci.MSRV.noStdEsplora --keep-failed
# Checks: WASM
- name: Check bdk WASM
run: nix build -L .#ci.WASM.bdk --keep-failed
- name: Check bdk_esplora WASM
run: nix build -L .#ci.WASM.esplora --keep-failed
# Code Coverage
- name: Code Coverage
run: nix build -L .#ci.codeCoverage
- name: Ensure lcov.info exists
# it is result because of the $out in Nix
run: |
test -f result
mv result lcov.info
- name: Coveralls upload
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
files: lcov.info
- name: Generate HTML coverage report
run: nix develop -L .#lcov --command bash -c "genhtml -o coverage-report.html --ignore-errors source lcov.info"
- name: Upload HTML coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage-report.html