CI: trigger on experimental branch #1386
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: CI | |
on: | |
push: | |
branches: | |
- "master" | |
- "ci-experiments" | |
pull_request: | |
branches: | |
- "master" | |
- "dev" | |
workflow_dispatch: | |
schedule: | |
# every two weeks on Monday at 3 am | |
- cron: "0 3/336 * * 1" | |
jobs: | |
test: | |
name: Pytest | |
runs-on: ${{ matrix.cfg.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
cfg: | |
- os: ubuntu-latest | |
python-version: "3.9" | |
- os: macos-latest | |
python-version: "3.9" | |
- os: windows-latest | |
python-version: "3.9" | |
env: | |
PYVER: ${{ matrix.cfg.python-version }} | |
PACKAGE: teachopencadd | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup Conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.cfg.python-version }} | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: teachopencadd | |
environment-file: devtools/test_env.yml | |
- name: Additional info about the build | |
shell: bash | |
run: | | |
uname -a | |
df -h | |
ulimit -a | |
- name: Install package | |
shell: bash -l {0} | |
run: | | |
pip install . --no-deps -vv | |
- name: Environment Information | |
shell: bash -l {0} | |
run: | | |
conda info --all | |
conda list | |
- name: Test CLI | |
shell: bash -l {0} | |
run: | | |
teachopencadd -h | |
pytest -v --cov=${PACKAGE} --cov-report=xml --color=yes ${PACKAGE}/tests/ | |
- name: Find changed notebooks | |
id: find_changed | |
run: | | |
# Find changed notebooks in the last commit | |
changed_files=$(git diff --name-only ${{ github.sha }}^ ${{ github.sha }} | grep 'talktorial.ipynb$' || true) | |
echo "Changed notebooks: $changed_files" | |
echo "::set-output name=changed_notebooks::$changed_files" | |
- name: Setup environment variables | |
shell: bash -l {0} | |
run: | | |
PYTEST_ARGS="--nbval-lax --current-env --dist loadscope --numprocesses 2" | |
PYTEST_IGNORE_T001="--ignore=teachopencadd/talktorials/T001_query_chembl/talktorial.ipynb" | |
PYTEST_IGNORE_T018="--ignore=teachopencadd/talktorials/T018_automated_cadd_pipeline/talktorial.ipynb" | |
PYTEST_IGNORE_T019="--ignore=teachopencadd/talktorials/T019_md_simulation/talktorial.ipynb" | |
PYTEST_IGNORE_T020="--ignore=teachopencadd/talktorials/T020_md_analysis/talktorial.ipynb" | |
PYTEST_IGNORE_T035="--ignore=teachopencadd/talktorials/T035_graph_neural_networks/talktorial.ipynb" | |
PYTEST_IGNORE_T036="--ignore=teachopencadd/talktorials/T036_e3_equivariant_gnn/talktorial.ipynb" | |
PYTEST_IGNORE_T038="--ignore=teachopencadd/talktorials/T038_protein_ligand_interaction_prediction/talktorial.ipynb" | |
IGNORE="$PYTEST_IGNORE_T001" | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
# Ignore T019 under Windows, see https://github.com/volkamerlab/teachopencadd/issues/313 | |
IGNORE="$IGNORE $PYTEST_IGNORE_T019" | |
IGNORE="$IGNORE $PYTEST_IGNORE_T035" | |
IGNORE="$IGNORE $PYTEST_IGNORE_T036" | |
IGNORE="$IGNORE $PYTEST_IGNORE_T038" | |
fi | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
IGNORE="$IGNORE $PYTEST_IGNORE_T018" # see 385 | |
fi | |
if [ "$RUNNER_OS" == "macOS" ]; then | |
IGNORE="$IGNORE $PYTEST_IGNORE_T018" # see 385 | |
IGNORE="$IGNORE $PYTEST_IGNORE_T019" | |
IGNORE="$IGNORE $PYTEST_IGNORE_T035" # may cause kernel dying in pytest | |
IGNORE="$IGNORE $PYTEST_IGNORE_T036" # may cause kernel dying in pytest | |
fi | |
- name: Test changed notebooks | |
if: steps.find_changed.outputs.changed_notebooks != '' | |
run: | | |
pytest $PYTEST_ARGS ${{ steps.find_changed.outputs.changed_notebooks }} $IGNORE | |
- name: Test all notebooks | |
if: github.event_name == 'schedule' | |
shell: bash -l {0} | |
run: | | |
pytest $PYTEST_ARGS teachopencadd/talktorials/ $IGNORE | |
format: | |
name: Black | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
- name: Install format dependencies | |
run: python -m pip install black-nb shyaml | |
- name: Run black-nb | |
run: | | |
black-nb -l 99 --check teachopencadd/talktorials/T*/talktorial.ipynb | |
readmes: | |
name: READMEs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
- name: Install nbformat | |
run: python -m pip install nbformat shyaml | |
- name: Check READMEs are up-to-date | |
run: | | |
for path in teachopencadd/talktorials/T*/talktorial.ipynb; do | |
python devtools/regenerate_readmes.py --output README.md $path | |
done | |
# If the script above introduced changes (it shouldn't!), git diff will have output and an error code | |
git diff --exit-code |