Skip to content

Commit 9b88331

Browse files
committed
Add required jobs for pretrained_model_test.
Signed-off-by: Jay Zhang <[email protected]>
1 parent c0645f2 commit 9b88331

File tree

8 files changed

+320
-110
lines changed

8 files changed

+320
-110
lines changed
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
+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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Unit Test Run
2+
3+
inputs:
4+
tf_version:
5+
description: 'TensorFlow version'
6+
python_version:
7+
description: 'Python version'
8+
ort_version:
9+
description: 'ONNXRuntime version'
10+
onnx_version:
11+
description: 'ONNX version'
12+
opset_version:
13+
description: 'OPSET version'
14+
skip_tflite:
15+
description: 'Skip TFLite tests'
16+
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Set up Python (${{ inputs.python_version }})
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ inputs.python_version }}
24+
25+
- name: Install dependencies (TF-v${{ inputs.tf_version }})
26+
shell: bash
27+
run: |
28+
chmod +x ./tests/utils/setup_test_env.sh
29+
./tests/utils/setup_test_env.sh ${{ inputs.tf_version }} ${{ inputs.ort_version }} ${{ inputs.onnx_version }}
30+
31+
- name: Fix Paths (Windows only)
32+
shell: pwsh
33+
if: runner.os == 'Windows'
34+
run: |
35+
$site_dir = python -c "import site; print(site.getsitepackages()[1])"
36+
echo "##vso[task.prependpath]$site_dir\numpy\.libs"
37+
$base_dir = python -c "import site; print(site.getsitepackages()[0])"
38+
echo "##vso[task.prependpath]$base_dir/Library/bin"
39+
40+
- name: Run pretrained_model_test
41+
run: |
42+
# TODO: fix unity model path
43+
# python tests/run_pretrained_models.py --backend $CI_ONNX_BACKEND --opset $CI_ONNX_OPSET --config tests/unity.yaml || status=$?
44+
python tests/run_pretrained_models.py --backend onnxruntime --opset ${{ inputs.opset_version }} --skip_tf_tests False --skip_tflite_tests ${{ inputs.skip_tflite }} --skip_tfjs_tests True --config tests/run_pretrained_models.yaml || status=$?
45+
ls

.github/actions/unit_test/action.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Unit Test Run
22

33
inputs:
4-
os:
5-
description: 'OS type'
64
tf_version:
75
description: 'TensorFlow version'
86
python_version:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Pretrained Model Test (CI)
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
18+
Test_min_py_with_min_tf: # Do not change this name because it is used in Ruleset of this repo.
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/pretrained_model_test
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: # Do not change this name because it is used in Ruleset of this repo.
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/pretrained_model_test
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:
73+
strategy:
74+
fail-fast: false
75+
matrix:
76+
name:
77+
- 'py38-tf2.13'
78+
- 'py39-tf2.14'
79+
os: ['windows-2022']
80+
opset_version: ['18', '15']
81+
ort_version: ['1.16.3']
82+
onnx_version: ['1.16.1']
83+
skip_tflite: ['False']
84+
include:
85+
- name: 'py38-tf2.13'
86+
tf_version: '2.13.0'
87+
python_version: '3.8'
88+
- name: 'py39-tf2.14'
89+
tf_version: '2.14.0'
90+
python_version: '3.9'
91+
- name: 'py37-tf1.15'
92+
tf_version: '1.15.5'
93+
python_version: '3.7'
94+
os: 'ubuntu-latest'
95+
opset_version: '15'
96+
ort_version: '1.14.1'
97+
onnx_version: '1.14.1'
98+
99+
runs-on: ubuntu-latest
100+
101+
steps:
102+
- name: Checkout code
103+
uses: actions/checkout@v4
104+
105+
- name: Run Tests (Py${{ matrix.python_version }}_TF${{ matrix.tf_version }}_${{ matrix.os }}_${{ matrix.opset_version }}_${{ matrix.ort_version }}_${{ matrix.skip_tflite }})
106+
uses: ./.github/actions/pretrained_model_test
107+
with:
108+
tf_version: ${{ matrix.tf_version }}
109+
python_version: ${{ matrix.python_version }}
110+
ort_version: ${{ matrix.ort_version }}
111+
onnx_version: ${{ matrix.onnx_version }}
112+
opset_version: ${{ matrix.opset_version }}
113+
skip_tflite: ${{ matrix.skip_tflite }}
114+
115+
- name: Upload Test Results
116+
if: always()
117+
uses: actions/upload-artifact@v3
118+
with:
119+
name: Test Results (Py${{ matrix.python_version }}_TF${{ matrix.tf_version }}_${{ matrix.os }}_${{ matrix.opset_version }}_${{ matrix.ort_version }}_${{ matrix.skip_tflite }})
120+
path: ./**/test-results-*.xml
121+
122+
publish-test-results:
123+
name: "Publish Tests Results to Github"
124+
needs: [Test_min_py_with_min_tf, Test_max_py_with_latest_tf, Extra_tests]
125+
runs-on: ubuntu-latest
126+
permissions:
127+
checks: write
128+
pull-requests: write
129+
if: always()
130+
steps:
131+
- name: Download Artifacts
132+
uses: actions/download-artifact@v3
133+
with:
134+
path: artifacts
135+
136+
- name: Publish Test Results
137+
uses: EnricoMi/publish-unit-test-result-action@v2
138+
with:
139+
files: "**/pytest*.xml"

0 commit comments

Comments
 (0)