Skip to content

Commit

Permalink
Merge pull request #128 from DuskSystems/127-add-docs-preview-via-git…
Browse files Browse the repository at this point in the history
…hub-pages

Deploy rustdocs to GitHub Pages on main
  • Loading branch information
CathalMullan committed Aug 27, 2024
2 parents f2929a0 + 1c6aa6c commit 99745b6
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
- "**/*.rs"

permissions:
id-token: write
contents: read
id-token: write

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
- "**/*.rs"

permissions:
id-token: write
contents: read
id-token: write

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
- "**/*.rs"

permissions:
id-token: write
contents: read
id-token: write

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: docs

on:
push:
branches: [main]
paths:
- "**/*.rs"

permissions:
contents: read
id-token: write
pages: write

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

env:
SCCACHE_GHA_ENABLED: "true"
SCCACHE_GHA_VERSION: "1"

jobs:
docs:
runs-on: ubuntu-22.04
defaults:
run:
shell: nix develop .#docs --command bash {0}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v13

- name: Setup Nix cache
uses: DeterminateSystems/magic-nix-cache-action@v7

- name: Configure SCCache
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL);
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN);
- name: Initialize Nix shell
run: nix develop .#docs

- name: Build docs
run: cargo doc --no-deps

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: target/doc/wayfind
retention-days: 30

- name: Show SCCache stats
if: always() && !cancelled()
run: sccache --show-stats

deploy:
needs: docs
runs-on: ubuntu-22.04
environment:
name: github-pages
url: "${{ steps.deployment.outputs.page_url }}"
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .github/workflows/msrv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
- "**/*.rs"

permissions:
id-token: write
contents: read
id-token: write

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
Expand Down
46 changes: 30 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -73,39 +73,39 @@
];
};

# nix develop .#ci
ci = pkgs.mkShell {
name = "wayfind-ci-shell";
# nix develop .#benchmarks
benchmarks = pkgs.mkShell {
name = "wayfind-benchmarks-shell";

RUSTC_WRAPPER = "${pkgs.sccache}/bin/sccache";
CARGO_INCREMENTAL = "0";

buildInputs = with pkgs; [
# Rust
(pkgs.rust-bin.stable."1.80.1".minimal.override {
extensions = [
"clippy"
"rustfmt"
];
})
(pkgs.rust-bin.stable."1.80.1".minimal)
sccache

# Benchmarks
cargo-codspeed
];
};

# nix develop .#benchmarks
benchmarks = pkgs.mkShell {
name = "wayfind-benchmarks-shell";
# nix develop .#ci
ci = pkgs.mkShell {
name = "wayfind-ci-shell";

RUSTC_WRAPPER = "${pkgs.sccache}/bin/sccache";
CARGO_INCREMENTAL = "0";

buildInputs = with pkgs; [
# Rust
(pkgs.rust-bin.stable."1.80.1".minimal)
(pkgs.rust-bin.stable."1.80.1".minimal.override {
extensions = [
"clippy"
"rustfmt"
];
})
sccache

# Benchmarks
cargo-codspeed
];
};

Expand All @@ -131,6 +131,20 @@
];
};

# nix develop .#docs
docs = pkgs.mkShell {
name = "wayfind-docs-shell";

RUSTC_WRAPPER = "${pkgs.sccache}/bin/sccache";
CARGO_INCREMENTAL = "0";

buildInputs = with pkgs; [
# Rust
(pkgs.rust-bin.stable."1.80.1".minimal)
sccache
];
};

# nix develop .#fuzz
fuzz = pkgs.mkShell {
name = "wayfind-fuzz-shell";
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! TODO
pub mod constraints;
pub mod decode;
pub mod errors;
Expand Down

0 comments on commit 99745b6

Please sign in to comment.