Skip to content

Commit

Permalink
ci(nix): add rust nightly docs
Browse files Browse the repository at this point in the history
  • Loading branch information
realeinherjar committed Oct 21, 2023
1 parent 45f6c2a commit 3aba210
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
32 changes: 15 additions & 17 deletions .github/workflows/nightly_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,20 @@ 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: Rust Cache
uses: Swatinem/[email protected]
- 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
- name: Build docs
run: cargo doc --no-deps
env:
RUSTDOCFLAGS: '--cfg docsrs -Dwarnings'
run: nix develop -L .#docsNightly --command bash -c "cargo doc --no-deps"
- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: built-docs
path: ./target/doc/*
Expand All @@ -34,7 +32,7 @@ jobs:
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
Expand All @@ -44,14 +42,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
2 changes: 1 addition & 1 deletion crates/bdk/src/keys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ impl<Ctx: ScriptContext> From<bip32::ExtendedPrivKey> for ExtendedKey<Ctx> {
/// }
/// ```
///
/// Types that don't internally encode the [`Network`](bitcoin::Network) in which they are valid need some extra
/// Types that don't internally encode the [`Network`] in which they are valid need some extra
/// steps to override the set of valid networks, otherwise only the network specified in the
/// [`ExtendedPrivKey`] or [`ExtendedPubKey`] will be considered valid.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/bdk/src/wallet/tx_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ impl<'a, D, Cs: CoinSelectionAlgorithm, Ctx: TxBuilderContext> TxBuilder<'a, D,

/// Choose the coin selection algorithm
///
/// Overrides the [`DefaultCoinSelectionAlgorithm`](super::coin_selection::DefaultCoinSelectionAlgorithm).
/// Overrides the [`DefaultCoinSelectionAlgorithm`].
///
/// Note that this function consumes the builder and returns it so it is usually best to put this as the first call on the builder.
pub fn coin_selection<P: CoinSelectionAlgorithm>(
Expand Down
9 changes: 9 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
rustLLVMTarget = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "llvm-tools" ];
};
# Nighly Docs
rustNightlyTarget = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default);

# Rust configs
craneLib = (crane.mkLib pkgs).overrideToolchain rustTarget;
Expand All @@ -83,6 +85,7 @@
craneWASMLib = ((crane.mkLib pkgs).overrideToolchain rustWASMTarget).overrideScope' (final: prev: { inherit (craneLib) craneUtils; });
# LLVM code coverage
craneLLVMLib = (crane.mkLib pkgs).overrideToolchain rustLLVMTarget;
craneNightlyLib = (crane.mkLib pkgs).overrideToolchain rustNightlyTarget;

# Common inputs for all derivations
buildInputs = [
Expand Down Expand Up @@ -376,6 +379,12 @@
lcov = pkgs.mkShell {
buildInputs = [ pkgs.lcov ];
};
docsNightly = craneNightlyLib.devShell {
packages = buildInputs ++ [ rustNightlyTarget ];
RUSTDOCFLAGS = "--cfg docsrs -Dwarnings";
BITCOIND_EXEC = commonArgs.BITCOIND_EXEC;
ELECTRS_EXEC = commonArgs.ELECTRS_EXEC;
};
};
}
);
Expand Down

0 comments on commit 3aba210

Please sign in to comment.