@@ -49,18 +49,6 @@ stages:
49
49
- job : Pytest
50
50
strategy :
51
51
matrix :
52
- Linux_py310 :
53
- vmImage : ' ubuntu-20.04' # keep one job pinned to the oldest image
54
- python.version : ' 3.10'
55
- Linux_py311 :
56
- vmImage : ' ubuntu-latest'
57
- python.version : ' 3.11'
58
- macOS_py310 :
59
- vmImage : ' macOS-latest'
60
- python.version : ' 3.10'
61
- macOS_py311 :
62
- vmImage : ' macOS-latest'
63
- python.version : ' 3.11'
64
52
Windows_py310 :
65
53
vmImage : ' windows-2019' # keep one job pinned to the oldest image
66
54
python.version : ' 3.10'
@@ -78,63 +66,7 @@ stages:
78
66
displayName : ' Use Python $(python.version)'
79
67
80
68
- bash : |
81
- set -e
82
- case "$AGENT_OS" in
83
- Linux)
84
- echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries
85
- sudo apt update
86
- sudo apt install --no-install-recommends \
87
- cm-super \
88
- dvipng \
89
- ffmpeg \
90
- fonts-freefont-otf \
91
- fonts-noto-cjk \
92
- fonts-wqy-zenhei \
93
- gdb \
94
- gir1.2-gtk-3.0 \
95
- graphviz \
96
- inkscape \
97
- language-pack-de \
98
- lcov \
99
- libcairo2 \
100
- libgirepository-1.0-1 \
101
- lmodern \
102
- ninja-build \
103
- poppler-utils \
104
- texlive-fonts-recommended \
105
- texlive-latex-base \
106
- texlive-latex-extra \
107
- texlive-latex-recommended \
108
- texlive-luatex \
109
- texlive-pictures \
110
- texlive-xetex
111
- ;;
112
- Darwin)
113
- brew update
114
- # Periodically, Homebrew updates Python and fails to overwrite the
115
- # existing not-managed-by-Homebrew copy without explicitly being told
116
- # to do so. GitHub/Azure continues to avoid fixing their runner images:
117
- # https://github.com/actions/runner-images/issues/9966
118
- # so force an overwrite even if there are no Python updates.
119
- # We don't even care about Homebrew's Python because we use the one
120
- # from UsePythonVersion.
121
- for python_package in $(brew list | grep python@); do
122
- brew unlink ${python_package}
123
- brew link --overwrite ${python_package}
124
- done
125
- # Workaround for https://github.com/actions/runner-images/issues/10984
126
- brew uninstall --ignore-dependencies --force [email protected]
127
- brew install --cask xquartz
128
- brew install ccache ffmpeg imagemagick mplayer ninja pkg-config
129
- brew install --cask font-noto-sans-cjk-sc
130
- ;;
131
- Windows_NT)
132
- choco install ninja
133
- ;;
134
- *)
135
- exit 1
136
- ;;
137
- esac
69
+ choco install ninja
138
70
displayName: 'Install dependencies'
139
71
140
72
- bash : |
@@ -144,23 +76,9 @@ stages:
144
76
displayName: 'Install dependencies with pip'
145
77
146
78
- bash : |
147
- case "$AGENT_OS" in
148
- Linux)
149
- export CPPFLAGS='--coverage -fprofile-abs-path'
150
- ;;
151
- Darwin)
152
- export CPPFLAGS='-fprofile-instr-generate=default.%m.profraw'
153
- export CPPFLAGS="$CPPFLAGS -fcoverage-mapping"
154
- ;;
155
- Windows_NT)
156
- CONFIG='--config-settings=setup-args=--vsenv'
157
- CONFIG="$CONFIG --config-settings=setup-args=-Dcpp_link_args=-PROFILE"
158
- CONFIG="$CONFIG --config-settings=setup-args=-Dbuildtype=debug"
159
- ;;
160
- *)
161
- exit 1
162
- ;;
163
- esac
79
+ CONFIG='--config-settings=setup-args=--vsenv'
80
+ CONFIG="$CONFIG --config-settings=setup-args=-Dcpp_link_args=-PROFILE"
81
+ CONFIG="$CONFIG --config-settings=setup-args=-Dbuildtype=debug"
164
82
165
83
python -m pip install \
166
84
--no-build-isolation $CONFIG \
@@ -175,39 +93,38 @@ stages:
175
93
176
94
- bash : |
177
95
set -e
178
- if [[ "$AGENT_OS" == 'Windows_NT' ]]; then
179
- SESSION_ID=$(python -c "import uuid; print(uuid.uuid4(), end='')")
180
- echo "Coverage session ID: ${SESSION_ID}"
181
- VS=$(ls -d /c/Program\ Files*/Microsoft\ Visual\ Studio/*/Enterprise)
182
- echo "Visual Studio: ${VS}"
183
- DIR="$VS/Common7/IDE/Extensions/Microsoft/CodeCoverage.Console"
184
- if [[ -d $DIR ]]; then
185
- # This is for MSVC 2022 (on windows-latest).
186
- TOOL="$DIR/Microsoft.CodeCoverage.Console.exe"
187
- for f in build/cp*/src/*.pyd; do
188
- echo $f
189
- echo "=============================="
190
- "$TOOL" instrument $f --session-id $SESSION_ID \
191
- --log-level Verbose --log-file instrument.log
192
- cat instrument.log
193
- rm instrument.log
194
- done
195
- echo "Starting $TOOL in server mode"
196
- "$TOOL" collect \
197
- --session-id $SESSION_ID --server-mode \
198
- --output-format cobertura --output extensions.xml \
199
- --log-level Verbose --log-file extensions.log &
200
- VS_VER=2022
201
- else
202
- DIR="$VS"/Team\ Tools/Dynamic\ Code\ Coverage\ Tools/amd64
203
- if [[ -d $DIR ]]; then
204
- # This is for MSVC 2019 (on windows-2019).
205
- VSINSTR="$VS"/Team\ Tools/Performance\ Tools/vsinstr.exe
206
- for f in build/cp*/src/*.pyd; do
207
- "$VSINSTR" $f -Verbose -Coverage
208
- done
209
- TOOL="$DIR/CodeCoverage.exe"
210
- cat > extensions.config << EOF
96
+ SESSION_ID=$(python -c "import uuid; print(uuid.uuid4(), end='')")
97
+ echo "Coverage session ID: ${SESSION_ID}"
98
+ VS=$(ls -d /c/Program\ Files*/Microsoft\ Visual\ Studio/*/Enterprise)
99
+ echo "Visual Studio: ${VS}"
100
+ DIR="$VS/Common7/IDE/Extensions/Microsoft/CodeCoverage.Console"
101
+ if [[ -d $DIR ]]; then
102
+ # This is for MSVC 2022 (on windows-latest).
103
+ TOOL="$DIR/Microsoft.CodeCoverage.Console.exe"
104
+ for f in build/cp*/src/*.pyd; do
105
+ echo $f
106
+ echo "=============================="
107
+ "$TOOL" instrument $f --session-id $SESSION_ID \
108
+ --log-level Verbose --log-file instrument.log
109
+ cat instrument.log
110
+ rm instrument.log
111
+ done
112
+ echo "Starting $TOOL in server mode"
113
+ "$TOOL" collect \
114
+ --session-id $SESSION_ID --server-mode \
115
+ --output-format cobertura --output extensions.xml \
116
+ --log-level Verbose --log-file extensions.log &
117
+ VS_VER=2022
118
+ else
119
+ DIR="$VS"/Team\ Tools/Dynamic\ Code\ Coverage\ Tools/amd64
120
+ if [[ -d $DIR ]]; then
121
+ # This is for MSVC 2019 (on windows-2019).
122
+ VSINSTR="$VS"/Team\ Tools/Performance\ Tools/vsinstr.exe
123
+ for f in build/cp*/src/*.pyd; do
124
+ "$VSINSTR" $f -Verbose -Coverage
125
+ done
126
+ TOOL="$DIR/CodeCoverage.exe"
127
+ cat > extensions.config << EOF
211
128
<CodeCoverage>
212
129
<CollectFromChildProcesses>true</CollectFromChildProcesses>
213
130
<ModulePaths>
@@ -217,60 +134,38 @@ stages:
217
134
</ModulePaths>
218
135
</CodeCoverage>
219
136
EOF
220
- echo "Starting $TOOL in server mode"
221
- "$TOOL" collect \
222
- -config:extensions.config -session:$SESSION_ID \
223
- -output:extensions.coverage -verbose &
224
- echo "Started $TOOL"
225
- VS_VER=2019
226
- fi
227
- fi
228
- echo "##vso[task.setvariable variable=VS_COVERAGE_TOOL]$TOOL"
137
+ echo "Starting $TOOL in server mode"
138
+ "$TOOL" collect \
139
+ -config:extensions.config -session:$SESSION_ID \
140
+ -output:extensions.coverage -verbose &
141
+ echo "Started $TOOL"
142
+ VS_VER=2019
143
+ fi
229
144
fi
145
+ echo "##vso[task.setvariable variable=VS_COVERAGE_TOOL]$TOOL"
146
+
230
147
PYTHONFAULTHANDLER=1 pytest -rfEsXR -n 2 \
231
148
--maxfail=50 --timeout=300 --durations=25 \
232
149
--junitxml=junit/test-results.xml --cov-report=xml --cov=lib
233
- if [[ -n $SESSION_ID ]]; then
234
- if [[ $VS_VER == 2022 ]]; then
235
- "$TOOL" shutdown $SESSION_ID
236
- echo "Coverage collection log"
237
- echo "======================="
238
- cat extensions.log
239
- else
240
- "$TOOL" shutdown -session:$SESSION_ID
241
- fi
150
+
151
+ if [[ $VS_VER == 2022 ]]; then
152
+ "$TOOL" shutdown $SESSION_ID
153
+ echo "Coverage collection log"
154
+ echo "======================="
155
+ cat extensions.log
156
+ else
157
+ "$TOOL" shutdown -session:$SESSION_ID
242
158
fi
243
159
displayName: 'pytest'
244
160
245
161
- bash : |
246
- case "$AGENT_OS" in
247
- Linux)
248
- lcov --rc lcov_branch_coverage=1 --capture --directory . \
249
- --output-file coverage.info
250
- lcov --rc lcov_branch_coverage=1 --output-file coverage.info \
251
- --extract coverage.info $PWD/src/'*' $PWD/lib/'*'
252
- lcov --rc lcov_branch_coverage=1 --list coverage.info
253
- find . -name '*.gc*' -delete
254
- ;;
255
- Darwin)
256
- xcrun llvm-profdata merge -sparse default.*.profraw \
257
- -o default.profdata
258
- xcrun llvm-cov export -format="lcov" build/*/src/*.so \
259
- -instr-profile default.profdata > info.lcov
260
- ;;
261
- Windows_NT)
262
- if [[ -f extensions.coverage ]]; then
263
- # For MSVC 2019.
264
- "$VS_COVERAGE_TOOL" analyze -output:extensions.xml \
265
- -include_skipped_functions -include_skipped_modules \
266
- extensions.coverage
267
- rm extensions.coverage
268
- fi
269
- ;;
270
- *)
271
- exit 1
272
- ;;
273
- esac
162
+ if [[ -f extensions.coverage ]]; then
163
+ # For MSVC 2019.
164
+ "$VS_COVERAGE_TOOL" analyze -output:extensions.xml \
165
+ -include_skipped_functions -include_skipped_modules \
166
+ extensions.coverage
167
+ rm extensions.coverage
168
+ fi
274
169
displayName: 'Filter C coverage'
275
170
condition: succeededOrFailed()
276
171
- bash : |
0 commit comments