forked from onnx/onnx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Windows-CI.yml
142 lines (125 loc) · 4.56 KB
/
Windows-CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
schedules:
- cron: '0 0 * * *'
displayName: Nightly Windows CI in main branch
branches:
include:
- main
trigger:
- gh-readonly-queue/**
jobs:
- job: 'Test'
pool:
vmImage: 'windows-2019'
strategy:
matrix:
py312-internal-protobuf:
python.version: '3.12'
onnx_ml: 1
build_type: 'Release'
documentation: 0
protobuf_type: 'Internal'
py311-ml-external-protobuf:
python.version: '3.11'
onnx_ml: 1
onnx_verify_proto: 0
protobuf_type: 'External'
py310_verify_proto_internal_protobuf:
python.version: '3.10'
onnx_ml: 0
onnx_verify_proto: 1
protobuf_type: 'Internal'
py39_ml_external_protobuf:
python.version: '3.9'
onnx_ml: 1
onnx_verify_proto: 0
protobuf_type: 'External'
py38_verify_proto_internal_protobuf:
python.version: '3.8'
onnx_ml: 0
onnx_verify_proto: 1
protobuf_type: 'Internal'
maxParallel: 4
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
displayName: Add conda to PATH
- script: |
conda create --yes --quiet --name py$(python.version) python=$(python.version)
if '$(protobuf_type)' == 'External' (
conda install -n py$(python.version) -y -c conda-forge numpy libprotobuf==3.21.5
) else (
conda install -n py$(python.version) -y -c conda-forge numpy
)
displayName: Create Anaconda environment
- powershell: echo "##vso[task.setvariable variable=CMAKE_PREFIX_PATH]$env:CONDA/envs/py$(python.version)/Library"
displayName: Set CMAKE_PREFIX_PATH
- script: |
call activate py$(python.version)
python -m pip install --upgrade pip
python -m pip install -r requirements-release.txt
git submodule update --init --recursive
set ONNX_BUILD_TESTS=1
set ONNX_ML=$(onnx_ml)
set ONNX_VERIFY_PROTO_3=$(onnx_verify_proto)
if '$(protobuf_type)' == 'External' (
set CMAKE_ARGS=-DONNX_USE_PROTOBUF_SHARED_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DONNX_WERROR=ON
) else (
REM Disable ONNX_WERROR since the new protobuf version has build warnings that are treated as errors.
set CMAKE_ARGS=-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DONNX_USE_LITE_PROTO=ON -DONNX_WERROR=OFF
)
pip install -e ".[reference]" -v
pytest -n auto --dist loadscope
IF NOT %ERRORLEVEL% EQU 0 (
@echo "pytest failed"
EXIT 1
)
python onnx/backend/test/cmd_tools.py generate-data --clean
git status
git diff --exit-code -- . :!onnx/onnx-data.proto :!onnx/onnx-data.proto3 :!*output_*.pb :!*input_*.pb
IF NOT %ERRORLEVEL% EQU 0 (
@echo "git diff for test generation returned failures. Please check updated node test files"
EXIT 1
)
git diff --exit-code --diff-filter=ADR -- . :!onnx/onnx-data.proto :!onnx/onnx-data.proto3
IF NOT %ERRORLEVEL% EQU 0 (
@echo "Test generation returned failures. Please check the number of node test files (input_*.pb or output_*.pb)."
EXIT 1
)
pip uninstall -y pillow
python onnx/backend/test/cmd_tools.py generate-data --clean
git status
git diff --exit-code -- . :!onnx/onnx-data.proto :!onnx/onnx-data.proto3 :!*output_*.pb :!*input_*.pb
IF NOT %ERRORLEVEL% EQU 0 (
@echo "git diff for test generation without pillow returned failures. Please check updated node test files"
EXIT 1
)
rm -rf .setuptools-cmake-build
if '$(protobuf_type)' == 'External' (
conda install -y -c conda-forge libprotobuf=3.20
)
displayName: Install and test ONNX
- script: |
if '$(protobuf_type)' == 'External' (
call activate py$(python.version)
python -m pip install protobuf==3.20.2
set ONNX_BUILD_TESTS=1
set ONNX_ML=$(onnx_ml)
set CMAKE_ARGS=-DONNX_USE_PROTOBUF_SHARED_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DONNX_WERROR=ON
python -m pip install -r requirements-release.txt
pip uninstall -y onnx
pip install .
pytest -n auto --dist loadscope
IF NOT %ERRORLEVEL% EQU 0 (
@echo "pytest failed when testing onnx with libprotobuf=3.20"
EXIT 1
)
) else (
REM Skip the test for externally installing lower version of Protobuf.
)
displayName: Test Protobuf 3.20 from conda-forge