1
1
name : Tests
2
2
3
+ # TODO: Consider enabling all tests (pytest, applications, etc.) with NNX in the future
4
+ # Currently only basic flow tests run with NNX enabled
5
+
3
6
on :
4
7
push :
5
8
branches : [ master ]
17
20
matrix :
18
21
python-version : ['3.10']
19
22
backend : [tensorflow, jax, torch, numpy, openvino]
20
- name : Run tests
23
+ nnx_enabled : [false]
24
+ include :
25
+ - python-version : ' 3.10'
26
+ backend : jax
27
+ nnx_enabled : true
28
+ name : ${{ matrix.backend == 'jax' && format('Run tests ({0}, {1}, nnx_enabled = {2})', matrix.python-version, matrix.backend, matrix.nnx_enabled) || format('Run tests ({0}, {1})', matrix.python-version, matrix.backend) }}
21
29
runs-on : ubuntu-latest
22
30
env :
23
31
PYTHON : ${{ matrix.python-version }}
@@ -48,15 +56,18 @@ jobs:
48
56
- name : Install dependencies
49
57
run : |
50
58
pip install -r requirements.txt --progress-bar off --upgrade
59
+ if [ "${{ matrix.nnx_enabled }}" == "true" ]; then
60
+ pip install --upgrade git+https://github.com/google/flax.git
61
+ fi
51
62
pip uninstall -y keras keras-nightly
52
63
pip install -e "." --progress-bar off --upgrade
53
64
- name : Test applications with pytest
54
- if : ${{ steps.filter.outputs.applications == 'true' }}
65
+ if : ${{ steps.filter.outputs.applications == 'true' && matrix.nnx_enabled == false }}
55
66
run : |
56
67
pytest keras/src/applications --cov=keras/src/applications --cov-config=pyproject.toml
57
68
coverage xml --include='keras/src/applications/*' -o apps-coverage.xml
58
69
- name : Codecov keras.applications
59
- if : ${{ steps.filter.outputs.applications == 'true' }}
70
+ if : ${{ steps.filter.outputs.applications == 'true' && matrix.nnx_enabled == false }}
60
71
uses : codecov/codecov-action@v5
61
72
with :
62
73
env_vars : PYTHON,KERAS_HOME
@@ -65,14 +76,21 @@ jobs:
65
76
token : ${{ secrets.CODECOV_TOKEN }}
66
77
fail_ci_if_error : false
67
78
- name : Test integrations
68
- if : ${{ matrix.backend != 'numpy'}}
79
+ if : ${{ matrix.backend != 'numpy' && matrix.nnx_enabled == false }}
69
80
run : |
70
81
python integration_tests/import_test.py
71
82
python integration_tests/numerical_test.py
72
83
- name : Test JAX-specific integrations
73
- if : ${{ matrix.backend == 'jax'}}
84
+ if : ${{ matrix.backend == 'jax' && matrix.nnx_enabled == false }}
74
85
run : |
75
86
python integration_tests/jax_custom_fit_test.py
87
+ - name : Test basic flow with NNX
88
+ if : ${{ matrix.nnx_enabled == true }}
89
+ env :
90
+ KERAS_NNX_ENABLED : true
91
+ run : |
92
+ python integration_tests/import_test.py
93
+ python integration_tests/basic_full_flow.py
76
94
- name : Test TF-specific integrations
77
95
if : ${{ matrix.backend == 'tensorflow'}}
78
96
run : |
84
102
pytest integration_tests/torch_workflow_test.py
85
103
python integration_tests/torch_custom_fit_test.py
86
104
- name : Test with pytest
105
+ if : ${{ matrix.nnx_enabled == false }}
87
106
run : |
88
107
if [ "${{ matrix.backend }}" == "openvino" ]; then
89
108
IGNORE_FILE="keras/src/backend/openvino/excluded_tests.txt"
@@ -94,10 +113,11 @@ jobs:
94
113
pytest keras --ignore keras/src/applications --cov=keras --cov-config=pyproject.toml $IGNORE_ARGS
95
114
coverage xml --omit='keras/src/applications/*,keras/api' -o core-coverage.xml
96
115
- name : Codecov keras
116
+ if : ${{ matrix.nnx_enabled == false }}
97
117
uses : codecov/codecov-action@v5
98
118
with :
99
- env_vars : PYTHON,KERAS_HOME
100
- flags : keras,keras-${{ matrix.backend }}
119
+ env_vars : PYTHON,KERAS_HOME,KERAS_NNX_ENABLED
120
+ flags : keras,keras-${{ matrix.backend }}${{ matrix.nnx_enabled == 'true' && '-nnx' || '' }}
101
121
files : core-coverage.xml
102
122
token : ${{ secrets.CODECOV_TOKEN }}
103
123
fail_ci_if_error : false
0 commit comments