name: Test and build docs
on:
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
components: rust-docs
- name: Test library
id: test
run: |
cargo test -v
cargo check --example math -v
- name: Build static files
id: build
run: |
mkdir docs
cargo doc -Zunstable-options -Zrustdoc-scrape-examples --no-deps --features __internal_test_docs -v --target-dir docs
cd docs
- name: Generate Directory Listings
uses: jayanta525/github-pages-directory-listing@v4.0.0
with:
FOLDER: .
- name: Upload static files as artifact
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: .
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