forked from onnx/onnx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLinux-CI.yml
154 lines (135 loc) · 4.8 KB
/
Linux-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
143
144
145
146
147
148
149
150
151
152
153
154
# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
schedules:
- cron: '0 0 * * *'
displayName: Nightly Linux CI in main branch
branches:
include:
- main
trigger:
- gh-readonly-queue/**
jobs:
- job: 'Test'
pool:
vmImage: 'Ubuntu-20.04'
strategy:
matrix:
py312-internal-protobuf:
python.version: '3.12'
onnx_ml: 1
build_type: 'Release'
documentation: 0
protobuf_type: 'Internal'
py311-ml-debug-external-protobuf:
python.version: '3.11'
onnx_ml: 1
build_type: 'Debug'
documentation: 0
protobuf_type: 'External'
py310-internal-protobuf:
python.version: '3.10'
onnx_ml: 0
build_type: 'Release'
documentation: 0
protobuf_type: 'Internal'
py39-ml-doc-external-protobuf:
python.version: '3.9'
onnx_ml: 1
build_type: 'Release'
documentation: 1
protobuf_type: 'External'
py38-internal-protobuf:
python.version: '3.8'
onnx_ml: 0
build_type: 'Release'
documentation: 0
protobuf_type: 'Internal'
maxParallel: 4
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
addToPath: true
- script: |
python -m pip -q install virtualenv
python -m virtualenv venv
source venv/bin/activate
if [ '$(protobuf_type)' == 'External' ]; then
sudo apt-get install libprotobuf-dev protobuf-compiler
elif [ '$(protobuf_type)' == 'Internal' ]; then
echo "Use the internal protobuf build"
fi
python -m pip install --upgrade pip
python -m pip install -r requirements-release.txt
# still test protobuf==3.20.2 at least in a CI
python -m pip install protobuf==3.20.2
sudo apt-get install -qq -o=Dpkg::Use-Pty=0 -y --no-install-recommends dos2unix
git submodule update --init --recursive
export ONNX_BUILD_TESTS=1
if [ '$(build_type)' == 'Debug' ]; then
export DEBUG=1
fi
if [ '$(onnx_ml)' == '1' ]; then
export ONNX_ML=1
fi
export CMAKE_ARGS="-DONNX_WERROR=ON -DONNX_USE_PROTOBUF_SHARED_LIBS=ON"
# Enable more sanitizers
export CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_CXX_FLAGS='-fsanitize=undefined -fno-sanitize-recover=all '"
pip install -e ".[reference]" -v
displayName: 'Install ONNX and dependencies'
- script: |
source venv/bin/activate
pytest -sv --cov=onnx --cov-report=xml --cov-append --cov-branch --junit-xml pytest.xml -n auto --dist loadscope
if [ $? -ne 0 ]; then
echo "pytest failed"
exit 1
fi
# onnx c++ API tests
export LD_LIBRARY_PATH="./.setuptools-cmake-build/:$LD_LIBRARY_PATH"
./.setuptools-cmake-build/onnx_gtests
if [ $? -ne 0 ]; then
echo "onnx_gtests failed"
exit 1
fi
displayName: 'Run ONNX tests'
- script: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov
continueOnError: true
displayName: 'Upload to codecov'
- script: |
source venv/bin/activate
python onnx/backend/test/cmd_tools.py generate-data --clean
git status
# Skip *output_*.pb because NumPy functions might behave differently on different platforms
# Skip test_log's input.pb because it uses np.random, which might behave differently on different platforms
git diff --exit-code -- . ':!onnx/onnx-data.proto' ':!onnx/onnx-data.proto3' ':!*output_*.pb' ':!*input_*.pb'
if [ $? -ne 0 ]; then
echo "git diff for test generation returned failures. Please check updated node test files"
exit 1
fi
git diff --exit-code --diff-filter=ADR -- . ':!onnx/onnx-data.proto' ':!onnx/onnx-data.proto3'
if [ $? -ne 0 ]; then
echo "Test generation returned failures. Please check the number of node test files (input_*.pb or output_*.pb)"
exit 1
fi
pip uninstall -y pillow
python onnx/backend/test/cmd_tools.py generate-data --clean
git status
# Verify test generation without pillow for ImageDecoder, it should directly use frozen data
git diff --exit-code -- . ':!onnx/onnx-data.proto' ':!onnx/onnx-data.proto3' ':!*output_*.pb' ':!*input_*.pb'
if [ $? -ne 0 ]; then
echo "git diff for test generation without pillow returned failures. Please check updated node test files"
exit 1
fi
displayName: Test backend test data
- script: |
if [ '$(documentation)' == '1' ]; then
source venv/bin/activate
pip install -r docs/docsgen/source/requirements.txt
cd docs/docsgen && make text
fi
displayName: Test documentation
continueOnError: true # the documentation generates errors due to operators documentation