Repository navigation
239 lines (210 loc) · 8.32 KB
/
Copy pathwindows-tests.yml
File metadata and controls
239 lines (210 loc) · 8.32 KB
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
---
name: Windows tests
on:
push:
branches-ignore:
- auto-backport-of-pr-[0-9]+
- v[0-9]+.[0-9]+.[0-9x]+-doc
- dependabot/**
pull_request:
branches-ignore:
- v[0-9]+.[0-9]+.[0-9x]+-doc
paths-ignore:
- 'doc/**'
- 'galleries/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
cancel-in-progress: true
permissions: {}
env:
PYTHONFAULTHANDLER: 1
PYTHONIOENCODING: UTF-8
jobs:
pip-msvc:
if: >-
github.event_name == 'workflow_dispatch' ||
(
github.repository == 'matplotlib/matplotlib' &&
!contains(github.event.head_commit.message, '[ci skip]') &&
!contains(github.event.head_commit.message, '[skip ci]') &&
!contains(github.event.head_commit.message, '[skip github]') &&
!contains(github.event.head_commit.message, '[ci doc]')
)
permissions:
contents: read
name: "pip/MSVC: Python ${{ matrix.python-version }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
python-version: '3.12'
- os: windows-latest
python-version: '3.13'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
filter: blob:none
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
pyproject.toml
- name: Install OS dependencies
run: choco install ninja --yes --no-progress
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade --group build
python -m pip install --prefer-binary --group test --group test-extra
- name: Build Matplotlib with MSVC coverage support
run: |
python -m pip install --no-build-isolation --verbose --editable '.[dev]' `
--config-settings=setup-args=--vsenv `
--config-settings=setup-args=-Dcpp_link_args=-PROFILE `
--config-settings=setup-args=-Dbuildtype=debug
- name: Show environment
run: |
Get-ChildItem Env: | Sort-Object Name
python -m pip list
git describe
- name: Instrument extension modules and start native coverage collector
shell: bash
run: |
vswhere='/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe'
vs=$("$vswhere" -latest -products '*' -property installationPath | tr -d '\r')
tool_dir="$vs/Common7/IDE/Extensions/Microsoft/CodeCoverage.Console"
tool=$(cygpath -u "$tool_dir/Microsoft.CodeCoverage.Console.exe")
if [[ ! -x $tool ]]; then
echo "Microsoft.CodeCoverage.Console.exe was not found at $tool"
exit 1
fi
session_id=$(python -c "import uuid; print(uuid.uuid4(), end='')")
echo "VS_COVERAGE_TOOL=$tool" >> "$GITHUB_ENV"
echo "COVERAGE_SESSION_ID=$session_id" >> "$GITHUB_ENV"
echo "Coverage tool: $tool"
echo "Coverage session: $session_id"
for module in build/cp*/src/*.pyd; do
echo "Instrumenting $module"
"$tool" instrument "$module" --session-id "$session_id" \
--log-level Verbose --log-file instrument.log
cat instrument.log
done
"$tool" collect --session-id "$session_id" --server-mode \
--output-format cobertura --output extensions.xml \
--log-level Verbose --log-file extensions.log &
- name: Run pytest
run: |
python -m pytest -rfEsXR -n auto `
--maxfail=50 --timeout=300 --durations=25 --log-level=DEBUG `
--cov-report=xml:coverage.xml --cov=lib
- name: Stop native coverage collector
if: always()
shell: bash
run: |
if [[ -n $VS_COVERAGE_TOOL && -n $COVERAGE_SESSION_ID ]]; then
"$VS_COVERAGE_TOOL" shutdown "$COVERAGE_SESSION_ID"
fi
if [[ -f extensions.log ]]; then
echo 'Native coverage collection log'
cat extensions.log
fi
- name: Upload code coverage
if: ${{ !cancelled() }}
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
files: coverage.xml,extensions.xml
name: "${{ matrix.python-version }} ${{ matrix.os }}"
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload failed image comparisons
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: pip-msvc-${{ matrix.os }}-py${{ matrix.python-version }}-result-images
path: result_images
conda:
if: >-
github.event_name == 'workflow_dispatch' ||
(
github.repository == 'matplotlib/matplotlib' &&
!contains(github.event.head_commit.message, '[ci skip]') &&
!contains(github.event.head_commit.message, '[skip ci]') &&
!contains(github.event.head_commit.message, '[skip github]') &&
!contains(github.event.head_commit.message, '[ci doc]')
)
permissions:
contents: read
name: "conda-forge: Python 3.12 on windows-2022"
runs-on: windows-2022
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
filter: blob:none
persist-credentials: false
- name: Cache Matplotlib
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~\.cache\matplotlib
key: windows-conda-py312-mpl-${{ github.ref }}-${{ github.sha }}
restore-keys: |
windows-conda-py312-mpl-${{ github.ref }}-
windows-conda-py312-mpl-
- name: Set up micromamba
uses: mamba-org/setup-micromamba@f457c30a868e4760d3a6fcea5f25dc655b8edf39 # v3
with:
micromamba-version: 2.9.0-0
micromamba-root-path: ${{ runner.temp }}\micromamba
init-shell: none
cache-downloads: true
cache-downloads-key: windows-conda-py312-${{ hashFiles('environment.yml') }}
# Create the environment explicitly, rather than via setup-micromamba's
# environment-file option, so that we can add extra packages on top of
# environment.yml.
- name: Create conda environment
env:
MAMBA_ROOT_PREFIX: ${{ runner.temp }}\micromamba
run: |
micromamba create --yes --name mpl-dev --file environment.yml `
python=3.12 pywin32 codecov ffmpeg inkscape
- name: Build Matplotlib
env:
MAMBA_ROOT_PREFIX: ${{ runner.temp }}\micromamba
run: |
$env:LINK = "/LIBPATH:$pwd\lib"
micromamba run --name mpl-dev python -m pip install --verbose `
--no-build-isolation --editable '.[dev]'
- name: Verify TkAgg backend
env:
MAMBA_ROOT_PREFIX: ${{ runner.temp }}\micromamba
run: |
micromamba run --name mpl-dev python -c `
"import matplotlib as m; m.use('tkagg'); import matplotlib.pyplot as plt; print(plt.get_backend())"
- name: Run pytest
env:
MAMBA_ROOT_PREFIX: ${{ runner.temp }}\micromamba
run: |
micromamba run --name mpl-dev python -m pytest -rfEsXR -n auto `
--timeout=300 --durations=25 --log-level=DEBUG `
--cov-report=xml:coverage-conda.xml --cov=lib
- name: Upload code coverage
if: ${{ !cancelled() }}
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
files: coverage-conda.xml
name: "3.12 windows-2022 conda-forge"
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload failed image comparisons
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: conda-windows-2022-py312-result-images
path: result_images