Skip to content

Commit 20917e4

Browse files
nhuetducoffeM
authored andcommitted
Test autolirpa comparison in a separate tox env
- Add autolirpa option in github action matrix - Add autolirpa option in tox envs - Launch autolirpa tests in the dedicated env - Launch all other tests in the regular env
1 parent 91c5943 commit 20917e4

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

.github/workflows/python-tests.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ jobs:
6565
python-version: ["3.9", "3.11"]
6666
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
6767
backend: ["tf", "torch", "jax"]
68+
autolirpa: [ "", "autolirpa" ]
69+
exclude:
70+
- backend: "tf"
71+
autolirpa: "autolirpa"
72+
- backend: "jax"
73+
autolirpa: "autolirpa"
6874
runs-on: ${{ matrix.os }}
6975
defaults:
7076
run:
@@ -103,13 +109,17 @@ jobs:
103109
platformversion=platform_mapping[platform.system()]
104110
toxenv = f"{pythonversion}-{platformversion}"
105111
toxenv += "-${{ matrix.backend }}"
112+
if "${{ matrix.autolirpa }}" == "autolirpa":
113+
toxenv += "-autolirpa"
106114
set_toxenv_cmd = f"TOXENV={toxenv}"
107115
print(f"Picked: {toxenv}")
108116
with Path(os.environ["GITHUB_ENV"]).open("ta") as file_handler:
109117
file_handler.write(set_toxenv_cmd)
110118
- name: Run tox target env for ${{ env.TOXENV }}
111119
run: |
112-
python -m tox -e convert-doc-to-test # extract code blocks from doc to test them
120+
if [[ "${{ matrix.autolirpa }}" != "autolirpa" ]]; then
121+
python -m tox -e convert-doc-to-test # extract code blocks from doc to test them
122+
fi
113123
# set default torch device to cpu if on macos-latest to avois mps-related errors
114124
export KERAS_TORCH_DEVICE=cpu
115125
python -m tox # launch environment set by TOXENV at previous step

tox.ini

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ envlist =
55
pre-commit
66
convert-doc-to-test
77
type
8-
py{39,311}-{linux,macos,win}-{tf,torch,jax}
8+
py{39,311}-{linux,macos,win}-{tf,torch,jax}{-autolirpa,}
99

1010
[testenv]
1111
platform = linux: linux
@@ -18,7 +18,7 @@ deps =
1818
tf: tensorflow>=2.16 # backend for keras 3
1919
torch: torch>=2.1.0 # backend for keras 3
2020
jax: jax>=0.4.20 # backend for keras 3
21-
torch: auto_LiRPA@git+https://github.com/ducoffeM/auto_LiRPA # comparison to autolirpa
21+
autolirpa: auto_LiRPA@git+https://github.com/ducoffeM/auto_LiRPA # comparison to autolirpa
2222

2323
passenv =
2424
macos-torch: KERAS_TORCH_DEVICE
@@ -30,11 +30,12 @@ commands =
3030
pip list
3131
python -c 'import keras; print(keras.config.backend())'
3232
pytest -v \
33-
!torch: --ignore tests/autolirpa \
3433
py39-linux-tf: --cov decomon \
3534
py39-linux-tf: --cov-report xml:coverage.xml \
3635
py39-linux-tf: --cov-report html:coverage_html \
3736
py39-linux-tf: --cov-report term \
37+
!autolirpa: --ignore tests/autolirpa \
38+
autolirpa: tests/autolirpa \
3839
{posargs}
3940
description =
4041
pytest environment

0 commit comments

Comments
 (0)