-
Notifications
You must be signed in to change notification settings - Fork 322
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 #1257
ci: move to Nix #1257
Conversation
c795b55
to
ec5ba09
Compare
These typos are blocking the Nix typo CI in bitcoindevkit#1257
ec5ba09
to
7ab583b
Compare
028caa9 fix(typos): existant -> existent (Jose Storopoli) Pull request description: ### Description These typos are blocking the Nix typo CI in #1257 ### Notes to the reviewers Blocking #1257 ### Changelog notice - fix: typos in documentation - ### 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: notmandatory: ACK 028caa9 Tree-SHA512: 0bd91efd0eec55fdc537824435552c968858a5b827179b3f9f3f37785db3fa92d3e6f0c73023de0c506224c81217c402d5afa8a2f768fecaf6a3c8378226d184
77e177c
to
2a488e4
Compare
37f31d7
to
69df634
Compare
How does one update the CargoMSRV.lock file? After the version of bip39 in the root Cargo.toml file changed to 2.0, I encounter an error when running It appears to involve the 1.2.0 version that's in CargoMSRV.lock. I tried changing the version to 2.0.0 in the root Cargo.toml I ran the command I tried removing this lock file, and that didn't work either. I'm relatively new to nix. Perhaps instructions on handling such version updates in Cargo.toml that involve CargoMSRV.lock would be helpful in the NIX.md file. Here is the code I started with, rebased to include recent commits to master |
It is not that trivial.
I am planning to fix this and rebase today. |
Thanks, @storopoli ! |
69df634
to
2105f99
Compare
Last night I ran It ran successfully, except for one set of errors in the middle. I am attaching those errors, from somewhere in the middle of the console output, and a warning at the end of the console output showing which systems were not tested.
The errors were all of the form
Here are the details of my x86-64 system - Operating System - NixOS 24.05 (Uakari) It's amazing what ground that flake covers! |
these are http errors in the cargo-audit check. I am running these fine in my local machine and also in GitHub CI. |
These errors might be normal/to be ignored. The BTW. In Fedimint we run the audit by updating the input to the latest version and then doing the update, to always get the audit against current advisories. https://github.com/fedimint/fedimint/blob/59a88ce18c1721acec0db89c6bb97d9ea18af0d9/.github/workflows/ci-nix.yml#L169 |
2105f99
to
4853dde
Compare
Thanks for the tip I added this as well to our CI yml file |
4853dde
to
1921e8b
Compare
e5868a1
to
9800282
Compare
More caught on by Nix CI in bitcoindevkit#1257.
9800282
to
dccc4ff
Compare
8d93fad chore: typos (Jose Storopoli) Pull request description: More caught on by Nix CI in #1257. ### 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: evanlinjin: ACK 8d93fad notmandatory: ACK 8d93fad Tree-SHA512: 28e0316d457658266b2af1de76b114f87ce7485e386ddecd805dda1266a4e8645612c0fa6bc921c58daa4886558b32b538cccbb1644c96c3bab638dd7c42ee2b
dccc4ff
to
d09f075
Compare
ci: update Flake.lock automatically ci: test electrsd with optional download ci: bitcoind no download option for Nix build ci: esplora pkg 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(nix): pin crane ci: remove `--keep-failed` in CI ci(nix): refactor checks ci: use cargo ci profile for build deps feat(flake): update pkgs to 23.11 and pin bitcoind to 0.25
d09f075
to
6307ea1
Compare
Description
This would make all the tests possible to run locally. It enhances developer experience and facilitates onboarding of new contributors.
(Updated MSRV to 1.63)
Additions:
rustsec/advisory-db
.cargo {check,build,test}
in the whole workspace.Superseds
.github/workflows/audit.yml
.NIX.md
Closes #1162. Superseds #1122, #1156, #1165.
Pinneds Dependencies:
bitcoind
: pinned to 0.25.0 in nixpkgs.electrs
: pinned toBlockstream's esplora
using the Fedimint deployment, check jkitman/nixpkgs@61ccef8 and https://github.com/fedimint/fedimint/blob/master/flake.nix#L5TODO:
Fix
llvm
deps.Fix
openssl
errors.Fix dependencies on MacOS.
Fix
WASM
.Fix
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#422move all the logic from
cont_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.Add
DeterminateSystems/magic-nix-cache-action
to cache stuff in CI.Update
CONTRIBUTING
with instructions. Use fedimint instructions for inspiration.nix develop
:default
: Rust latestMSRV
WASM
nix flake check
:clippy
audit
rustfmt
Rust latest
test
--all-features
--no-default-features
MSRV
test
--all-features
--no-default-features
WASM (
--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
Add a CI to update
flake.lock
Delete
.github/workflows/audit.yml
Port Code Coverage to Nix
Nixify the Nightly Docs CI
Add
numtide/devshell
Clean up commit messages (this is a mess of squash fixup and ammends 😂)
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 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 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 bumping hashbrown to
0.11.2
since it is compatible with MSRV of 1.63I 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}
We 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: