Dependency injections docs, #3 (#129) #73
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 -> ./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 -> ./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 | |
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 | |
- name: Install Rust stable toolchain | |
uses: actions-rust-lang/[email protected] | |
- 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 | |
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 -> ./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: Link Checker | |
uses: lycheeverse/lychee-action@v1 | |
with: | |
fail: true | |
args: --base . --exclude-loopback --exclude-path="docs/api_reference" --require-https --verbose --no-progress docs | |
- 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/ |