Skip to content

Implement bond interactions #646

Implement bond interactions

Implement bond interactions #646

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.8", "3.9", "3.10", "3.11", "3.12"]
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@v5
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.8", "3.9", "3.10", "3.11"]
hoomd-version: ["2.9.7", "3.11.0", "4.7.0"]
include:
- python-version: "3.12"
hoomd-version: "4.7.0"
exclude:
- python-version: "3.11"
hoomd-version: "2.9.7"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge
channel-priority: true
mamba-version: "*"
python-version: ${{ matrix.python-version }}
- name: Force HOOMD 2 NumPy version
if: ${{ matrix.hoomd-version == '2.9.7' || matrix.hoomd-version == '3.11.0' }}
run: |
mamba install "numpy<2" "gsd<3.4"
- name: Install test dependencies
run: |
mamba 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 }}, ${{ matrix.mpi }}]
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.8", "3.9", "3.10", "3.11"]
lammps-version: ["2022.06.23", "2023.08.02"]
mpi: ["mpich", "openmpi"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge
channel-priority: true
mamba-version: "*"
python-version: ${{ matrix.python-version }}
- name: Install LAMMPS
run: |
mamba install "lammps=${{ matrix.lammps-version }}=*${{ matrix.mpi }}*" mpi4py
- name: Force libpnetcdf version
if: ${{ matrix.lammps-version == '2023.08.02' }}
run: |
mamba 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 ${{ matrix.lammps-version == '2022.06.23' && 'lmp_serial' || '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.8
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge
channel-priority: true
mamba-version: "*"
python-version: 3.8
- name: Install test dependencies
run: |
mamba install hoomd=3
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