Skip to content

Commit

Permalink
Splits tests according to their environments in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgondu committed Jul 11, 2024
1 parent 3332231 commit a0b7b19
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests on poli (dev, conda, python 3.9)
name: poli base (dev, conda, python 3.9)

on: [push]

Expand All @@ -24,6 +24,6 @@ jobs:
- name: Test linting with tox
run: |
tox -c tox.ini -e lint
- name: Test poli-base with tox (ignoring RaSP)
- name: Test basic behaviors of poli with tox and pytest
run: |
tox -c tox.ini -e poli-base-py39 -- --ignore=src/poli/tests/registry/proteins/test_rasp.py
tox -c tox.ini -e poli-base-py39
26 changes: 26 additions & 0 deletions .github/workflows/python-tox-testing-dockstring-env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: poli dockstring (dev, conda, python 3.9)

on: [push]

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
python -m pip install tox
- name: Test dockstring-related black boxes with tox and pytest
run: |
tox -c tox.ini -e poli-dockstring-py39
26 changes: 26 additions & 0 deletions .github/workflows/python-tox-testing-lambo-env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: poli lambo (dev, conda, python 3.9)

on: [push]

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
python -m pip install tox
- name: Test lambo-related black boxes with tox and pytest
run: |
tox -c tox.ini -e poli-lambo-py39
26 changes: 26 additions & 0 deletions .github/workflows/python-tox-testing-protein-env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: poli protein (dev, conda, python 3.9)

on: [push]

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
python -m pip install tox
- name: Test protein-related black boxes with tox and pytest
run: |
tox -c tox.ini -e poli-protein-py39
26 changes: 26 additions & 0 deletions .github/workflows/python-tox-testing-tdc-env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: poli tdc (dev, conda, python 3.9)

on: [push]

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
python -m pip install tox
- name: Test PyTDC-related black boxes with tox and pytest
run: |
tox -c tox.ini -e poli-tdc-py39
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ markers = [
"poli__tdc: marks tests that run in the poli__tdc environment",
"poli__protein: marks tests that run in the poli__protein environment",
"poli__rasp: marks tests that run in the poli__rasp environment",
"unmarked: All unmarked tests",
"unmarked: All other tests, which usually run in the base environment",
]
97 changes: 76 additions & 21 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
env_list =
lint
poli-base-py39
poli-dockstring-py39
poli-tdc-py39
poli-protein-py39
poli-rasp-py39
minversion = 4.10.0

[testenv]
Expand All @@ -15,27 +19,6 @@ deps =
commands =
sh -c "rm -rf ~/.poli_objectives/*.sh"
sh -c "rm -rf ~/.poli_objectives/config.rc"
sh -c 'if conda info --envs | grep -q poli__base; then echo "poli__base already exists"; else conda env create -f ./src/poli/objective_repository/aloha/environment.yml; fi'
sh -c "conda run -n poli__base python -m pip uninstall -y poli"
sh -c "conda run -n poli__base python -m pip install -e ."
sh -c 'if conda info --envs | grep -q poli__chem; then echo "poli__chem already exists"; else conda env create -f ./src/poli/objective_repository/rdkit_qed/environment.yml; fi'
sh -c "conda run -n poli__chem python -m pip uninstall -y poli"
sh -c "conda run -n poli__chem python -m pip install -e ."
sh -c 'if conda info --envs | grep -q poli__protein; then echo "poli__protein already exists"; else conda env create -f ./src/poli/objective_repository/foldx_stability/environment.yml; fi'
sh -c "conda run -n poli__protein python -m pip uninstall -y poli"
sh -c "conda run -n poli__protein python -m pip install -e ."
sh -c 'if conda info --envs | grep -q poli__dockstring; then echo "poli__dockstring already exists"; else conda env create -f ./src/poli/objective_repository/dockstring/environment.yml; fi'
sh -c "conda run -n poli__dockstring python -m pip uninstall -y poli"
sh -c "conda run -n poli__dockstring python -m pip install -e ."
sh -c 'if conda info --envs | grep -q poli__tdc; then echo "poli__tdc already exists"; else conda env create -f ./src/poli/core/chemistry/environment.yml; fi'
sh -c "conda run -n poli__tdc python -m pip uninstall -y poli"
sh -c "conda run -n poli__tdc python -m pip install -e ."
sh -c 'if conda info --envs | grep -q poli__lambo; then echo "poli__lambo already exists"; else conda env create -f ./src/poli/objective_repository/foldx_rfp_lambo/environment.yml; fi'
sh -c "conda run -n poli__lambo python -m pip uninstall -y poli"
sh -c "conda run -n poli__lambo python -m pip install -e ."
pytest {tty:--color=yes} -v -m "not slow" {posargs}
sh -c "rm -rf ~/.poli_objectives/*.sh"
sh -c "rm -rf ~/.poli_objectives/config.rc"

[testenv:lint]
description = check the code style with black
Expand All @@ -54,3 +37,75 @@ deps=
-e.
commands=
{[testenv]commands}
pytest {tty:--color=yes} -v -m "unmarked" {posargs}

[testenv:poli-tdc-py39]
description = run the tests with pytest on the TDC environment for poli
basepython = python3.9
wheel_build_env = .pkg
deps=
{[testenv]deps}
-r requirements.txt
-e.
commands=
sh -c 'if conda info --envs | grep -q poli__tdc; then echo "poli__tdc already exists"; else conda env create -f ./src/poli/core/chemistry/environment.yml; fi'
sh -c "conda run -n poli__tdc python -m pip uninstall -y poli"
sh -c "conda run -n poli__tdc python -m pip install -e ."
pytest {tty:--color=yes} -v -m "not slow and poli__tdc" {posargs}

[testenv:poli-protein-py39]
description = run the tests with pytest on the protein environment for poli
basepython = python3.9
wheel_build_env = .pkg
deps=
{[testenv]deps}
-r requirements.txt
-e.
commands=
sh -c 'if conda info --envs | grep -q poli__protein; then echo "poli__protein already exists"; else conda env create -f ./src/poli/objective_repository/foldx_stability/environment.yml; fi'
sh -c "conda run -n poli__protein python -m pip uninstall -y poli"
sh -c "conda run -n poli__protein python -m pip install -e ."
pytest {tty:--color=yes} -v -m "not slow and poli__protein" {posargs}

[testenv:poli-lambo-py39]
description = run the tests with pytest on the lambo environment for poli
basepython = python3.9
wheel_build_env = .pkg
deps=
{[testenv]deps}
-r requirements.txt
-e.
commands=
sh -c 'if conda info --envs | grep -q poli__lambo; then echo "poli__lambo already exists"; else conda env create -f ./src/poli/objective_repository/foldx_rfp_lambo/environment.yml; fi'
sh -c "conda run -n poli__lambo python -m pip uninstall -y poli"
sh -c "conda run -n poli__lambo python -m pip install -e ."
pytest {tty:--color=yes} -v -m "not slow and poli__lambo" {posargs}

[testenv:poli-dockstring-py39]
description = run the tests with pytest on the dockstring environment for poli
basepython = python3.9
wheel_build_env = .pkg
deps=
{[testenv]deps}
-r requirements.txt
-e.
commands=
sh -c 'if conda info --envs | grep -q poli__dockstring; then echo "poli__dockstring already exists"; else conda env create -f ./src/poli/objective_repository/dockstring/environment.yml; fi'
sh -c "conda run -n poli__dockstring python -m pip uninstall -y poli"
sh -c "conda run -n poli__dockstring python -m pip install -e ."
pytest {tty:--color=yes} -v -m "not slow and poli__dockstring" {posargs}

[testenv:poli-rasp-py39]
description = run the tests with pytest on the dockstring environment for poli
basepython = python3.9
wheel_build_env = .pkg
deps=
{[testenv]deps}
-r requirements.txt
-e.
commands=
sh -c 'if conda info --envs | grep -q poli__rasp; then echo "poli__rasp already exists"; else conda env create -f ./src/poli/objective_repository/rasp/environment.yml; fi'
sh -c "conda run -n poli__rasp python -m pip uninstall -y poli"
sh -c "conda run -n poli__rasp python -m pip install -e ."
pytest {tty:--color=yes} -v -m "not slow and poli__rasp" {posargs}

0 comments on commit a0b7b19

Please sign in to comment.