-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: move to Nix (simpler, easy to maintain version)
- Loading branch information
Showing
23 changed files
with
847 additions
and
172 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,27 +6,18 @@ jobs: | |
Codecov: | ||
name: Code Coverage | ||
runs-on: ubuntu-latest | ||
env: | ||
RUSTFLAGS: "-Cinstrument-coverage" | ||
RUSTDOCFLAGS: "-Cinstrument-coverage" | ||
LLVM_PROFILE_FILE: "./target/coverage/%p-%m.profraw" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install lcov tools | ||
run: sudo apt-get install lcov -y | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
profile: minimal | ||
components: llvm-tools-preview | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@v5 | ||
- name: Nix Cache | ||
uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
- name: Rust Cache | ||
uses: Swatinem/[email protected] | ||
uses: Swatinem/rust-cache@v2 | ||
# Code Coverage | ||
- name: Install grcov | ||
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi | ||
run: nix develop -L ".#coverage" --command cargo install grcov | ||
# TODO: re-enable the hwi tests | ||
- name: Build simulator image | ||
run: docker build -t hwi/ledger_emulator ./ci -f ci/Dockerfile.ledger | ||
|
@@ -35,23 +26,23 @@ jobs: | |
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
python-version: "3.9" | ||
- name: Install python dependencies | ||
run: pip install hwi==2.1.1 protobuf==3.20.1 | ||
- name: Test | ||
run: cargo test --all-features | ||
run: nix develop ".#coverage" -L --command cargo test --all-features | ||
- name: Make coverage directory | ||
run: mkdir coverage | ||
- name: Run grcov | ||
run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --keep-only '**/crates/**' --ignore '**/tests/**' --ignore '**/examples/**' -o ./coverage/lcov.info | ||
run: nix develop ".#coverage" -L --command grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --keep-only '**/crates/**' --ignore '**/tests/**' --ignore '**/examples/**' -o ./coverage/lcov.info | ||
- name: Generate HTML coverage report | ||
run: genhtml -o coverage-report.html --ignore-errors source ./coverage/lcov.info | ||
run: nix develop ".#coverage" -L --command genhtml -o coverage-report.html --ignore-errors source ./coverage/lcov.info | ||
- name: Coveralls upload | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-report | ||
path: coverage-report.html |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,127 +3,102 @@ 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 | ||
|
||
pre-commit-checks: | ||
name: "Pre-commit checks: cargo fmt/clippy, typos, pgp-signed and conventional commits" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@v5 | ||
- name: Nix Cache | ||
uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
- name: Rust Cache | ||
uses: Swatinem/rust-cache@v2 | ||
- name: Pre-commit checks | ||
run: nix develop -L . --command pre-commit run --all-files | ||
|
||
build-test: | ||
name: Build and test | ||
name: Build, test, check Rust | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: | ||
- version: stable | ||
clippy: true | ||
- version: 1.63.0 # MSRV | ||
- "" # empty means default | ||
- msrv | ||
features: | ||
- --no-default-features | ||
- --all-features | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust.version }} | ||
override: true | ||
profile: minimal | ||
uses: actions/checkout@v4 | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@v5 | ||
- name: Nix Cache | ||
uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
- name: Rust Cache | ||
uses: Swatinem/[email protected] | ||
- name: Pin dependencies for MSRV | ||
if: matrix.rust.version == '1.63.0' | ||
run: | | ||
cargo update -p zstd-sys --precise "2.0.8+zstd.1.5.5" | ||
cargo update -p time --precise "0.3.20" | ||
cargo update -p jobserver --precise "0.1.26" | ||
cargo update -p home --precise "0.5.5" | ||
- name: Build | ||
run: cargo build ${{ matrix.features }} | ||
- name: Test | ||
run: cargo test ${{ matrix.features }} | ||
uses: Swatinem/rust-cache@v2 | ||
- name: build | ||
run: nix develop -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.features }} | ||
- name: test | ||
run: nix develop -L ".#${{ matrix.rust }}" --command cargo test ${{ matrix.features }} | ||
|
||
check-no-std: | ||
name: Check no_std | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: | ||
- "" # empty means default | ||
- msrv | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
profile: minimal | ||
# target: "thumbv6m-none-eabi" | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@v5 | ||
- name: Nix Cache | ||
uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
- name: Rust Cache | ||
uses: Swatinem/[email protected] | ||
uses: Swatinem/rust-cache@v2 | ||
# TODO "--target thumbv6m-none-eabi" should work but currently does not | ||
- name: Check bdk_chain | ||
working-directory: ./crates/chain | ||
# TODO "--target thumbv6m-none-eabi" should work but currently does not | ||
run: cargo check --no-default-features --features bitcoin/no-std,miniscript/no-std,hashbrown | ||
run: nix develop -L ".#${{ matrix.rust }}" --command cargo check -p bdk_chain --no-default-features --features bitcoin/no-std,miniscript/no-std,hashbrown | ||
- name: Check bdk | ||
working-directory: ./crates/bdk | ||
# TODO "--target thumbv6m-none-eabi" should work but currently does not | ||
run: cargo check --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown | ||
run: nix develop -L ".#${{ matrix.rust }}" --command cargo check -p bdk --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown | ||
- name: Check esplora | ||
working-directory: ./crates/esplora | ||
# TODO "--target thumbv6m-none-eabi" should work but currently does not | ||
run: cargo check --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown | ||
run: nix develop -L ".#${{ matrix.rust }}" --command cargo check -p bdk_esplora --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown | ||
|
||
check-wasm: | ||
name: Check WASM | ||
runs-on: ubuntu-20.04 | ||
env: | ||
CC: clang-10 | ||
CFLAGS: -I/usr/include | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: | ||
- "" # empty means default | ||
- msrv | ||
target: | ||
- wasm32-unknown-unknown | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
# Install a recent version of clang that supports wasm32 | ||
- run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - || exit 1 | ||
- run: sudo apt-get update || exit 1 | ||
- run: sudo apt-get install -y libclang-common-10-dev clang-10 libc6-dev-i386 || exit 1 | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
profile: minimal | ||
target: "wasm32-unknown-unknown" | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@v5 | ||
- name: Nix Cache | ||
uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
- name: Rust Cache | ||
uses: Swatinem/[email protected] | ||
uses: Swatinem/rust-cache@v2 | ||
# TODO "--target thumbv6m-none-eabi" should work but currently does not | ||
- name: Check bdk | ||
working-directory: ./crates/bdk | ||
run: cargo check --target wasm32-unknown-unknown --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown,dev-getrandom-wasm | ||
run: nix develop -L ".#${{ matrix.rust }}" --command cargo check -p bdk --target ${{ matrix.target }} --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown,dev-getrandom-wasm | ||
- name: Check esplora | ||
working-directory: ./crates/esplora | ||
run: cargo check --target wasm32-unknown-unknown --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown,async | ||
|
||
fmt: | ||
name: Rust fmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
profile: minimal | ||
components: rustfmt | ||
- name: Check fmt | ||
run: cargo fmt --all -- --config format_code_in_doc_comments=true --check | ||
|
||
clippy_check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
components: clippy | ||
override: true | ||
- name: Rust Cache | ||
uses: Swatinem/[email protected] | ||
- uses: actions-rs/clippy-check@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: --all-features --all-targets -- -D warnings | ||
run: nix develop -L ".#${{ matrix.rust }}" --command cargo check -p bdk_esplora --target ${{ matrix.target }} --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown,async |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,34 +7,30 @@ jobs: | |
name: Build docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
- name: Set default toolchain | ||
run: rustup default nightly-2022-12-14 | ||
- name: Set profile | ||
run: rustup set profile minimal | ||
- name: Update toolchain | ||
run: rustup update | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@v5 | ||
- name: Nix Cache | ||
uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
- name: Rust Cache | ||
uses: Swatinem/rust-cache@v2.2.1 | ||
uses: Swatinem/rust-cache@v2 | ||
- name: Build docs | ||
run: cargo doc --no-deps | ||
env: | ||
RUSTDOCFLAGS: '--cfg docsrs -Dwarnings' | ||
run: nix develop -L '.#nightly' --command cargo doc --no-deps | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: built-docs | ||
path: ./target/doc/* | ||
|
||
publish_docs: | ||
name: 'Publish docs' | ||
name: "Publish docs" | ||
if: github.ref == 'refs/heads/master' | ||
needs: [build_docs] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout `bitcoindevkit.org` | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
with: | ||
ssh-key: ${{ secrets.DOCS_PUSH_SSH_KEY }} | ||
repository: bitcoindevkit/bitcoindevkit.org | ||
|
@@ -44,14 +40,14 @@ jobs: | |
- name: Remove old latest | ||
run: rm -rf ./docs/.vuepress/public/docs-rs/bdk/nightly/latest | ||
- name: Download built docs | ||
uses: actions/download-artifact@v1 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: built-docs | ||
path: ./docs/.vuepress/public/docs-rs/bdk/nightly/latest | ||
- name: Configure git | ||
run: git config user.email "[email protected]" && git config user.name "github-actions" | ||
- name: Commit | ||
continue-on-error: true # If there's nothing to commit this step fails, but it's fine | ||
continue-on-error: true # If there's nothing to commit this step fails, but it's fine | ||
run: git add ./docs/.vuepress/public/docs-rs && git commit -m "Publish autogenerated nightly docs" | ||
- name: Push | ||
run: git push origin master |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Update Flake Lock File | ||
on: | ||
workflow_dispatch: # allows manual triggering | ||
schedule: | ||
- cron: "0 0 1 * *" # runs monthly on day 1 at 00:00 | ||
|
||
jobs: | ||
lockfile: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@v5 | ||
- name: Update flake.lock | ||
uses: DeterminateSystems/update-flake-lock@v20 | ||
with: | ||
pr-title: "ci: update flake.lock" # Title of PR to be created | ||
pr-labels: | # Labels to be set on the PR | ||
dependencies | ||
automated |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
# Added by Cargo | ||
/target | ||
Cargo.lock | ||
/.vscode | ||
|
||
# Dev environment | ||
/.vscode | ||
*.swp | ||
.idea | ||
|
||
# Example persisted files. | ||
*.db | ||
|
||
# Nix | ||
/result | ||
# pre-commit-hooks.nix | ||
.pre-commit-config.yaml |
Oops, something went wrong.