Always go through rustup
when making toolchain-specific invocations…
#151
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and store docs artifact | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build_pavex_cli: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rust-lang/[email protected] | |
- name: Cache dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: "./libs -> ./target" | |
key: "build-pavex-cli" | |
- name: Build CLI | |
run: | | |
cd libs | |
cargo build --package pavex_cli --bin pavex --release | |
- name: Store CLI artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pavex_cli | |
path: libs/target/release/pavex | |
build_tutorial_generator: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rust-lang/[email protected] | |
- name: Cache dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: "./doc_examples/tutorial_generator -> ./target" | |
- name: Build CLI | |
run: | | |
cd doc_examples/tutorial_generator | |
cargo build | |
- name: Store CLI artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tutorial_generator | |
path: doc_examples/tutorial_generator/target/debug/tutorial_generator | |
tests: | |
runs-on: ubuntu-latest | |
needs: | |
- build_pavex_cli | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust nightly toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: nightly | |
components: rust-docs-json | |
rustflags: "" | |
- name: Install Rust stable toolchain | |
uses: actions-rust-lang/[email protected] | |
with: | |
rustflags: "" | |
- name: Cache dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: "./libs -> ./target" | |
key: "tests" | |
- name: Download pavex CLI artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pavex_cli | |
path: ~/.cargo/bin | |
- name: Mark as executable | |
run: chmod +x ~/.cargo/bin/pavex | |
- name: Run tests | |
run: | | |
cd libs | |
cargo test --no-run | |
cargo test --workspace --exclude="pavex_cli" | |
PAVEX_TEST_CLI_PATH="pavex" cargo test --package pavex_cli | |
is_up_to_date: | |
runs-on: ubuntu-latest | |
needs: | |
- build_pavex_cli | |
- build_tutorial_generator | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set git identity | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
- name: Install Rust nightly toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: nightly | |
components: rust-docs-json | |
rustflags: "" | |
- name: Install Rust stable toolchain | |
uses: actions-rust-lang/[email protected] | |
with: | |
rustflags: "" | |
- name: Download pavex CLI artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pavex_cli | |
path: ~/.cargo/bin | |
- name: Mark as executable | |
run: chmod +x ~/.cargo/bin/pavex | |
- name: Download tutorial_generator CLI artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: tutorial_generator | |
path: ~/.cargo/bin | |
- name: Mark as executable | |
run: chmod +x ~/.cargo/bin/tutorial_generator | |
- uses: cargo-bins/cargo-binstall@main | |
- name: Install cargo-px | |
run: cargo binstall -y --github-token=${{ secrets.GITHUB_TOKEN }} [email protected] | |
- name: Install exa | |
run: cargo binstall -y --github-token=${{ secrets.GITHUB_TOKEN }} [email protected] | |
- name: Verify tutorials | |
run: | | |
cd doc_examples | |
RUST_BACKTRACE=0 tutorial_generator --verify | |
build_docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust stable toolchain | |
uses: actions-rust-lang/[email protected] | |
- name: Cache dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: "./libs -> ./target" | |
key: "build-pavex-docs" | |
- name: Build API reference | |
run: | | |
cd libs | |
cargo doc --package pavex --package pavex_cli_client --no-deps | |
- name: Copy API reference files | |
run: | | |
mkdir -p docs/api_reference | |
cp -r libs/target/doc/* docs/api_reference | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and export to Docker | |
uses: docker/build-push-action@v5 | |
with: | |
context: docs/ | |
load: true | |
tags: pavex-docs | |
- name: Build docs | |
run: | | |
docker run --rm -v ${PWD}:/docs pavex-docs build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: docs | |
path: site/ | |
- name: Fix base | |
run: | | |
# Convert all "absolute" guide links in the reference to relative links so that we can scan for dead links | |
sudo find . -type f -exec sed -i "s#https://pavex.dev/docs/#file:///${PWD}/site/#g" {} + | |
sudo find . -type f -exec sed -i "s#https://pavex.dev/#file:///${PWD}/site/#g" {} + | |
- name: Link Checker | |
uses: lycheeverse/lychee-action@v1 | |
with: | |
fail: true | |
args: | | |
--base site | |
--exclude-loopback | |
--exclude-path="site/api_reference/pavex/http" | |
--exclude-path="site/api_reference/help.html" | |
--exclude-path="site/api_reference/settings.html" | |
--exclude="https://doc.rust-lang.org/*" | |
--exclude="https://docs.rs/**/*" | |
--exclude-path="site/api_reference/static.files" | |
--exclude="https://fonts.gstatic.com" | |
--require-https | |
--verbose | |
--no-progress | |
site |