Skip to content
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

chore: make sure that the documention is available on doc.rs #21

Merged
merged 1 commit into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,21 @@ jobs:
- run:
name: Run cargo release build
command: cargo build --workspace --release
rustdoc:
executor: default
environment:
# Making sure that the documentation can be built without having the NVIDIA toolkit
# installed.
DOCS_RS: true
steps:
- *restore-workspace
- *restore-cache
- run: echo 'export PATH="$HOME:~/.cargo/bin:$PATH"' >> $BASH_ENV && source $BASH_ENV
- run:
name: Run rustdoc
command: |
cargo rustdoc --package ec-gpu --all-features -- -D warnings
cargo rustdoc --package ec-gpu-gen --all-features -- -D warnings

workflows:
version: 2.1
Expand Down Expand Up @@ -206,3 +221,6 @@ workflows:
- build:
requires:
- cargo_fetch
- rustdoc:
requires:
- cargo_fetch
9 changes: 8 additions & 1 deletion ec-gpu-gen/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ fn main() {
#[path = "src/source.rs"]
mod source;

// This is a hack for the case when the documentation is built on docs.rs. For the
// documentation we don't need a properly compiled kernel, but just some arbitrary bytes.
if env::var("DOCS_RS").is_ok() {
println!("cargo:rustc-env=CUDA_KERNEL_FATBIN=../build.rs");
return;
}

let kernel_source = source::gen_source::<Bls12, source::Limb32>();

let out_dir = env::var("OUT_DIR").expect("OUT_DIR was not set.");
Expand Down Expand Up @@ -69,7 +76,7 @@ fn main() {
.arg(&fatbin_path)
.arg(&source_path)
.status()
.expect("Cannot run nvcc.");
.expect("Cannot run nvcc. Install the NVIDIA toolkit or disable the `cuda` feature.");

if !status.success() {
panic!(
Expand Down