Skip to content

Commit 382a6b8

Browse files
committed
CI: Move Cygwin CI to new file, trigger on label.
I think I did this right, we will find out.
1 parent e5e0e2f commit 382a6b8

File tree

2 files changed

+249
-199
lines changed

2 files changed

+249
-199
lines changed

.github/workflows/cygwin.yml

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
---
2+
name: Cygwin Tests
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
- v[0-9]+.[0-9]+.[0-9x]+.x
12+
tags:
13+
- v*
14+
paths:
15+
- 'src/**'
16+
pull_request:
17+
types:
18+
- opened
19+
- synchronize
20+
- reopened
21+
- labeled
22+
branches-ignore:
23+
- v[0-9]+.[0-9]+.[0-9x]+-doc
24+
paths:
25+
- 'src/**'
26+
schedule:
27+
# 5:47 UTC on Saturdays
28+
- cron: "47 5 * * 6"
29+
workflow_dispatch:
30+
workflow: "*"
31+
32+
permissions:
33+
contents: read
34+
35+
env:
36+
NO_AT_BRIDGE: 1 # Necessary for GTK3 interactive test.
37+
OPENBLAS_NUM_THREADS: 1
38+
PYTHONFAULTHANDLER: 1
39+
SHELLOPTS: igncr
40+
CYGWIN_NOWINPATH: 1
41+
CHERE_INVOKING: 1
42+
TMP: /tmp
43+
TEMP: /tmp
44+
45+
jobs:
46+
47+
test-cygwin:
48+
runs-on: windows-latest
49+
name: Python 3.${{ matrix.python-minor-version }} on Cygwin
50+
if: |
51+
github.event_name == 'workflow_dispatch' ||
52+
(
53+
github.repository == 'matplotlib/matplotlib' &&
54+
!contains(github.event.head_commit.message, '[ci skip]') &&
55+
!contains(github.event.head_commit.message, '[skip ci]') &&
56+
!contains(github.event.head_commit.message, '[skip github]') &&
57+
(
58+
github.event_name == 'push' ||
59+
github.event_name == 'pull_request && (
60+
(
61+
github.event.action == 'labeled' &&
62+
github.event.label.name == 'Run cygwin'
63+
) ||
64+
contains(github.event.pull_request.labels.*.name, 'Run cygwin')
65+
)
66+
)
67+
)
68+
env:
69+
strategy:
70+
matrix:
71+
python-minor-version: [8, 9]
72+
73+
steps:
74+
- name: Fix line endings
75+
run: git config --global core.autocrlf input
76+
77+
- uses: actions/checkout@v3
78+
with:
79+
fetch-depth: 0
80+
81+
- uses: cygwin/cygwin-install-action@v2
82+
with:
83+
packages: >-
84+
ccache gcc-g++ gdb git graphviz libcairo-devel libffi-devel
85+
libgeos-devel libQt5Core-devel pkgconf libglib2.0-devel
86+
noto-cjk-fonts
87+
python3${{ matrix.python-minor-version }}-devel
88+
python3${{ matrix.python-minor-version }}-pip
89+
python3${{ matrix.python-minor-version }}-wheel
90+
python3${{ matrix.python-minor-version }}-setuptools
91+
python3${{ matrix.python-minor-version }}-cycler
92+
python3${{ matrix.python-minor-version }}-dateutil
93+
python3${{ matrix.python-minor-version }}-fonttools
94+
python3${{ matrix.python-minor-version }}-imaging
95+
python3${{ matrix.python-minor-version }}-kiwisolver
96+
python3${{ matrix.python-minor-version }}-numpy
97+
python3${{ matrix.python-minor-version }}-packaging
98+
python3${{ matrix.python-minor-version }}-pyparsing
99+
python3${{ matrix.python-minor-version }}-sip
100+
python3${{ matrix.python-minor-version }}-sphinx
101+
python-cairo-devel
102+
python3${{ matrix.python-minor-version }}-cairo
103+
python3${{ matrix.python-minor-version }}-gi
104+
python3${{ matrix.python-minor-version }}-matplotlib
105+
xorg-server-extra libxcb-icccm4 libxcb-image0
106+
libxcb-keysyms1 libxcb-randr0 libxcb-render-util0
107+
libxcb-xinerama0
108+
make autoconf autoconf2.5 automake automake1.10 libtool m4
109+
libqhull-devel libfreetype-devel
110+
libjpeg-devel libwebp-devel
111+
112+
- name: Set runner username to root and id to 0
113+
shell: bash.exe -eo pipefail -o igncr "{0}"
114+
# GitHub Actions runs everything as Administrator. I don't
115+
# know how to test for this, so set the uid for the CI job so
116+
# that the existing unix root detection will work.
117+
run: |
118+
/bin/mkpasswd.exe -c | sed -e "s/$(id -u)/0/" >/etc/passwd
119+
120+
- name: Mark test repo safe
121+
shell: bash.exe -eo pipefail -o igncr "{0}"
122+
run: |
123+
git.exe config --global --add safe.directory /proc/cygdrive/d/a/matplotlib/matplotlib
124+
git config --global --add safe.directory /cygdrive/d/a/matplotlib/matplotlib
125+
C:/cygwin/bin/git.exe config --global --add safe.directory D:/a/matplotlib/matplotlib
126+
/usr/bin/git config --global --add safe.directory /cygdrive/d/a/matplotlib/matplotlib
127+
128+
- name: Use dash for /bin/sh
129+
shell: bash.exe -eo pipefail -o igncr "{0}"
130+
run: |
131+
ls -l /bin/sh.exe /bin/bash.exe /bin/dash.exe
132+
/bin/rm -f /bin/sh.exe || exit 1
133+
cp -sf /bin/dash.exe /bin/sh.exe || exit 1
134+
ls -l /bin/sh.exe /bin/bash.exe /bin/dash.exe
135+
# FreeType build fails with bash, succeeds with dash
136+
137+
- name: Cache pip
138+
uses: actions/cache@v3
139+
with:
140+
path: C:\cygwin\home\runneradmin\.cache\pip
141+
key: Cygwin-py3.${{ matrix.python-minor-version }}-pip-${{ hashFiles('requirements/*/*.txt') }}
142+
restore-keys: |
143+
${{ matrix.os }}-py3.${{ matrix.python-minor-version }}-pip-
144+
145+
- name: Cache ccache
146+
uses: actions/cache@v3
147+
with:
148+
path: C:\cygwin\home\runneradmin\.ccache
149+
key: Cygwin-py3.${{ matrix.python-minor-version }}-ccache-${{ hashFiles('src/*') }}
150+
restore-keys: Cygwin-py3.${{ matrix.python-minor-version }}-ccache-
151+
152+
- name: Cache Matplotlib
153+
uses: actions/cache@v3
154+
with:
155+
path: |
156+
C:\cygwin\home\runneradmin/.cache/matplotlib
157+
!C:\cygwin\home\runneradmin/.cache/matplotlib/tex.cache
158+
!C:\cygwin\home\runneradmin/.cache/matplotlib/test_cache
159+
key: 1-Cygwin-py3.${{ matrix.python-minor-version }}-mpl-${{ github.ref }}-${{ github.sha }}
160+
restore-keys: |
161+
1-Cygwin-py3.${{ matrix.python-minor-version }}-mpl-${{ github.ref }}-
162+
1-Cygwin-py3.${{ matrix.python-minor-version }}-mpl-
163+
164+
- name: Ensure correct python version
165+
shell: bash.exe -eo pipefail -o igncr "{0}"
166+
run: |
167+
/usr/sbin/alternatives --set python /usr/bin/python3.${{ matrix.python-minor-version }}
168+
/usr/sbin/alternatives --set python3 /usr/bin/python3.${{ matrix.python-minor-version }}
169+
170+
- name: Install Python dependencies
171+
shell: bash.exe -eo pipefail -o igncr "{0}"
172+
run: |
173+
python -m pip install --upgrade pip 'setuptools<60' wheel
174+
python -m pip install kiwisolver 'numpy!=1.21.*' pillow importlib_resources
175+
grep -v -F -e psutil requirements/testing/all.txt >requirements_test.txt
176+
python -m pip install --upgrade 'contourpy>=1.0.1' cycler fonttools \
177+
packaging pyparsing python-dateutil setuptools-scm \
178+
-r requirements_test.txt sphinx ipython
179+
python -m pip install --upgrade pycairo 'cairocffi>=0.8' PyGObject &&
180+
python -c 'import gi; gi.require_version("Gtk", "3.0"); from gi.repository import Gtk' &&
181+
echo 'PyGObject is available' ||
182+
echo 'PyGObject is not available'
183+
python -m pip install --upgrade pyqt5 &&
184+
python -c 'import PyQt5.QtCore' &&
185+
echo 'PyQt5 is available' ||
186+
echo 'PyQt5 is not available'
187+
python -mpip install --upgrade pyside2 &&
188+
python -c 'import PySide2.QtCore' &&
189+
echo 'PySide2 is available' ||
190+
echo 'PySide2 is not available'
191+
python -m pip uninstall --yes wxpython || echo 'wxPython already uninstalled'
192+
193+
- name: Install matplotlib
194+
shell: bash.exe -eo pipefail -o igncr "{0}"
195+
env:
196+
AUTOCONF: /usr/bin/autoconf-2.69
197+
MAKEFLAGS: dw
198+
run: |
199+
ccache -s
200+
git describe
201+
cat <<EOT >> mplsetup.cfg
202+
[rc_options]
203+
backend=Agg
204+
205+
[libs]
206+
system_freetype = False
207+
system_qhull = True
208+
EOT
209+
cat mplsetup.cfg
210+
# All dependencies must have been pre-installed, so that the minver
211+
# constraints are held.
212+
python -m pip install --no-deps -ve .
213+
214+
- name: Find DLLs to rebase
215+
shell: bash.exe -eo pipefail -o igncr "{0}"
216+
run: |
217+
find {/usr,/usr/local}/{bin,lib/python3.*/site-packages} /usr/lib/lapack . -name \*.exe -o -name \*.dll -print >files_to_rebase.txt
218+
219+
- name: Rebase DLL list
220+
shell: ash.exe "{0}"
221+
run: "rebase --database --filelist=files_to_rebase.txt"
222+
# Inplace modification of DLLs to assign non-overlapping load
223+
# addresses so fork() works as expected. Ash is used as it
224+
# does not link against any Cygwin DLLs that might need to be
225+
# rebased.
226+
227+
- name: Check that Matplotlib imports
228+
shell: bash.exe -eo pipefail -o igncr "{0}"
229+
run: |
230+
/usr/bin/python -c "import matplotlib as mpl; import matplotlib.pyplot as plt"
231+
232+
- name: Set ffmpeg path
233+
shell: bash.exe -eo pipefail -o igncr "{0}"
234+
run: |
235+
oldmplrc=$(python -c "from matplotlib import matplotlib_fname as mplrc_file; print(mplrc_file())")
236+
echo "${oldmplrc}"
237+
mkdir -p ~/.matplotlib/
238+
sed -E -e 's~#animation\.ffmpeg_path:.+~animation.ffmpeg_path: /usr/bin/ffmpeg.exe~' "${oldmplrc}" >~/.matplotlib/matplotlibrc
239+
240+
- name: Run pytest
241+
shell: bash.exe -eo pipefail -o igncr "{0}"
242+
id: cygwin-run-pytest
243+
run: |
244+
xvfb-run python -mpytest -raR -n auto \
245+
--maxfail=50 --timeout=300 --durations=25 \
246+
--cov-report=xml --cov=lib --log-level=DEBUG --color=yes
247+
248+
- name: Upload code coverage
249+
uses: codecov/codecov-action@v3

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy