From 18ca37d060bb059934a01f218e4eab5c801d2077 Mon Sep 17 00:00:00 2001 From: Angus Gibson Date: Mon, 12 Feb 2024 14:18:13 +1100 Subject: [PATCH] Build tutorials from g-adopt/tutorials repository --- .github/workflows/build.yml | 41 +++++++++++++++++++++++++++++++++++++ mkdocs.yml | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1608db0..87b904c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,43 @@ permissions: id-token: write jobs: + render: + runs-on: self-hosted + container: + image: firedrakeproject/firedrake:latest + options: --shm-size 2g + + env: + OMP_NUM_THREADS: 1 + + steps: + - uses: actions/checkout@v4 + with: + repository: g-adopt/tutorials + path: tutorials + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y libgl1-mesa-glx xvfb + . /home/firedrake/firedrake/bin/activate + python3 -m pip install nbval pyvista nbconvert + python3 -m pip install gadopt[optimisation] + - name: Run test + run: | + . /home/firedrake/firedrake/bin/activate + export DISPLAY=:99 + export PYVISTA_OFF_SCREEN=true + Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 & + sleep 3 + python3 -m pytest --nbval tutorials/01-*.ipynb + - name: Convert notebooks + run: | + python3 -m jupyter nbconvert --to notebook --execute --output-dir=rendered tutorials/01-*.ipynb + - uses: actions/upload-artifact@v4 + with: + name: notebooks + path: rendered + build: runs-on: ubuntu-latest steps: @@ -23,6 +60,10 @@ jobs: - name: Install Python dependencies run: | pip install -r requirements.txt + - uses: actions/download-artifact@v4 + with: + name: notebooks + path: docs/tutorials - name: Build site run: | mkdocs build --clean diff --git a/mkdocs.yml b/mkdocs.yml index 65c1af2..34c8bec 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -18,7 +18,7 @@ nav: - Documentation: documentation.md - Tutorials: - tutorials.md - - Helmholtz: tutorials/01-spd-helmholtz.nbconvert.ipynb + - Helmholtz: tutorials/01-spd-helmholtz.ipynb - Benchmarks: benchmarks.md - Team: team.md - Funding: funding.md