Skip to content

Patch-based workflow for tutorials in Pavex's documentation #20

Patch-based workflow for tutorials in Pavex's documentation

Patch-based workflow for tutorials in Pavex's documentation #20

Workflow file for this run

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@v3
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@v3
with:
name: tutorial_generator
path: doc_examples/tutorial_generator/target/debug/tutorial_generator
build_docs:
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
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 --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: Download pavex CLI artifact
uses: actions/download-artifact@v3
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@v3
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 [email protected]
- name: Generate quickstart tutorial
run: |
cd doc_examples/quickstart
tutorial_generator
- 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@v3
with:
name: docs
path: site/