Skip to content

Merge eqs instead of systems (#150) #659

Merge eqs instead of systems (#150)

Merge eqs instead of systems (#150) #659

Workflow file for this run

name: Build notebooks and publish
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
LITERATE_PROC: '6'
JULIA_CI: 'true'
JULIA_CONDAPKG_BACKEND: 'Null'
JULIA_CONDAPKG_OFFLINE: 'true'
# JULIA_CPU_TARGET: 'generic;icelake-server,clone_all;znver3,clone_all'
JULIA_NUM_THREADS: '2'
OPENBLAS_NUM_THREADS: '1'
NBCACHE: '.cache'
PY_VER: '3.14'
jobs:
CI:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
id: setup-python
with:
python-version: ${{ env.PY_VER }}
- name: Read Julia version
id: julia-version
run: python -c 'import tomllib; from pathlib import Path; print("value=", tomllib.loads(Path("Manifest.toml").read_text())["julia_version"], sep="")' >> "$GITHUB_OUTPUT"
- name: Get environment hash
id: hash
run: |
echo "value=${{ hashFiles('Project.toml', 'Manifest.toml', 'src/**') }}" >> "$GITHUB_OUTPUT"
- name: Cache executed notebooks
uses: actions/cache@v5
id: cache-nb
with:
path: |
${{ env.NBCACHE }}/**/*.ipynb
${{ env.NBCACHE }}/**/*.sha
key: notebook-${{ steps.hash.outputs.value }}-${{ hashFiles('docs/**') }}
restore-keys: |
notebook-${{ steps.hash.outputs.value }}-
- name: Setup Julia
uses: julia-actions/setup-julia@v2
if: ${{ steps.cache-nb.outputs.cache-hit != 'true' }}
with:
version: ${{ steps.julia-version.outputs.value }}
arch: ${{ runner.arch }}
- name: Restore Julia packages
uses: actions/cache/restore@v5
if: ${{ steps.cache-nb.outputs.cache-hit != 'true' && runner.environment == 'github-hosted'}}
id: cache-julia
with:
path: ~/.julia
key: ${{ runner.os }}-julia-${{ steps.julia-version.outputs.value }}-${{ steps.hash.outputs.value }}
restore-keys: |
${{ runner.os }}-julia-${{ steps.julia-version.outputs.value }}
- name: Install Julia packages
if: ${{ steps.cache-nb.outputs.cache-hit != 'true' && (runner.environment == 'self-hosted' || steps.cache-julia.outputs.cache-hit != 'true') }}
shell: julia --color=yes {0}
run: |
using Pkg, Dates
Pkg.add(["JSON", "Literate", "MarkdownTables", "SHA", "Tables"])
Pkg.activate(".")
Pkg.instantiate()
Pkg.resolve()
Pkg.precompile()
if ENV["RUNNER_ENVIRONMENT"] == "github-hosted"
Pkg.gc(;collect_delay=Day(0))
end
- name: Save Julia packages
uses: actions/cache/save@v5
if: ${{ steps.cache-nb.outputs.cache-hit != 'true' && runner.environment == 'github-hosted' && steps.cache-julia.outputs.cache-hit != 'true' }}
with:
path: ~/.julia
key: ${{ steps.cache-julia.outputs.cache-primary-key }}
- name: Run notebooks
if: ${{ steps.cache-nb.outputs.cache-hit != 'true' }}
run: julia --project=@. --color=yes -p ${{ env.LITERATE_PROC }} .github/ci.jl
- name: Copy back built notebooks
run: |
cp --verbose -rf ${{ env.NBCACHE }}/docs/* docs/
find docs/ -type f -name "*.jl" -delete
- name: Upload notebook
uses: actions/upload-artifact@v6
with:
name: notebooks
path: docs/**/*.ipynb
- name: Setup Quarto
if: ${{ runner.environment == 'github-hosted' }}
uses: quarto-dev/quarto-actions/setup@v2
- name: Render Quarto Project
run: quarto render docs/
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
path: docs/_site/
deploy:
name: Deploy to GitHub pages
needs: CI
if: ${{ github.ref == 'refs/heads/main'}}
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-slim
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4