Skip to content

Test

Test #86

Workflow file for this run

name: Test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches:
- "trunk-minor"
- "trunk-major"
workflow_dispatch:
schedule:
- cron: '0 18 * * 1'
jobs:
execute_notebooks:
name: Execute notebooks
runs-on: ubuntu-24.04
steps:
- name: Checkout hoomd
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: code
ref: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}
repository: glotzerlab/hoomd-blue
submodules: true
- name: Determine hoomd hash
id: hoomd
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
working-directory: code
- name: Restore cached HOOMD-blue build
id: cache
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: install
key: hoomd-blue-${{ steps.hoomd.outputs.sha }}
- name: Checkout notebooks
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: notebooks
- name: Create Python Environment
uses: mamba-org/setup-micromamba@617811f69075e3fd3ae68ca64220ad065877f246 # v2.0.0
with:
environment-name: test
environment-file: notebooks/.github/workflows/environments/py312-conda-lock.yml
micromamba-root-path: ${{ github.workspace }}/micromamba
- name: Configure conda environment variables
run: |
echo "PYTHONPATH=$GITHUB_WORKSPACE/install" >> $GITHUB_ENV
echo "CONDA_PREFIX=$MAMBA_ROOT_PREFIX/envs/test" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=$MAMBA_ROOT_PREFIX/envs/test" >> $GITHUB_ENV
echo "$MAMBA_ROOT_PREFIX/envs/test/bin" >> $GITHUB_PATH
- name: Configure
if: steps.cache.outputs.cache-hit != 'true'
run: >-
cmake -B hoomd/build -S code -GNinja
-DCMAKE_BUILD_TYPE=Release
-DENABLE_GPU=off
-DENABLE_MPI=on
-DENABLE_TBB=off
-DBUILD_TESTING=off
-DENABLE_LLVM=off
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install
- name: Compile
if: steps.cache.outputs.cache-hit != 'true'
run: ninja install -j $(($(getconf _NPROCESSORS_ONLN) + 2))
working-directory: hoomd/build
- name: Cache HOOMD-blue build
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: install
key: hoomd-blue-${{ steps.hoomd.outputs.sha }}
- name: Display hoomd version
run: python3 -c "import hoomd; print(hoomd.version.version, hoomd.version.git_sha1)"
- name: List notebooks
run: ls **/*.ipynb
working-directory: notebooks
- name: Execute notebooks
run: |
for i in */
do
echo "Running notebooks in: $i" && jupyter nbconvert --execute --inplace $i/*.ipynb || exit 1
done
working-directory: notebooks
# This check is very basic, but we don't want to use `python -W error` as it will also catch any
# warnings generated inside nbconvert and its dependencies.
- name: Check for warnings
run: |
has_warnings=0
for file in **/*.ipynb
do
grep Warning $file && echo "::warning file=${file}::Has deprecation warnings" && has_warnings=1
done
# Allow deprecation warnings for now.
# exit ${has_warnings}
exit 0
working-directory: notebooks