Skip to content

Commit

Permalink
Try to add basic CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tkittel committed Aug 26, 2024
1 parent d929df0 commit c9f00d7
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/resources/run_notebooks.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -eu
export REPOROOT="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )"
for notebookfile in `find "${REPOROOT}"/notebooks/ -name '*.ipynb'`; do
echo
echo '------------------------------------------------------'
bn=$(basename "${notebookfile}")
echo "Testing ${bn}"
echo "${notebookfile}"
rm -rf "${REPOROOT}/test_tmp_rundir"
mkdir "${REPOROOT}/test_tmp_rundir"
cd "${REPOROOT}/test_tmp_rundir"
echo " .. converting to script"
jupyter nbconvert --to script "${notebookfile}" --output="${PWD}/${bn}_converted"
echo " .. executing script"
time ipython ./${bn}_converted.py | cat
done
59 changes: 59 additions & 0 deletions .github/workflows/run_notebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: basictest

on:
push:
pull_request:
schedule:
- 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
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' }
- { os: ubuntu-latest, python: '3.13' }
- { os: macos-latest, python: "3.12" }
name: ${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }}
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: src

- name: Setup python
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
- name: Check versions
run: |
set -eux
which python3
python3 --version
which cmake
cmake --version
nctool --version
ncrystal-config -s
- name: Launch tests
run: |
set -eu
./src/.github/resources/run_notebooks.x

0 comments on commit c9f00d7

Please sign in to comment.