Skip to content

Add domains, versioning, and tests (#54) #290

Add domains, versioning, and tests (#54)

Add domains, versioning, and tests (#54) #290

Workflow file for this run

name: GH Actions CI
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
# Specific group naming so CI is only cancelled
# within same PR or on merge to main
group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
defaults:
run:
shell: bash -l {0}
env:
OE_LICENSE: ${{ github.workspace }}/oe_license.txt
jobs:
main_tests:
name: CI (${{ matrix.os }}, py-${{ matrix.python-version }}, rdkit=${{ matrix.include-rdkit }}, openeye=${{ matrix.include-openeye }}, dgl=${{ matrix.include-dgl }}), pydantic=${{ matrix.pydantic-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macOS-latest, ubuntu-latest]
python-version: ["3.9", "3.10", "3.11"]
pydantic-version: ["1", "2"]
include-rdkit: [true, false]
include-openeye: [true, false]
include-dgl: [true, false]
exclude:
- include-rdkit: false
include-openeye: false
# broken OpenMM build for Mac on 3.10
- os: "macOS-latest"
python-version: "3.10"
# - os: "macOS-latest"
# python-version: "3.9"
# include-dgl: false
steps:
- uses: actions/checkout@v3
- name: Build information
run: |
uname -a
df -h
ulimit -a
- name: Install environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: devtools/conda-envs/test_env.yaml
create-args: >-
python=${{ matrix.python-version }}
pydantic=${{ matrix.pydantic-version }}
- name: Install package
run: |
python -m pip install . --no-deps
- name: Python information
run: |
which python
conda info
conda list
- uses: ./.github/actions/include-openeye
if: matrix.include-openeye == true
with:
openeye-license-text: ${{ secrets.OE_LICENSE }}
openeye-license-file: ${{ env.OE_LICENSE }}
- name: Uninstall OpenEye
if: matrix.include-openeye == false
run: conda remove --force openeye --yes || echo "openeye not installed"
- name: Uninstall RDKit
if: matrix.include-rdkit == false
run: conda remove --force rdkit --yes || echo "rdkit not installed"
- name: Uninstall DGL
if: matrix.include-dgl == false
run: conda remove --force dgl --yes || echo "dgl not installed"
- name: Check toolkit installations
shell: bash -l -c "python -u {0}"
run: |
from openff.toolkit.utils.toolkits import OPENEYE_AVAILABLE, RDKIT_AVAILABLE
assert str(OPENEYE_AVAILABLE).lower() == '${{ matrix.include-openeye }}'
assert str(RDKIT_AVAILABLE).lower() == '${{ matrix.include-rdkit }}'
- name: Run tests
run: |
python -m pytest -n 4 -v --cov=openff/nagl --cov-config=setup.cfg --cov-append --cov-report=xml --color=yes openff/nagl/
- name: codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
verbose: True
# name: codecov-${{ matrix.os }}-py${{ matrix.python-version }}
pylint_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install Pylint
run: |
which pip
which python
pip install pylint
- name: Run Pylint
env:
PYLINTRC: .pylintrc
run: |
pylint openff-nagl
pypi_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install setuptools twine
- name: Build package
run: |
python setup.py sdist
- name: Check package build
run: |
DISTRIBUTION=$(ls -t1 dist/openff-nagl-*.tar.gz | head -n 1)
test -n "${DISTRIBUTION}" || { echo "no distribution dist/openff-nagl-*.tar.gz found"; exit 1; }
echo "twine check $DISTRIBUTION"
twine check $DISTRIBUTION
install_from_source_conda:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Install conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
add-pip-as-python-dependency: true
architecture: x64
miniforge-variant: Mambaforge
use-mamba: true
auto-update-conda: true
show-channel-urls: true
channels: conda-forge, defaults
- name: Build from source
run: |
conda create --name openff-nagl
conda activate openff-nagl
conda list
mamba env update --name openff-nagl --file devtools/conda-envs/test_env.yaml
mamba env update --name openff-nagl --file devtools/conda-envs/docs_env.yaml
python --version
python -m pip install . --no-deps
conda list
- name: Check success
run: |
conda activate openff-nagl
python -c "import openff.nagl ; print(openff.nagl.__version__)"