Skip to content

Commit b01e181

Browse files
committed
Add required jobs for Unit test.
Signed-off-by: Jay Zhang <[email protected]>
1 parent 1528091 commit b01e181

File tree

3 files changed

+132
-104
lines changed

3 files changed

+132
-104
lines changed

.github/actions/prepare_env/action.yml

-53
This file was deleted.

.github/actions/unit_test/action.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Unit Test Run
2+
3+
inputs:
4+
os:
5+
description: 'OS type'
6+
tf_version:
7+
description: 'TensorFlow version'
8+
python_version:
9+
description: 'Python version'
10+
ort_version:
11+
description: 'ONNXRuntime version'
12+
onnx_version:
13+
description: 'ONNX version'
14+
opset_version:
15+
description: 'OPSET version'
16+
skip_tflite:
17+
description: 'Skip TFLite tests'
18+
19+
runs:
20+
using: "composite"
21+
steps:
22+
- name: Set up Python (${{ inputs.python_version }})
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ inputs.python_version }}
26+
27+
- name: Install dependencies (TF-v${{ inputs.tf_version }})
28+
shell: bash
29+
run: |
30+
chmod +x ./tests/utils/setup_test_env.sh
31+
./tests/utils/setup_test_env.sh ${{ inputs.tf_version }} ${{ inputs.ort_version }} ${{ inputs.onnx_version }}
32+
33+
- name: Fix Paths (Windows only)
34+
shell: pwsh
35+
if: runner.os == 'Windows'
36+
run: |
37+
$site_dir = python -c "import site; print(site.getsitepackages()[1])"
38+
echo "##vso[task.prependpath]$site_dir\numpy\.libs"
39+
$base_dir = python -c "import site; print(site.getsitepackages()[0])"
40+
echo "##vso[task.prependpath]$base_dir/Library/bin"
41+
42+
- name: Run unit_test (Linux)
43+
shell: bash
44+
if: runner.os == 'Linux'
45+
run: |
46+
export TF2ONNX_TEST_BACKEND=onnxruntime
47+
export TF2ONNX_TEST_OPSET=${{ inputs.opset_version }}
48+
export TF2ONNX_SKIP_TFLITE_TESTS=${{ inputs.skip_tflite }}
49+
export TF2ONNX_SKIP_TFJS_TESTS=True
50+
export TF2ONNX_SKIP_TF_TESTS=False
51+
python -m pytest --cov=tf2onnx --cov-report=term --disable-pytest-warnings -r s tests --cov-append --junitxml=junit/test-results.xml
52+
ls
53+
54+
- name: Run unit_test (Windows)
55+
shell: pwsh
56+
if: runner.os == 'Windows'
57+
run: |
58+
set TF2ONNX_TEST_BACKEND=onnxruntime
59+
set TF2ONNX_TEST_OPSET=${{ inputs.opset_version }}
60+
set TF2ONNX_SKIP_TFLITE_TESTS=${{ inputs.skip_tflite }}
61+
set TF2ONNX_SKIP_TFJS_TESTS=True
62+
set TF2ONNX_SKIP_TF_TESTS=False
63+
python -m pytest --cov=tf2onnx --cov-report=term --disable-pytest-warnings -r s tests --cov-append --junitxml=junit/test-results.xml
64+
ls

.github/workflows/unit_tests_ci.yml

+68-51
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,80 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17-
run_tests:
17+
18+
Test_min_py_with_min_tf:
19+
strategy:
20+
fail-fast: false
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Run Tests (Py38-TF2.9-18)
28+
uses: ./.github/actions/unit_test_run
29+
with:
30+
os: 'ubuntu-latest'
31+
tf_version: '2.9.0'
32+
python_version: '3.8'
33+
ort_version: '1.16.3'
34+
onnx_version: '1.16.1'
35+
opset_version: '18'
36+
skip_tflite: 'False'
37+
38+
- name: Upload Test Results
39+
if: always()
40+
uses: actions/upload-artifact@v3
41+
with:
42+
name: Test Results (Py38-TF2.9-18-ubuntu)
43+
path: ./**/test-results-*.xml
44+
45+
Test_max_py_with_latest_tf:
46+
strategy:
47+
fail-fast: false
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
54+
- name: Run Tests (Py39-TF2.15-18)
55+
uses: ./.github/actions/unit_test_run
56+
with:
57+
os: 'ubuntu-latest'
58+
tf_version: '2.15.0'
59+
python_version: '3.9'
60+
ort_version: '1.16.3'
61+
onnx_version: '1.16.1'
62+
opset_version: '18'
63+
skip_tflite: 'False'
64+
65+
- name: Upload Test Results
66+
if: always()
67+
uses: actions/upload-artifact@v3
68+
with:
69+
name: Test Results (Py39-TF2.15-18-ubuntu)
70+
path: ./**/test-results-*.xml
71+
72+
Extra_tests:
1873
strategy:
1974
fail-fast: false
2075
matrix:
2176
name:
22-
- 'py38-tf2.9'
2377
- 'py39-tf2.10'
2478
- 'py39-tf2.15'
25-
- 'py310-tf2.15'
26-
os: ['ubuntu-latest', 'windows-2022']
79+
os: ['windows-2022']
2780
opset_version: ['18', '15']
2881
ort_version: ['1.16.3']
2982
onnx_version: ['1.16.1']
3083
skip_tflite: ['False']
3184
include:
32-
- name: 'py38-tf2.9'
33-
tf_version: '2.9.0'
34-
python_version: '3.8'
3585
- name: 'py39-tf2.10'
3686
tf_version: '2.10.0'
3787
python_version: '3.9'
3888
- name: 'py39-tf2.15'
3989
tf_version: '2.15.0'
4090
python_version: '3.9'
41-
- name: 'py310-tf2.15'
42-
tf_version: '2.15.0'
43-
python_version: '3.10'
4491
- name: 'py37-tf1.15'
4592
tf_version: '1.15.5'
4693
python_version: '3.7'
@@ -53,55 +100,25 @@ jobs:
53100
runs-on: ${{ matrix.os }}
54101

55102
steps:
56-
- name: Set up Python (${{ matrix.python_version }})
57-
uses: actions/setup-python@v5
58-
with:
59-
python-version: ${{ matrix.python_version }}
60-
61103
- name: Checkout code
62104
uses: actions/checkout@v4
63105

64-
- name: Install dependencies (TF-v${{ matrix.tf_version }})
65-
shell: bash
66-
run: |
67-
chmod +x ./tests/utils/setup_test_env.sh
68-
./tests/utils/setup_test_env.sh ${{ matrix.tf_version }} ${{ matrix.ort_version }} ${{ matrix.onnx_version }}
69-
70-
- name: Fix Paths (Windows only)
71-
if: runner.os == 'Windows'
72-
run: |
73-
$site_dir = python -c "import site; print(site.getsitepackages()[1])"
74-
echo "##vso[task.prependpath]$site_dir\numpy\.libs"
75-
$base_dir = python -c "import site; print(site.getsitepackages()[0])"
76-
echo "##vso[task.prependpath]$base_dir/Library/bin"
77-
78-
- name: Run unit_test (Linux)
79-
if: runner.os == 'Linux'
80-
run: |
81-
export TF2ONNX_TEST_BACKEND=onnxruntime
82-
export TF2ONNX_TEST_OPSET=${{ matrix.opset_version }}
83-
export TF2ONNX_SKIP_TFLITE_TESTS=${{ matrix.skip_tflite }}
84-
export TF2ONNX_SKIP_TFJS_TESTS=True
85-
export TF2ONNX_SKIP_TF_TESTS=False
86-
python -m pytest --cov=tf2onnx --cov-report=term --disable-pytest-warnings -r s tests --cov-append --junitxml=junit/test-results.xml
87-
ls
88-
89-
- name: Run unit_test (Windows)
90-
if: runner.os == 'Windows'
91-
run: |
92-
set TF2ONNX_TEST_BACKEND=onnxruntime
93-
set TF2ONNX_TEST_OPSET=${{ matrix.opset_version }}
94-
set TF2ONNX_SKIP_TFLITE_TESTS=${{ matrix.skip_tflite }}
95-
set TF2ONNX_SKIP_TFJS_TESTS=True
96-
set TF2ONNX_SKIP_TF_TESTS=False
97-
python -m pytest --cov=tf2onnx --cov-report=term --disable-pytest-warnings -r s tests --cov-append --junitxml=junit/test-results.xml
98-
ls
106+
- name: Run Tests (Py${{ matrix.python_version }}_TF${{ matrix.tf_version }}_${{ matrix.os }}_${{ matrix.opset_version }}_${{ matrix.ort_version }}_${{ matrix.skip_tflite }})
107+
uses: ./.github/actions/unit_test
108+
with:
109+
os: ${{ matrix.os }}
110+
tf_version: ${{ matrix.tf_version }}
111+
python_version: ${{ matrix.python_version }}
112+
ort_version: ${{ matrix.ort_version }}
113+
onnx_version: ${{ matrix.onnx_version }}
114+
opset_version: ${{ matrix.opset_version }}
115+
skip_tflite: ${{ matrix.skip_tflite }}
99116

100117
- name: Upload Test Results
101118
if: always()
102119
uses: actions/upload-artifact@v3
103120
with:
104-
name: Test Results (${{ matrix.tf_version }}-${{ matrix.python_version }}-${{ matrix.os }})
121+
name: Test Results (Py${{ matrix.python_version }}_TF${{ matrix.tf_version }}_${{ matrix.os }}_${{ matrix.opset_version }}_${{ matrix.ort_version }}_${{ matrix.skip_tflite }})
105122
path: ./**/test-results-*.xml
106123

107124
publish-test-results:

0 commit comments

Comments
 (0)