fix target directory #61
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
# Workflow for building and deploying a mdBook site to GitHub Pages | |
# | |
# To get started with mdBook see: https://rust-lang.github.io/mdBook/index.html | |
# See also https://ectobit.com/blog/speed-up-github-actions-rust-pipelines/ | |
# | |
name: Deploy mdBook site to Pages | |
# run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
env: | |
MDBOOK_VERSION: 0.4.36 | |
CARGO_TARGET_DIR: ./target/ | |
steps: | |
- uses: actions/checkout@v4 | |
## Rust | |
- name: Set up cargo cache | |
uses: actions/cache@v3 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Install rustup | |
run: | | |
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh | |
rustup update | |
- name: Install rustfmt and clippy | |
run: | | |
rustup component add rustfmt | |
rustup component add clippy | |
- name: Rust code lint | |
run: | | |
cargo fmt --all --check | |
cargo clippy --workspace -- --deny warnings | |
# - name: Install cargo check tools | |
# run: | | |
# cargo install --locked cargo-deny || true | |
# cargo install --locked cargo-outdated || true | |
# cargo install --locked cargo-udeps || true | |
# cargo install --locked cargo-audit || true | |
# cargo install --locked cargo-pants || true | |
# - name: Check dependencies | |
# run: | | |
# cargo deny check | |
# cargo outdated --exit-code 1 | |
# cargo udeps | |
# rm -rf ~/.cargo/advisory-db | |
# cargo audit | |
# cargo pants | |
- name: Cargo test all crates, including xmpl/* | |
run: cargo test --locked --workspace | |
- name: Build all crates, including xmpl/* | |
run: cargo build --locked --workspace | |
## Book | |
- name: Install cargo binstall | |
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash | |
- name: Install mdbook | |
run: cargo binstall --version ${MDBOOK_VERSION} --no-confirm mdbook | |
- name: Install mdbook-hide | |
run: cargo install mdbook-hide | |
- name: Install mdbook-keeper | |
run: cargo install mdbook-keeper --git https://github.com/tfpk/mdbook-keeper.git | |
- name: Build with mdBook (will call `mdbook test`) | |
run: mdbook build | |
# GitHub Pages | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v4 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./book | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |