Skip to content

Bump the gha-dependencies group with 3 updates (#88) #371

Bump the gha-dependencies group with 3 updates (#88)

Bump the gha-dependencies group with 3 updates (#88) #371

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:
JULIA_CI: 'true'
JULIA_CONDAPKG_BACKEND: 'Null'
JULIA_CONDAPKG_OFFLINE: 'true'
JULIA_NUM_THREADS: 'auto'
# JULIA_CPU_TARGET: 'generic;icelake-server,clone_all;znver3,clone_all'
NBCACHE: '.cache'
NBCONVERT_JOBS: '6'
TIMEOUT: '600'
ALLOWERRORS: 'false'
PY_VER: '3.13'
jobs:
execute:
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: Install the latest version of uv
uses: astral-sh/setup-uv@v7
- name: Install Python dependencies
run: uv pip install --system -r requirements.txt
- 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
with:
version: ${{ steps.julia-version.outputs.value }}
arch: ${{ runner.arch }}
- name: Restore Julia packages
uses: actions/cache/restore@v5
if: ${{ 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: ${{ runner.environment == 'self-hosted' || steps.cache-julia.outputs.cache-hit != 'true' }}
shell: julia --color=yes {0}
run: |
using Pkg, Dates
Pkg.add(["JSON", "Tables", "MarkdownTables", "SHA", "IJulia"])
Pkg.activate(".")
Pkg.instantiate()
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: ${{ 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 .github/ci.jl
- name: Upload Notebooks
uses: actions/upload-artifact@v6
with:
path: ${{ env.NBCACHE }}/**/*.ipynb
include-hidden-files: true
name: notebooks
retention-days: 1
render:
needs: execute
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download notebooks
uses: actions/download-artifact@v7
with:
name: notebooks
path: ${{ env.NBCACHE }}
- name: Copy back built notebooks
run: cp --verbose -rf ${{ env.NBCACHE }}/docs/* docs/
- name: Setup Quarto
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/
# CI conclusion for GitHub status check
# Adaped from https://brunoscheufler.com/blog/2022-04-09-the-required-github-status-check-that-wasnt
CI:
needs: render
if: always()
runs-on: ubuntu-slim
steps:
- run: |
if [[ ${{ needs.render.result }} == "success" ]]; then
echo "Tests passed"
exit 0
else
echo "Tests failed"
exit 1
fi
deploy:
name: Deploy to GitHub pages
needs: render
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