Skip to content

Commit 2209b7a

Browse files
committed
Fix JB2 in CI
1 parent d7c3c5f commit 2209b7a

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,34 @@ jobs:
1919
environment:
2020
name: github-pages
2121
url: ${{ steps.deployment.outputs.page_url }}
22+
defaults:
23+
run:
24+
shell: bash -leo pipefail {0}
2225
runs-on: ubuntu-latest
2326
steps:
2427
- uses: actions/checkout@v5
2528

2629
- name: Set up Pages
2730
uses: actions/configure-pages@v5
2831

29-
- name: Set up Python
32+
- name: Set up conda env
3033
uses: mamba-org/setup-micromamba@v2
3134
with:
3235
environment-file: environment.yml
3336
cache-environment: true
3437

38+
- name: Install JB2
39+
run: python -m pip install -U --pre "jupyter-book==2.*" --no-deps -v
40+
41+
- name: Set up PyVista
42+
uses: pyvista/setup-headless-display-action@v4
43+
44+
- name: Execute the notebook
45+
# JB2 has --execute, but this way we can see how long it takes
46+
run: jupyter nbconvert --to notebook --execute --inplace 03-viz.ipynb
47+
3548
- name: Build HTML
36-
run: jupyter-book build --html --execute --strict --ci
37-
shell: micromamba-shell {0}
49+
run: jupyter book build --html --strict --ci
3850

3951
- name: Upload artifact
4052
uses: actions/upload-pages-artifact@v4

03-viz.ipynb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"title: Viz\n",
1616
"subtitle: Visualizing native-grid output in Python\n",
1717
"label: page:viz\n",
18+
"kernelspec:\n",
19+
" name: python3\n",
1820
"---"
1921
]
2022
},
@@ -62,6 +64,7 @@
6264
},
6365
"outputs": [],
6466
"source": [
67+
"import os\n",
6568
"from pathlib import Path\n",
6669
"\n",
6770
"import cartopy.crs as ccrs\n",
@@ -76,6 +79,8 @@
7679
"import xarray as xr\n",
7780
"\n",
7881
"# https://docs.pyvista.org/user-guide/jupyter/index.html\n",
82+
"if os.environ.get(\"CI\", \"true\") == \"true\":\n",
83+
" pv.start_xvfb()\n",
7984
"pv.set_jupyter_backend(\"static\")\n",
8085
"\n",
8186
"_ = xr.set_options(display_expand_data=False)"

0 commit comments

Comments
 (0)