-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: move to Nix #1165
ci: move to Nix #1165
Conversation
cf53d8e
to
a3c34ae
Compare
The only potential issue I see with the *_EXEC env vars for |
Copy-pasting the discussion from discord (https://discord.com/channels/753336465005608961/753367451319926827/1161651733173391433): @evanlinjin: @danielabrozzoni :
Are there any other benefits I'm not seeing? @realeinherjar: With Nix would be an easy nix build test.WASM, nix build test nix build clippy @danielabrozzoni : @realeinherjar: @danielabrozzoni
rustup works fine? You can do cargo +1.57.0 for a specific rust version.
There should be no problem installing wasm-pack locally right? I think supporting unix-only is fine. @notmandatory @realeinherjar: @realeinherjar:
That's easy in CI, not necessarily so easy when CI fails and you need to debug on your pc |
f2d5e02
to
5e78044
Compare
74a5ecd
to
1b69859
Compare
12ab93d
to
55e6b2b
Compare
This comment was marked as resolved.
This comment was marked as resolved.
c535ecc
to
f19efec
Compare
4438ca0
to
27d04b5
Compare
a5dc968
to
2cad5de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just took a quick look, I need to do a more in-depth review, will get to that later.
I would open a different PR for the doc improvements, typos, and formatting. These changes can be reviewed and merged quickly, while the nix ci will take (I suppose) a bit longer, so there's no reason to keep them in the same PR.
Once the typos/docs fixes are in another PR, I would squash the commits of this PR. The purpose of having multiple commits is to simplify review; instead, if your PR is composed of too many commits that keep modifying each other, review is actually more difficult. If you want to read more: https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#committing-patches
040a8e3
to
d0fbb72
Compare
27a63ab chore: typos fixed (Einherjar) Pull request description: ### Description Fixes the typos and remove unused speculos dockerfiles that was done in #1165. Moving these changes into this PR to be merged first. Then, we can rebase #1165 and make it only related to CI and Nix. (Maybe do a big squash 😄) ## Note to Reviewers About the speculos stuff, we are not using them, removed in #793, more specifically in 3f5a78a. ### Changelog notice - Fix typos in codebase and docs - Remove unused CI tests with hardware signer Dockerfiles ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing #### New Features: * [ ] I've added tests for the new feature * [ ] I've added docs for the new feature #### Bugfixes: * [ ] This pull request breaks the existing API * [ ] I've added tests to reproduce the issue which are now passing * [ ] I'm linking the issue being fixed by this PR ACKs for top commit: danielabrozzoni: ACK 27a63ab Tree-SHA512: a01101d0741e2b0e1d1254b5cae670c5a936bb0b89332c102feb57d58d2b9ae995ed4436068b0dc5fae73dbe22431c3143d6e04cdc12eab991bd726cfd2fbe25
41fab99
to
bb486c4
Compare
More typos fix before bitcoindevkit#1165
bb486c4
to
8fd89b7
Compare
ci: update Flake.lock automatically ci: test electrsd with optional download ci: bitcoind no download option for Nix build ci: esplora pkg same setup as fedimint fix(readme): add explainer about external deps ci: add cachix cache ci(nix): add rust audit capabilities ci: WASM checks ci(nix): add code coverage ci(nix): add rust nightly docs ci(nix): pre-commit-checks with typos fixed chore: add Nix instructions ci: move to DeterminateSystems/magic-nix-cache-action ci(nix): pin crane ci: remove `--keep-failed` in CI ci(nix): refactor checks ci: use cargo ci profile for build deps refactor(nix): libsDarwin inline check ci: update flake.lock
8fd89b7
to
a78f1ef
Compare
We can close this in favor of #1257. |
Description
This would make all the tests possible to run locally.
It enhances developer experience and facilitates onboarding of new contributors.
Additions:
rustsec/advisory-db
.cargo {check,build,test}
in the whole workspace.Superseds
.github/workflows/audit.yml
.NIX.md
Closes #1162.
Superseds #1122 and #1156.
Pinneds Dependencies:
bitcoind
: pinned to0.25.0
electrs
: pinned toBlockstream's esplora
using the Fedimint deployment, check jkitman/nixpkgs@61ccef8 and https://github.com/fedimint/fedimint/blob/master/flake.nix#L5TODO:
llvm
deps.openssl
errors.WASM
.MSRV
.Add a custom
CargoMSRV.lock
? (Or maybe aCargoMSRV.toml
with the pinned MSRV dependencies and thencargo generate-lockfile
with Rust MSRV?)Depends on solving fix: build
crane-utils
using a different toolchain ipetkov/crane#422cont_integration.yml
toflake.nix
(all thecargo update -p
)From the Fedimint suggestion we'll use
crane
.This would allow caching of a lot of things
Then the user would call
nix buid -L .#MSRV --keep-failed
and so on.This would also eliminate all the multiple
runs-on
incont_integration.yml
to a single one where each step would be aname
andrun
thenix build
command.DeterminateSystems/magic-nix-cache-action
to cache stuff in CI.CONTRIBUTING
with instructions. Use fedimint instructions for inspiration.nix develop
:default
: Rust latestMSRV
WASM
nix flake check
:rustfmt
test
--all-features
--no-default-features
test
--all-features
--no-default-features
--target wasm32-unknown-unknown
)test
-p bdk --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown,dev-getrandom-wasm
-p esplora --target wasm32-unknown-unknown --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown,async
cachix/pre-commit-hooks.nix
commitizen
rustfmt
Add a CI to update(is this possible?)Cargo.lock
flake.lock
.github/workflows/audit.yml
numtide/devshell
Nix Commands
nix flake show
: show all possible commands from the flake.nix develop
: creates adevShell
with all the things you need to develop installed.Also handles ENV vars.
Currently is
bash
,git
,ripgrep
,bitcoind
(pinned),electrs
(pinned),openssl
,pkg-config
,libiconv
, and latest stable Rust with all goodies.It also handles specific MacOS deps: Apple XCode SDKs (for
bitcoind
andelectrsd
crates).Open to suggestions on what to include.
nix develop .#MSRV
: same but with Rust MSRV.nix flake check
:rustfmt
,nixpkgs-fmt
(.nix
files).clippy
in all workspace (pinned to 1.67.0) with--all-features --all-targets -- -D warnings
.cargo check
in all workspace (latest stable Rust).rustsec/advisory-db
..#checks.${system}.{CHECK}
nix build -L .
: runscargo build
in all workspace with latest stable Rust.nix build -L .#stable
: runscargo build
in all workspace with latest stable Rust.nix build -L .#MSRV
: runscargo build
in all workspace with MSRV stable Rust.PLACEHOLDER
: ...nix build -L .#checks.${system}.{CHECK}
: runs a specificCHECK
. In my casesystem = aarch64-darwin
then it isnix build .#checks.aarch64-darwin.CHECK
.pre-commit-check
: checks for typos, conventional commits,nixpkgs-fmt
(.nix
files).clippy
: runsclippy
in all workspace (pinned to 1.68.0) with--all-features --all-targets -- -D warnings
.fmt
: runscargo fmt
with--all -- --check --config format_code_in_doc_comments=true
in all workspace with latest Rust.audit
: checks dependencies for security advisory usingrustsec/advisory-db
.latest
:cargo build
in whole workspace using latest Rust.latestAll
:cargo test --all-features
in whole workspace using latest Rust.latestNoDefault
:cargo test --no-default-features
in whole workspace using latest Rust.latestNoStdBdk
:cargo test -p bdk --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown
using latest Rust.latestNoStdChain
:cargo test -p bdk_chain --no-default-features --features bitcoin/no-std,miniscript/no-std,hashbrown
using latest Rust.latestNoStdEsplora
:cargo test -p bdk_esplora --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown
using latest Rust.MSRV
:cargo build
in whole workspace using MSRV Rust.MRSVAll
:cargo test --all-features
in whole workspace using MSRV Rust.MSRVNoDefault
:cargo test --no-default-features
in whole workspace using MSRV Rust.MSRVNoStdBdk
:cargo test -p bdk --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown
using MSRV Rust.MRSVNoStdChain
:cargo test -p bdk_chain --no-default-features --features bitcoin/no-std,miniscript/no-std,hashbrown
using MSRV Rust.MSRVNoStdEsplora
:cargo test -p bdk_esplora --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown
using MSRV Rust.Notes to the reviewers
We are adding automatic pre-commit checks with checks for typos, gpg-signed commits, conventional commits,
nixpkgs-fmt
(.nix
files).This is done automatically if the user has Nix and
devshell
installed.If not, it will be checked on CI, or with a
nix flake check
.I fixed a bunch of typos and added the
.typos.toml
to whitelist somethings like hashes, addresses, etc that were being flagged as false positives.I am adding in the building cache/tests a crate name and version.
This does not interact with the name or versioning in any of bdk's crates
Cargo.toml
To avoid this nasty warning in Nix:
We are using
legacyPackages
instead ofpackages
in theci
build calls becauselegacyPackages
allows nested sets, e.g.:It makes a nice grouping of all CI stuff under the same call:
nix build -L .#ci.latest.{CHECK}
Removed the
ci/
dir with the Dockerfiles for hardware signer testing.We are not using them, removed in bdk v1.0.0-alpha.0 #793,
more specifically in 3f5a78a.
Related Move hardware signer into its own crate #872.
NOTE:
speculos
can be run under NixWe are moving from
mozilla/grcov
totaiki-e/cargo-llvm-cov
.Why? 3 reasons:
grcov
is a big thing, it does coverage for a lot of things C/C++, JS, Java, and Rust.cargo-llvm-cov
uses Rust's native coverage tools via LLVM.crane
(craneLib.cargoLlvmCov
) supports nativelycargo-llvm-cov
which will be much easier to make it work and maintainfedimint
also usecargo-llvm-cov
withcrane
so it makes easier to collaborate in improvements and issues.Potential issues:
We had to remove
Cargo.lock
from the.gitignore
. Nix (crane) needs it for deterministic stuff.From the
crane
FAQ:Also Rust changed their
Cargo.lock
commit policy a couple months ago:Mismatch versions between the executables under the
*_EXEC
env vars forbitcoind
/electrsd
crates and the version the crate thinks to have.Centralizes CI maintainability to people that have Nix experience.
We are removing the auto-download feature of
bitcoind
andelectrsd
in thebitcoind_rpc
andesplora
crates. I added an explanation in the repo and crates'README.md
s. This also simplifies a little bit the MSRV pinning of deps.Changelog notice
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features:
Bugfixes: