Skip to content

[docs] Execute examples when building the docs #30

[docs] Execute examples when building the docs

[docs] Execute examples when building the docs #30

Workflow file for this run

name: Documentation
on:
push:
branches:
- main
tags: "*"
paths:
- ".github/workflows/Documentation.yml"
- "docs/**"
- "src/**"
- "Project.toml"
pull_request:
paths:
- ".github/workflows/Documentation.yml"
- "docs/**"
- "src/**"
- "Project.toml"
release:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: always.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-docs:
permissions:
actions: write
contents: write
pull-requests: read
statuses: write
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
with:
version: "1"
- uses: julia-actions/cache@v2
id: julia-cache
with:
cache-name: Documentation
- name: Instantiate docs environment
# Use `--check-bounds=yes` so that when we run tests we don't need to
# precompile again all the packages.
shell: julia --color=yes --check-bounds=yes --project=docs {0}
run: |
using Pkg
Pkg.instantiate()
- name: Build documentation
run:
julia --color=yes --project=docs --check-bounds=yes docs/make.jl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Save Julia depot cache on cancel or failure
id: julia-cache-save
if: cancelled() || failure()
uses: actions/cache/save@v4
with:
path: |
${{ steps.julia-cache.outputs.cache-paths }}
key: ${{ steps.julia-cache.outputs.cache-key }}
- uses: actions/upload-artifact@v5
with:
name: documentation-build
path: docs/build
retention-days: 10
deploy-docs:
# Deploy docs only if triggers is not a PR, or a PR not from a fork.
if: ${{ (github.event_name != 'pull_request') || (! github.event.pull_request.head.repo.fork) }}
needs: build-docs
permissions:
actions: write
contents: write
pull-requests: read
statuses: write
runs-on: ubuntu-latest
timeout-minutes: 30
concurrency:
# Have only one job pushing the docs at a time.
group: docs-pushing
steps:
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
with:
version: "1"
- uses: julia-actions/cache@v2
with:
# Steal cache from the build job
cache-name: Documentation
- uses: actions/download-artifact@v6
with:
name: documentation-build
path: docs/build
- name: Instantiate docs environment
shell: julia --color=yes --check-bounds=yes {0}
run: |
# We only need `Documenter` for publishing the docs, let's not
# reinstall the world all over again.
using Pkg
Pkg.add(; name="Documenter", version="1")
- name: Deploy documentation
run:
julia --color=yes --check-bounds=yes docs/deploy.jl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}