Skip to content

[pre-commit.ci] pre-commit autoupdate #875

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #875

Workflow file for this run

name: test
on:
pull_request:
push:
branches:
- main
schedule:
- cron: "18 10 1,15 * *"
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: unit test [python-${{ matrix.python-version }}, ${{ matrix.mpi }}]
runs-on: ubuntu-latest
env:
MPIEXEC_TIMEOUT: 300
RDMAV_FORK_SAFE: 1
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
mpi: ["nompi", "mpich", "openmpi"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup MPI
if: ${{ matrix.mpi != 'nompi' }}
uses: mpi4py/setup-mpi@v1
with:
mpi: ${{ matrix.mpi }}
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
run: |
pip install -r tests/requirements.txt
- name: Install
run: |
pip install .
- name: Test
run: |
python -m unittest discover -v -s ./tests -p "test_*.py"
- name: Install mpi4py
if: ${{ matrix.mpi != 'nompi' }}
run: |
pip install --no-cache-dir mpi4py
- name: Test MPI
if: ${{ matrix.mpi != 'nompi' }}
run: |
mpiexec -n 2 python -m unittest discover -v -s ./tests -p "test_*.py"
test-hoomd:
name: unit test [python-${{ matrix.python-version }}, hoomd-${{ matrix.hoomd-version }}]
needs: test
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
hoomd-version: ["3.11.0", "4.9.1", "5.0.1"]
exclude:
- python-version: "3.12"
hoomd-version: "3.11.0"
- python-version: "3.13"
hoomd-version: "3.11.0"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge,defaults
channel-priority: strict
python-version: ${{ matrix.python-version }}
- name: Force HOOMD 3 NumPy version
if: ${{ matrix.hoomd-version == '3.11.0' }}
run: |
conda install "numpy<2" "gsd<3.4"
- name: Install test dependencies
run: |
conda install hoomd=${{ matrix.hoomd-version }} --no-update-deps
pip install -r tests/requirements.txt --upgrade-strategy only-if-needed
- name: Install
run: |
pip install .
- name: Test
run: |
python -m unittest -v tests/simulate/test_hoomd.py
test-lammps:
name: unit test [python-${{ matrix.python-version }}, lammps-${{ matrix.lammps-version }}
needs: test
runs-on: ubuntu-latest
env:
MPIEXEC_TIMEOUT: 300
RDMAV_FORK_SAFE: 1
defaults:
run:
shell: bash -el {0}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
lammps-version: ["2023.08.02", "2024.08.29"]
exclude:
- python-version: "3.12"
lammps-version: "2023.08.02"
- python-version: "3.13"
lammps-version: "2023.08.02"
- python-version: "3.13"
lammps-version: "2024.08.29"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge,defaults
channel-priority: strict
python-version: ${{ matrix.python-version }}
- name: Install LAMMPS
run: |
conda install "lammps=${{ matrix.lammps-version }}=*mpich*" mpi4py
- name: Force libpnetcdf version
if: ${{ matrix.lammps-version == '2023.08.02' }}
run: |
conda install "libpnetcdf<1.13.0"
- name: Install test dependencies
run: |
pip install -r tests/requirements.txt
- name: Install
run: |
pip install .
- name: Test
run: |
python -m unittest -v tests/simulate/test_lammps.py
- name: Test executable
run: |
python tests/simulate/test_lammps.py -v --lammps lmp
- name: Test MPI
run: |
mpiexec -n 2 python -m unittest -v tests/simulate/test_lammps.py
- name: Test MPI executable
run: |
python tests/simulate/test_lammps.py -v --lammps "mpiexec -n 2 lmp_mpi"
test-examples:
name: test examples
needs: [test, test-hoomd]
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python 3.9
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge,defaults
channel-priority: strict
python-version: 3.9
- name: Install test dependencies
run: |
conda install hoomd=5
pip install -r doc/requirements.txt
- name: Install
run: |
pip install .
- name: Run notebooks
run: |
for nb in doc/source/guide/examples/*/*.ipynb
do
jupyter nbconvert \
--ExecutePreprocessor.timeout=120 \
--to notebook \
--execute $nb
done
# final exit point for unit tests on PRs, which can be a required check
test-exit:
name: unit test
needs: [test, test-hoomd, test-lammps, test-examples]
if: ${{ always() && github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: Check core tests
if: needs.test.result != 'success'
run: echo "::error ::core tests failed." && exit 1
- name: Check hoomd tests
if: needs.test-hoomd.result != 'success'
run: echo "::error ::hoomd tests failed." && exit 1
- name: Check lammps tests
if: needs.test-lammps.result != 'success'
run: echo "::error ::lammps tests failed." && exit 1