Skip to content

CI

CI #1978

Workflow file for this run

name: CI
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
schedule:
- cron: "0 0 * * *"
defaults:
run:
shell: bash -l {0}
jobs:
test:
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }}, Toolkit ${{ matrix.toolkit }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
os:
- ubuntu-latest
- macos-latest
toolkit:
- true
- false
env:
PYTEST_ARGS: -v -nauto --cov=openforcefields --cov-config=setup.cfg --cov-append --cov-report=xml
steps:
- uses: actions/checkout@v4
- name: Install dependencies
if: ${{ matrix.toolkit == true }}
uses: mamba-org/setup-micromamba@v1
with:
environment-file: devtools/conda-envs/test_env.yaml
create-args: >-
python=${{ matrix.python-version }}
- name: Install dependencies
if: ${{ matrix.toolkit == false }}
uses: mamba-org/setup-micromamba@v1
with:
environment-file: devtools/conda-envs/test_no_toolkit.yaml
create-args: >-
python=${{ matrix.python-version }}
- name: Install package
run: |
python -m pip install -e .
- name: Run water model tests
if: ${{ matrix.toolkit == true }}
run: |
pytest $PYTEST_ARGS openforcefields/tests/test_water_models.py
- name: Run unit tests
run: |
pytest $PYTEST_ARGS openforcefields/tests/test_openforcefields.py
- name: Regenerate water models
if: ${{ matrix.toolkit == true }}
run: |
python scripts/get_ion_nb_params_from_ambertools_frcmod.py $AMBERHOME/dat/leap/parm/frcmod.ionslm_126_opc
python scripts/get_ion_nb_params_from_ambertools_frcmod.py $AMBERHOME/dat/leap/parm/frcmod.ionslm_126_opc3
python scripts/get_ion_nb_params_from_ambertools_frcmod.py $AMBERHOME/dat/leap/parm/frcmod.ionslm_126_fb3
python scripts/get_ion_nb_params_from_ambertools_frcmod.py $AMBERHOME/dat/leap/parm/frcmod.ionslm_126_fb4
ls scripts/write_*.py | xargs -n 1 -P 3 python
pre-commit run --all-files && git add openforcefields/offxml
- name: Error out if any OFFXML files changed
if: ${{ matrix.toolkit == true }}
run: |
if test "$( git diff openforcefields/offxml/ | wc | awk '{print $1}' )" -gt 0
then
echo 'The following changes in OFFXML files were detected:'
git diff openforcefields/offxml/
exit 1
else
echo 'no files differ'
fi
- name: Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false