add top-level module with useful commands and change test runs to --n… #279
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
# PSA: Use actionlint (https://github.com/rhysd/actionlint) to check actions! | |
name: Publish to GitHub Pages | |
on: | |
# Run when pushing main branch | |
push: | |
branches: [ "main" ] | |
# Run when pushing button in Actions tab | |
workflow_dispatch: | |
# Empower GITHUB_TOKEN to do the work | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow just one concurrent deployment, but make sure it can run to completion | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
# Build the documentation and upload it as an artifact | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ github.repository == 'apparebit/prettypretty' }} | |
env: | |
MDBOOK_VERSION: '0.4.40' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
- name: Set up stable Rust | |
run: rustup toolchain install stable | |
- name: Build and install prettypretty as extension module | |
run: pip install '.[dev]' | |
- name: Install mdBook | |
run: | | |
mkdir ~/tools | |
curl -L https://github.com/rust-lang/mdBook/releases/download/v$MDBOOK_VERSION/mdbook-v$MDBOOK_VERSION-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/tools | |
echo ~/tools >> $GITHUB_PATH | |
- name: Configure GitHub Pages | |
id: pages | |
uses: actions/configure-pages@v5 | |
- name: Build user guide | |
run: mdbook build docs | |
- name: Create Rust API documentation | |
run: cargo rustdoc --all-features --lib -- -e $(realpath docs/pretty.css) | |
- name: Create Python API documentation | |
run: | | |
mkdir -v target/doc/python | |
sphinx-build -a -b html docs target/doc/python | |
rm -rf target/doc/python/.doctrees | |
- name: Upload documentation | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
name: github-pages | |
path: target/doc/ | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy documentation to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |