-
Notifications
You must be signed in to change notification settings - Fork 15
110 lines (91 loc) · 3.4 KB
/
test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
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@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: install
key: hoomd-blue-${{ steps.hoomd.outputs.sha }}
- name: Checkout notebooks
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
path: notebooks
- name: Create Python Environment
uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1.9.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@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.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 "::error file=${file}::Has deprecation warnings" && has_warnings=1
done
exit ${has_warnings}
working-directory: notebooks