Skip to content

Conversation

@febo
Copy link
Contributor

@febo febo commented Oct 30, 2025

Problem

As described on #411 , docs.rs build failed after publishing the crate since it uses a nightly toolchain where doc_auto_cfg feature has been removed.

Solution

This PR adds a job to the publish workflow to build the documentation using docs.rs image and a nightly toolchain.

A successful run of the job can be seen here: https://github.com/febo/solana-sdk/actions/runs/18941243715/job/54080342807

@febo febo requested a review from joncinque October 30, 2025 13:55
Copy link
Collaborator

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I couldn't find any more documentation about the exact command they use, but this looks close enough. I tried running the cargo command on its own on a crate with the docs_auto_cfg feature, and it failed as expected, so that should do what we need.

We could potentially eliminate the whole docker setup if you want to simplify a bit more and just call cargo +nightly ... directly, that worked equally well for me.

We'll need to update the proc-macro2 dependency in our lockfile, because the docs build fails locally for me.

Comment on lines 123 to 127
-e CARGO_HOME=/cargo \
-e RUSTUP_HOME=/rustup \
-e PATH=/cargo/bin:$PATH \
-e DOCS_RS=1 \
-e RUSTDOCFLAGS="--cfg docsrs" \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if you ran this command successfully on your machine, but on mine, I need to quote all of the env declarations

Suggested change
-e CARGO_HOME=/cargo \
-e RUSTUP_HOME=/rustup \
-e PATH=/cargo/bin:$PATH \
-e DOCS_RS=1 \
-e RUSTDOCFLAGS="--cfg docsrs" \
-e "CARGO_HOME=/cargo" \
-e "RUSTUP_HOME=/rustup" \
-e "PATH=/cargo/bin:$PATH" \
-e "DOCS_RS=1" \
-e "RUSTDOCFLAGS=\"--cfg docsrs\"" \

@febo
Copy link
Contributor Author

febo commented Oct 31, 2025

We could potentially eliminate the whole docker setup if you want to simplify a bit more and just call cargo +nightly ... directly, that worked equally well for me.

Agree , I think it is sufficient to run cargo +nightly doc. Here is an example run: https://github.com/febo/solana-sdk/actions/runs/18959537456/job/54143821569

We'll need to update the proc-macro2 dependency in our lockfile, because the docs build fails locally for me.

Hmmm, I ran cargo +nightly doc --no-deps --all-features locally from the root and it succeeds.

Copy link
Collaborator

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I ran cargo +nightly doc --no-deps --all-features locally from the root and it succeeds.

Alright, let's roll the dice and see what happens!

@febo febo merged commit c1e6ff9 into anza-xyz:master Oct 31, 2025
26 checks passed
@febo febo deleted the docs-build-on-publish branch October 31, 2025 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants