Unit tests #1432
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Unit tests" | |
on: | |
pull_request: | |
branches: | |
- master | |
- stable | |
push: | |
branches: | |
- master | |
tags: | |
- "v*" | |
schedule: | |
- cron: "20 5 * * *" | |
defaults: | |
run: | |
shell: bash -l {0} | |
jobs: | |
test_suite: | |
runs-on: ${{ matrix.OS }}-latest | |
name: "Unit Tests" | |
strategy: | |
matrix: | |
CONDA_PY: | |
- 3.9 | |
- 3.8 | |
- 3.7 | |
OS: ["ubuntu"] | |
MDTRAJ: ["mdtraj-release"] | |
INSTALL_WITH: ["pip"] | |
include: | |
- CONDA_PY: 3.9 | |
OS: "ubuntu" | |
MDTRAJ: "mdtraj-dev" | |
INSTALL_WITH: "pip" | |
- CONDA_PY: 3.9 | |
OS: "windows" | |
MDTRAJ: "mdtraj-release" | |
INSTALL_WITH: "conda" | |
- CONDA_PY: 3.7 | |
OS: "windows" | |
MDTRAJ: "mdtraj-release" | |
INSTALL_WITH: "conda" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- uses: actions/setup-python@v2 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.CONDA_PY }} | |
- name: "Create requirements files" | |
run: python ci/extract_requirements.py | |
- name: "Install dependencies" | |
env: | |
INSTALL_WITH: ${{ matrix.INSTALL_WITH }} | |
run: | | |
# this trick only works as long as PyPI & conda-forge use same | |
# package names | |
if [ "$INSTALL_WITH" = "pip" ]; then | |
source ci/pip-pre-install.sh | |
INSTALLER_FLAGS="-U -r" | |
elif [ "$INSTALL_WITH" = "conda" ]; then | |
INSTALLER_FLAGS="-c conda-forge --file" | |
else | |
echo "Bad value for INSTALL_WITH: $INSTALL_WITH" | |
exit 1 | |
fi | |
$INSTALL_WITH install $INSTALLER_FLAGS requirements.txt | |
# have to pip-install testing until autorelease on conda | |
pip install -U -r extras_test.txt | |
- name: "Install MDTraj development version (pip)" | |
if: ${{ matrix.MDTRAJ == 'mdtraj-dev' }} | |
run: pip install --upgrade --force-reinstall -r ci/mdtraj_dev.txt | |
- name: "Install optional extras (pip)" | |
# we only use this with pip, but in principle it could be converted | |
# to something that also uses conda | |
if: ${{ matrix.MDTRAJ == 'mdtraj-dev' }} | |
run: pip install -r extras_all.txt | |
- name: "Install contact_map" | |
run: pip install -e . | |
- name: "Versions" | |
env: | |
INSTALL_WITH: ${{ matrix.INSTALL_WITH }} | |
run: | | |
$INSTALL_WITH list | |
- name: "Autorelease check" | |
run: python autorelease_check.py | |
- name: "Tests" | |
env: | |
PY_COLORS: "1" | |
run: | | |
python -c "import contact_map" | |
py.test -vv --cov=contact_map --cov-report xml | |
- uses: codecov/codecov-action@v2 | |
if: ${{ github.event != 'schedule' }} |