Skip to content

ci: cache builds with sccache #7

ci: cache builds with sccache

ci: cache builds with sccache #7

Workflow file for this run

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
name: "Build documentation"
permissions:
contents: read
pages: write
id-token: write
on:
push:
branches:
- main
env:
SCCACHE_VERSION: v0.7.7
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Obtain sccache
run: |
curl -fsSL https://github.com/mozilla/sccache/releases/download/${SCCACHE_VERSION}/sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz \
| tar xz sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl/sccache --strip=1
- name: Configure sccache
uses: actions/github-script@v6
with:
script: |
core.exportVariable('RUSTC_WRAPPER', './sccache')
core.exportVariable('SCCACHE_GHA_ENABLED', 'on')
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install mdBook and dependencies
run: |
cargo install mdbook mdbook-admonish
- name: Build site
run: mdbook build docs
- name: Upload built site as artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/dist
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