-
Notifications
You must be signed in to change notification settings - Fork 88
165 lines (142 loc) · 5.5 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: CI
on:
push:
branches:
- "master"
- "maintenance/.*"
pull_request:
branches:
- "master"
- "maintenance/.*"
schedule:
# Nightly tests run on master by default:
# Scheduled workflows run on the latest commit on the default or base branch.
# (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule)
- cron: "0 0 * * *"
defaults:
run:
shell: bash -l {0}
jobs:
test:
if: (github.event_name == 'schedule' && github.repository == 'openforcefield/openff-toolkit') || (github.event_name != 'schedule')
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }}, RDKit=${{ matrix.rdkit }}, OpenEye=${{ matrix.openeye }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.7, 3.8, 3.9]
rdkit: [true, false]
openeye: [true, false]
exclude:
- rdkit: false
openeye: false
- openeye: true
python-version: 3.8
- openeye: true
python-version: 3.9
env:
OE_LICENSE: ${{ github.workspace }}/oe_license.txt
PACKAGE: openff
PYTEST_ARGS: -r fE --tb=short --cov=openff --cov-config=setup.cfg --cov-append --cov-report=xml
NB_ARGS: -v --nbval-lax --ignore=examples/deprecated
steps:
- uses: actions/checkout@v2.4.0
with:
fetch-depth: 2
- name: Set environment variables
run: |
if [[ ${{ matrix.openeye }} == true && ${{ matrix.rdkit }} == true ]]; then
echo "ENVFILE=test_env" >> $GITHUB_ENV
echo "JOBNAME=RDKit and OpenEye" >> $GITHUB_ENV
echo "TOOLKIT_CHECKS=RDKIT OPENEYE" >> $GITHUB_ENV
echo "PACKAGES_TO_REMOVE=" >> $GITHUB_ENV
fi
if [[ ${{ matrix.openeye }} == true && ${{ matrix.rdkit }} == false ]]; then
echo "ENVFILE=openeye" >> $GITHUB_ENV
echo "JOBNAME=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 "JOBNAME=RDKit" >> $GITHUB_ENV
echo "TOOLKIT_CHECKS=RDKIT" >> $GITHUB_ENV
echo "PACKAGES_TO_REMOVE=openeye-toolkits" >> $GITHUB_ENV
fi
- name: Install environment with ${{ env.JOBNAME }}
uses: conda-incubator/setup-miniconda@v2.1.1
with:
python-version: ${{ matrix.cfg.python-version }}
activate-environment: test
environment-file: devtools/conda-envs/${{ env.ENVFILE }}.yaml
auto-activate-base: false
miniforge-version: latest
miniforge-variant: Mambaforge
use-mamba: true
- name: Additional info about the build
run: |
uname -a
df -h
ulimit -a
- name: Make oe_license.txt file from GH org secret "OE_LICENSE"
shell: bash
env:
OE_LICENSE_TEXT: ${{ secrets.OE_LICENSE }}
run: |
echo "${OE_LICENSE_TEXT}" > ${OE_LICENSE}
- name: Install package
run: |
conda remove --force openff-toolkit openff-toolkit-base
python setup.py develop --no-deps
- name: Install test plugins
run: |
cd utilities/test_plugins
python setup.py develop --no-deps
- name: Remove undesired toolkits
run: |
if [ ! -z "${{ env.PACKAGES_TO_REMOVE }}" ]; then
for cpkg in ${{ env.PACKAGES_TO_REMOVE }}; do
if [[ $(conda list | grep $cpkg) ]]; then conda 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
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
- name: Environment Information
run: |
conda info
conda list
- name: Check links
if: ${{ matrix.rdkit == true && matrix.openeye == true }}
run: pytest -r fE --tb=short openff/toolkit/tests/test_links.py
- name: Run mypy
if: ${{ matrix.rdkit == true && matrix.openeye == true }}
run: mypy --namespace-packages -p "openff.toolkit"
- name: Run unit tests
run: |
PYTEST_ARGS+=" --ignore=openff/toolkit/tests/test_examples.py"
PYTEST_ARGS+=" --ignore=openff/toolkit/tests/test_links.py"
if [[ "$GITHUB_EVENT_NAME" == "schedule" ]]; then
PYTEST_ARGS+=" --runslow"
fi
pytest $PYTEST_ARGS openff/toolkit/tests/
- name: Run code snippets in docs
if: ${{ matrix.rdkit == true && matrix.openeye == true }}
run: |
pytest -v --doctest-glob="docs/*.rst" docs/
- name: Codecov
uses: codecov/codecov-action@v2.1.0
with:
file: ./coverage.xml
fail_ci_if_error: true