Skip to content

Commit

Permalink
Fix notebooks and use COD cache
Browse files Browse the repository at this point in the history
  • Loading branch information
tkittel committed Feb 16, 2025
1 parent 37134ce commit 5235d16
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 24 deletions.
12 changes: 5 additions & 7 deletions .github/resources/run_notebooks.x
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
set -eu
export REPOROOT="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )"
CODCACHE_SRC="${REPOROOT}/.github/resources/codcache"
test -d $CODCACHE_SRC

for notebookfile in `find "${REPOROOT}"/notebooks/ -name '*.ipynb'`; do
echo
echo '------------------------------------------------------'
Expand All @@ -13,6 +16,7 @@ for notebookfile in `find "${REPOROOT}"/notebooks/ -name '*.ipynb'`; do
rm -rf "${REPOROOT}/test_tmp_rundir"
mkdir "${REPOROOT}/test_tmp_rundir"
cd "${REPOROOT}/test_tmp_rundir"
cp -rp "${CODCACHE_SRC}" ./ncrystal_onlinedb_filecache
python3 -mvenv create ./venv
. ./venv/bin/activate
python3 -mpip install jupyter ipython
Expand All @@ -31,13 +35,7 @@ for notebookfile in `find "${REPOROOT}"/notebooks/ -name '*.ipynb'`; do
if [ "x${NCNOTEBOOKS_FORCE_SKIP_PLUGIN_NB:-0}" == "x1" ]; then
DO_RUN_PLUGIN_NOTEBOOKS=0
fi
if [ "x${bn}" == "xNEUWAVE_12_Examples_Installing_Plugins_Texture_exercise.ipynb" -a "${DO_RUN_PLUGIN_NOTEBOOKS}" == "0" ]; then
echo
echo
echo "WARNING: SKIPPING NOTEBOOK ABOUT PLUGIN!!!"
echo
echo
elif [ "x${bn}" == "xNEUWAVE_12_Examples_Transmission_with_NCrystal_and_McStas.ipynb" ]; then
if [ "x${bn}" == "xNEUWAVE_12_Examples_Transmission_with_NCrystal_and_McStas.ipynb" ]; then
echo
echo
echo "WARNING: SKIPPING CONDA BASED NOTEBOOK!!!"
Expand Down
24 changes: 7 additions & 17 deletions .github/workflows/run_notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,14 @@ on:
- cron: '30 11 * * 2' # 11:30 every Tuesday

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
run_all_notebooks:
strategy:
matrix:
include:
#Note: Python 3.13 works (Aug 2024) because of the
#"allow-prereleases: true" below.
- { os: ubuntu-latest, python: '3.10' }
- { os: ubuntu-latest, python: '3.11' }
#Too slow, still requires too many wheels to be built - { os: ubuntu-latest, python: '3.13' }
- { os: macos-latest, python: "3.12" }
name: ${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }}
- { os: windows-latest, python: "3.12" }
name: ${{ matrix.os }}.python-${{ matrix.python }}
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -34,16 +27,12 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
allow-prereleases: true #Needed (Aug 2024) for Python 3.13.

- name: Pip install
run: |
set -eux
python3 -m pip install numpy matplotlib spglib ase gemmi jupyterlab ipympl
python3 -m pip install ncrystal>=3.9.4
#python3 -m pip install pymatgen
run: python3 -m pip install ncrystal[all]>=4.0.0

- name: Check versions
shell: bash
run: |
set -eux
which python3
Expand All @@ -54,6 +43,7 @@ jobs:
ncrystal-config -s
- name: Launch tests
shell: bash
run: |
set -eu
set -eux
./src/.github/resources/run_notebooks.x

0 comments on commit 5235d16

Please sign in to comment.