Refactor CI to use micromamba instead of docker containers. #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
push: | |
branches: | |
- "trunk" | |
- "trunk-major" | |
workflow_dispatch: | |
schedule: | |
- cron: '0 18 * * 1' | |
jobs: | |
execute_notebooks: | |
name: Execute notebooks | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
with: | |
path: hoomd | |
ref: trunk-minor | |
repository: glotzerlab/hoomd-blue | |
submodules: true | |
- name: Create Python Environment | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-name: test | |
environment-file: hoomd/.github/workflows/environments/py312-conda-lock.yml | |
micromamba-root-path: ${{ github.workspace }}/micromamba | |
- name: Configure conda environment variables | |
run: | | |
echo "PYTHONPATH=$GITHUB_WORKSPACE/hoomd/build" >> $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 | |
# TODO: Move jupyter to hoomd's conda lock file? | |
- name: Install jupyter | |
run: micromamba install jupyterlab | |
- name: Configure | |
run: >- | |
cmake -B hoomd/build -S hoomd -GNinja | |
-DCMAKE_BUILD_TYPE=Release | |
-DENABLE_GPU=off | |
-DENABLE_MPI=off | |
-DENABLE_TBB=off | |
-DBUILD_TESTING=off | |
-DENABLE_LLVM=off | |
- name: Compile | |
run: ninja -j $(($(getconf _NPROCESSORS_ONLN) + 2)) | |
working-directory: hoomd/build | |
- name: Display hoomd version | |
run: python3 -c "import hoomd; print(hoomd.version.version, hoomd.version.git_sha1)" | |
- name: Checkout notebooks | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
with: | |
path: notebooks | |
- 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 |