-
Notifications
You must be signed in to change notification settings - Fork 148
ci: Add docs.rs build to publish #413
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
Conversation
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.
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.
.github/workflows/publish-rust.yml
Outdated
| -e CARGO_HOME=/cargo \ | ||
| -e RUSTUP_HOME=/rustup \ | ||
| -e PATH=/cargo/bin:$PATH \ | ||
| -e DOCS_RS=1 \ | ||
| -e RUSTDOCFLAGS="--cfg docsrs" \ |
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'm not sure if you ran this command successfully on your machine, but on mine, I need to quote all of the env declarations
| -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\"" \ |
Agree , I think it is sufficient to run
Hmmm, I ran |
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.
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!
Problem
As described on #411 , docs.rs build failed after publishing the crate since it uses a nightly toolchain where
doc_auto_cfgfeature 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