CI (#10) #5
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
name: Check markdown links | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 1 * *' # Every month | |
push: | |
branches: | |
- main | |
paths: | |
- 'docs/**' | |
- '.github/workflows/linkcheck.yml' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
linkcheck: | |
env: | |
DIR: 'docs' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
- name: Setup Julia | |
uses: julia-actions/setup-julia@f2258781c657ad9b4b88072c5eeaf9ec8c370874 # v2 | |
- name: Convert literate notebooks to ipynb files | |
shell: julia --color=yes {0} | |
working-directory: ${{ env.DIR }} | |
run: | | |
import Pkg | |
Pkg.add("Literate") | |
using Literate | |
for (root, dirs, files) in walkdir(pwd()) | |
for file in files | |
if endswith(file, ".jl") | |
nb = joinpath(root, file) | |
Literate.notebook(nb, dirname(nb); mdstrings=true, execute=false) | |
end | |
end | |
end | |
- name: Setup Python | |
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | |
id: setup-python | |
with: | |
python-version: '3.x' | |
- name: Cache python venv | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
if: ${{ contains(runner.name, 'GitHub Actions') }} | |
id: cache-venv | |
with: | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements.txt') }} | |
path: .venv | |
- name: Install Python dependencies | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
python -m pip install -r requirements.txt | |
echo "${VIRTUAL_ENV}/bin" >> $GITHUB_PATH | |
echo "VIRTUAL_ENV=${VIRTUAL_ENV}" >> $GITHUB_ENV | |
- name: Build website | |
run: jupyter-book build ${DIR} --builder linkcheck |