Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 0 additions & 175 deletions .github/workflows/CI.yml

This file was deleted.

114 changes: 18 additions & 96 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,131 +11,53 @@ on:
- cron: "0 4 * * *"
workflow_dispatch:

defaults:
run:
shell: bash -l {0}

jobs:
test:
if: (github.event_name == 'schedule' && github.repository == 'openforcefield/openff-toolkit') || (github.event_name != 'schedule')
name: ${{ matrix.os }}, Python ${{ matrix.python-version }}, RDKit=${{ matrix.rdkit }}, OpenEye=${{ matrix.openeye }}, NAGL=${{ matrix.nagl }}
name: ${{ matrix.os }}, environment=${{ matrix.environment }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [ "3.12"]
rdkit: [true, false]
openeye: [true, false]
nagl: [true, false]
exclude:
- rdkit: false
openeye: false
- rdkit: true
openeye: true
- rdkit: false
nagl: true
environment:
- examples-ambertools
- examples-openeye

env:
OE_LICENSE: ${{ github.workspace }}/oe_license.txt
PACKAGE: openff
PYTEST_ARGS: -r fE -v -x --tb=short -nauto --durations=10
NB_ARGS: --nbval-lax --dist loadscope --ignore=examples/deprecated

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Set environment variables
run: |
if [[ ${{ matrix.openeye }} == true && ${{ matrix.rdkit }} == false ]]; then
echo "ENVFILE=openeye" >> $GITHUB_ENV
echo "TOOLKIT_CHECKS=OPENEYE" >> $GITHUB_ENV
echo "PACKAGES_TO_REMOVE=ambertools rdkit" >> $GITHUB_ENV
fi

if [[ ${{ matrix.openeye }} == false && ${{ matrix.rdkit }} == true ]]; then
echo "ENVFILE=rdkit" >> $GITHUB_ENV
echo "TOOLKIT_CHECKS=RDKIT" >> $GITHUB_ENV
echo "PACKAGES_TO_REMOVE=openeye-toolkits" >> $GITHUB_ENV
fi

- name: Install conda environment with ${{ env.ENVFILE }}
uses: mamba-org/setup-micromamba@v3
- name: Set up virtual environment
uses: prefix-dev/setup-pixi@v0.9.6
with:
environment-file: devtools/conda-envs/${{env.ENVFILE}}-examples.yaml
create-args: >-
python=${{ matrix.python-version }}
pixi-version: v0.70.0
environments: ${{ matrix.environment }}
frozen: true

- name: Make oe_license.txt file from GH org secret "OE_LICENSE"
if: contains(matrix.environment, 'openeye')
env:
OE_LICENSE_TEXT: ${{ secrets.OE_LICENSE }}
run: echo "${OE_LICENSE_TEXT}" > ${OE_LICENSE}

- name: Optionally remove OpenFF NAGL
if: ${{ matrix.nagl == false }}
run: micromamba remove openff-nagl-base openff-nagl-models --force

- name: Install package
run: python -m pip install .

- name: Remove undesired toolkits
run: |
# If openmmforcefields is included in either environment file,
# remove RDKit and AmberTools brought in by it. Currently it's not included,
# so don't remove it.
if [ ! -z "${{ env.PACKAGES_TO_REMOVE }}" ]; then
for cpkg in ${{ env.PACKAGES_TO_REMOVE }}; do
if [[ $(micromamba list | grep $cpkg) ]]; then micromamba remove --force $cpkg --yes ; fi
done
fi

- name: Check installed toolkits
run: |
for tk in ${{ env.TOOLKIT_CHECKS }}; do
python -c "from openff.toolkit.utils.toolkits import ${tk}_AVAILABLE; assert ${tk}_AVAILABLE, '${tk} unavailable'"
done

- name: Check uninstalled toolkits
- name: Check OpenEye installed
if: contains(matrix.environment, 'openeye')
run: |
if [ ! -z "${{ env.PACKAGES_TO_REMOVE }}" ]; then
for tk in ${{ env.PACKAGES_TO_REMOVE }}; do
TK=$(echo ${tk%-*} | tr 'a-z' 'A-Z')
python -c "from openff.toolkit.utils.toolkits import ${TK}_AVAILABLE; assert not ${TK}_AVAILABLE, '${TK} available'"
done
fi
pixi run -e examples-openeye python -c "from openff.toolkit.utils.toolkits import OPENEYE_AVAILABLE; assert OPENEYE_AVAILABLE, 'OpenEye unavailable'"

- name: Environment Information
- name: Check OpenEye NOT installed
if: ! contains(matrix.environment, 'openeye')
run: |
micromamba info
micromamba list
pip list
pixi run -e examples-ambertools python -c "from openff.toolkit.utils.toolkits import OPENEYE_AVAILABLE; assert not OPENEYE_AVAILABLE, 'OpenEye available but shouldn\'t be'"

- name: Run example scripts
run: |
if [[ ${{ matrix.rdkit }} == false ]]; then
PYTEST_ARGS+=" --ignore=examples/check_dataset_parameter_coverage"
PYTEST_ARGS+=" --ignore=examples/QCArchive_interface"
fi
pytest $PYTEST_ARGS openff/toolkit/_tests/test_examples.py
run: pixi run -e ${{ matrix.environment }} run_scripts

- name: Run example notebooks
run: |
if [[ ${{ matrix.rdkit }} == false ]]; then
NB_ARGS+=" --ignore=examples/QCArchive_interface"
NB_ARGS+=" --ignore=examples/visualization"
NB_ARGS+=" --ignore=examples/check_dataset_parameter_coverage"
NB_ARGS+=" --ignore=examples/conformer_energies"
NB_ARGS+=" --ignore=examples/using_smirnoff_in_amber_or_gromacs"
NB_ARGS+=" --ignore=examples/using_smirnoff_with_amber_protein_forcefield"
NB_ARGS+=" --ignore=examples/SMIRNOFF_simulation"
NB_ARGS+=" --ignore=examples/toolkit_showcase"
fi

# GROMACS builds are not stable on macOS + GHA
if [[ ${{ matrix.os }} == macos-latest ]]; then
NB_ARGS+=" --ignore=examples/using_smirnoff_in_amber_or_gromacs/"
fi

python -m pytest $PYTEST_ARGS $NB_ARGS examples
run: pixi run -e ${{ matrix.environment }} run_notebooks
45 changes: 0 additions & 45 deletions devtools/conda-envs/openeye-examples.yaml

This file was deleted.

Loading
Loading