Skip to content

Commit 2f708ef

Browse files
committed
CI: Add a Cygwin run to GHA CI.
This involved a good bit of debugging of the build process, especially for the bundled FreeType. Eventually removing the debugging flags let it just work. There are still fork failures, but I've done everything I know to do. CYGWIN=detect_bloda may reveal more, but may not. parent 48e5934 author DWesl <[email protected]> 1651882104 -0400 committer DWesl <[email protected]> 1670678538 -0500 parent 48e5934 author DWesl <[email protected]> 1651882104 -0400 committer DWesl <[email protected]> 1670678484 -0500 CI: Add a Cygwin run to GHA CI. Let's see if I translated the workflow even close to correctly. CI: Pin Cygwin setuptools<60 and NumPy !=1.21 setuptools>60 breaks Pillow install, and may cause problems for NumPy. NumPy 1.21 has intermittent segfaults on GHA runners, so let's just skip that. CI: Pin Cygwin setuptools<60 and avoid problem upgrades setuptools>=60 runs into python-pillow/Pillow#6216 and pypa/setuptools#3304. NumPy==1.21.* has intermittent segfaults due to SIMD attempts on unaligned memory. kiwisolver, numpy, and pillow have problems installing, so just verify that they are present, don't try to upgrade them. CI: Upgrade Cygwin pip CI: Install g++ and print info on Python.h Hopefully one of these will convince NumPy to compile. CI: Install libjpeg-devel for Pillow install Let's see if it keeps setuptools old enough for this to work. CI: BLD: Use system freetype and qhull Given that I'm checking a build problem at the moment, this should allow that to show up faster. This should probably be reverted before merging. CI: Specify shell for Cygwin pytest step. CI: Rebase Matplotlib DLLs before running pytest Try to avoid "BlockingIOError: Resource Unavailable" with a fork() error on stderr. CI: Compile against bundled freetype. See if this fixes the various test errors. It will take a few tries to get freetype to actually compile, I think. CI: Install make for libfreetype build Let's see if this lets the build run to completion. BLD: Run autoconf before installing bundled freetype Let's see if this fixes the install problems. CI: Try to get Cygwin build of FreeType working. It doesn't fail the same way locally. CI: Revert to actually-configured python alternatives. BLD: Fix autoconf call on Cygwin. BLD: Fix directory for Cygwin autoreconf. CI: Fix directory for Cygwin autoconf in FreeType. BLD: Fix autoreconf command line. BLD: Run only autoconf on Cygwin, not autoreconf. libtoolize still fails; let's see if this at least gets through configure now. BLD: Run verbose libtoolize on bundled FreeType Let's see if this produces useful information. BLD: Copy the libtool files and ensure write permissions Copy instead of symlinking, and make sure the current user has write permissions for the target files. BLD: Add print statements to update on Autotools progress Let's see if I this narrows down where the error happens. BLD: Add permissions for everybody to fix libtoolize It's the only thing I can think of that would make the copy fail. CI: Try to clean up error reporting. Errors importing matplotlib are distinct from test failures; pip's logs of compile failures have a lot of extra stuff not related to the actual compile failure CI: Skip broken FreeType build on Cygwin I'll have to update many tests, but that should be doable. CI: Add FreeType and QHull to Cygwin CI I'm going the hard way through the testing process. BLD: Use auto-typed result from dlsym Try to avoid the Cygwin-vs-Linux dlsym signature incompatibility. (Cygwin returns FARPROC aka `long long int (*)()`, Linux returns void *) CI: Add Cygwin dependencies and try to rebase more Let's hope this sidesteps the BlockingIOErrors in subprocess.run CI: Split Cygwin rebase step One step for finding the files. a separate step for rebasing, using only rebase. CI: Only rebase files in /usr/ and /usr/local/ GHA gives permissions to write to /usr/local, so pip puts the new files there. CI: Add premissions to the image comparisons See if this lets the artifact upload step work. CI: Use the bundled FreeType on Cygwin again CI: Try to change rebase to avoid fork failures BLD: Fix definition of FT_CONFIG_CONFIG_H on Cygwin The default definition doesn't actually define everything assumed to be defined by that header. It was changed a few versions before, but they seem to have only checked whether it worked a few places. BLD: Add autoconf and libtoolize back in I'd forgotten configure crashed. BLD: Continue on libtoolize failure CI: Try to get more information from make CI: Uses Cygwin FreeType package again. CI: Try doubled backslashes for result directory. Let's see if this allows upload-artifact to succeed. BUG: Rebase DLLs in ediable install I skipped those earlier, which doesn't do anything useful. CI, BUG: Install git on Cygwin runner. Some of the tests use setuptools_scm, which needs git. CI, BUG: Run actions/checkout before Cygwin install Otherwise git panics about someone else owning the repository midway through cloning. CI, BUG: Mark the repo safe again Git is apparently picky about how I specify Windows paths. CI, DBG: Print Windows permissions for image dir Inspired by https://social.technet.microsoft.com/wiki/contents/articles/31139.powershell-how-to-get-folder-permissions.aspx Apparently Windows "dir" doesn't have an option to output permissions, that's a separate utility. CI, DBG: Print more permissions for result_images Try printing permissions of the images that fail to upload. The directory seems to deny only write and delete permissions, which shouldn't cause problems. CI, DBG: Give everyone all permissions to result img dir Maybe this will let upload-artifact succeed. CI: Use dash for /bin/sh on Cygwin This seems to help libtoolize finish without crashing. CI: Try to compile bundled freetype on Cygwin again This should get farther. CI: FIX: Specify proper shell when setting shell. CI, FIX: Spell shell options correctly to set /bin/sh CI, FIX: Use dash to set dash as /bin/sh on Cygwin BLD: Specify /bin/dash explicitly for Cygwin FreeType build TODO: Remember to revert the configure change. CI: Keep bash around when making dash /bin/sh CI: Make /bin/sh a symlink to /bin/dash CI: Set Cygwin tempdir to /tmp CI: Explicitly install m4 on Cygwin. CI, DBG: Clarify what /bin/sh is around def change. I want to see how they change before and after I change it from /bin/bash to /bin/dash CI, FIX: Use bash to change /bin/sh to /bin/dash CI, FIX: Clean up syntax to set sh to dash. Also avoid duplicate work for a failure. BLD: Reduce verbosity of FreeType setup on Cygwin Use autoreconf instead of autoconf --verbose Should help me figure out where the new failure is. BLD: Stop running autoreconf on Cygwin It doesn't seem to help much CI, DBG: Only run upload-artifact debuggers if tests ran Don't try to examine images if there hasn't been anything to create them. CI, FIX: Use single quotes for condition. Double quotes cause problems CI: Allow Cygwin CI to run on patch-2 BLD: Revert most changes to setupext.py Still unconditionally rebuild ./configure on Cygwin, to try to update build system. BLD: Revert the rest of the changes to setupext.py FreeType seems to build on unmodified matplotlib locally, so this shouldn't be needed. CI: Install matplotlib in Cygwin CI Hopefully this pulls in the last dependencies and keeps the FreeType build from failing. CI: Specify MAKEFLAGS, not MAKE https://www.gnu.org/software/make/manual/make.html#Options_002fRecursion suggests specifying MAKEFLAGS to ensue options are passed to make, not MAKE. This might help with the weird "directory not found" errors. CI, BUG: Specify --coverage in CPPFLAGS and LDFLAGS Specifying in CPPFLAGS only causes link to fail. LDFLAGS=-lgcov should also work, but this should be more general. STY: Remove trainling whitespace Get pre-commit to stop sending me emails about trailing whitespace. CI,BUG: Make sure coverage library gets linked There may be a problem in the configtest procedure. CI: Cut separate build step It's failing in the pip install step, and I want to be sure that's not because there's already a build tree. CI: Cygwin: Don't add coverage tracing to matplotlib It causes pip install to fail. CI: Install importlib_resources Apparently not listed in the requirements*.txt BUG: Fix spelling CI: Cygwin: Drop LaTeX packages The PGF tests mostly fail. CI: Set ffmpeg path so Cygwin tests don't use Windows executable CI: Append to mplrc, don't overwrite. Let's see if this fixes the key lookup error on import CI: Cygwin: Create new mplrc file instead of overwriting old Appending creates load errors in forked tests; replacing the line should fix that, and creating a new version should fix the remaining problems. CI,FIX: Cygwin: Create mpl config directories CI: Cygwin: Don't install WX, do install ipython WX imports keep failing. One test uses IPython and fails, let's make sure that's not because IPython isn't installed. CI: Cygwin: Uninstall wxPython It shouldn't be installed, so this should be fast. CI: Cygwin: Try to get remaining tests working. Rebase executables in /bin as well as those in /usr/bin Remove default ACLs on /tmp CI,FIX: Fix syntax and style of previous commit //bin is not POSIX-compliant and doesn't work on Cygwin. Delete trailing whitespace. CI: Cygwin: Set username to root and uid to 0 This should let checks for "can I access all files regardless of permissions" work the way Linux expects. CI,FIX: Cygwin: Try to fix sed expression for euid=0 Sed expression #2, character 0: error: no previous regex. Not really useful, sed. CI: Cygwin: Stop changing username, just change uid CI: Stop rebasing binaries in /bin They are already covered in /usr/bin, and probably the important information is in the file, not a database somewhere (I mean, it's also in a database, but you can turn that off). CI: Cygwin: Upload code coverage data
1 parent 48e5934 commit 2f708ef

File tree

1 file changed

+223
-0
lines changed

1 file changed

+223
-0
lines changed

.github/workflows/tests.yml

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,229 @@ jobs:
291291
name: "${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.name-suffix }} result images"
292292
path: ./result_images
293293

294+
test-cygwin:
295+
runs-on: windows-latest
296+
name: Python 3.${{ matrix.python-minor-version }} on Cygwin
297+
if: "(github.repository == 'matplotlib/matplotlib' || github.repository == 'DWesl/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]')"
298+
env:
299+
SHELLOPTS: igncr
300+
CYGWIN_NOWINPATH: 1
301+
CHERE_INVOKING: 1
302+
TMP: /tmp
303+
TEMP: /tmp
304+
strategy:
305+
matrix:
306+
python-minor-version: [8]
307+
308+
steps:
309+
- name: Fix line endings
310+
run: git config --global core.autocrlf input
311+
312+
- uses: actions/checkout@v3
313+
with:
314+
fetch-depth: 0
315+
316+
- uses: cygwin/cygwin-install-action@v2
317+
with:
318+
packages: >-
319+
ccache gcc-g++ gdb git graphviz libcairo-devel libffi-devel
320+
libgeos-devel libQt5Core-devel pkgconf libglib2.0-devel
321+
noto-cjk-fonts
322+
python3${{ matrix.python-minor-version }}-devel
323+
python3${{ matrix.python-minor-version }}-pip
324+
python3${{ matrix.python-minor-version }}-wheel
325+
python3${{ matrix.python-minor-version }}-setuptools
326+
python3${{ matrix.python-minor-version }}-cycler
327+
python3${{ matrix.python-minor-version }}-dateutil
328+
python3${{ matrix.python-minor-version }}-fonttools
329+
python3${{ matrix.python-minor-version }}-imaging
330+
python3${{ matrix.python-minor-version }}-kiwisolver
331+
python3${{ matrix.python-minor-version }}-numpy
332+
python3${{ matrix.python-minor-version }}-packaging
333+
python3${{ matrix.python-minor-version }}-pyparsing
334+
python3${{ matrix.python-minor-version }}-sip
335+
python3${{ matrix.python-minor-version }}-sphinx
336+
python-cairo-devel
337+
python3${{ matrix.python-minor-version }}-cairo
338+
python3${{ matrix.python-minor-version }}-gi
339+
python3${{ matrix.python-minor-version }}-matplotlib
340+
xorg-server-extra libxcb-icccm4 libxcb-image0
341+
libxcb-keysyms1 libxcb-randr0 libxcb-render-util0
342+
libxcb-xinerama0
343+
make autoconf autoconf2.5 automake automake1.10 libtool m4
344+
libqhull-devel libfreetype-devel
345+
libjpeg-devel libwebp-devel
346+
347+
- name: Set runner username to root and id to 0
348+
shell: bash.exe -eo pipefail -o igncr "{0}"
349+
run: |
350+
/bin/mkpasswd.exe -c | sed -e "s/$(id -u)/0/" >/etc/passwd
351+
352+
- name: Mark test repo safe
353+
shell: bash.exe -eo pipefail -o igncr "{0}"
354+
run: |
355+
git.exe config --global --add safe.directory /proc/cygdrive/d/a/matplotlib/matplotlib
356+
git config --global --add safe.directory /cygdrive/d/a/matplotlib/matplotlib
357+
C:/cygwin/bin/git.exe config --global --add safe.directory D:/a/matplotlib/matplotlib
358+
/usr/bin/git config --global --add safe.directory /cygdrive/d/a/matplotlib/matplotlib
359+
360+
- name: Use dash for /bin/sh
361+
shell: bash.exe -eo pipefail -o igncr "{0}"
362+
run: |
363+
ls -l /bin/sh.exe /bin/bash.exe /bin/dash.exe
364+
/bin/rm -f /bin/sh.exe || exit 1
365+
cp -sf /bin/dash.exe /bin/sh.exe || exit 1
366+
ls -l /bin/sh.exe /bin/bash.exe /bin/dash.exe
367+
368+
- name: Cache pip
369+
uses: actions/cache@v3
370+
with:
371+
path: C:\cygwin\home\runneradmin\.cache\pip
372+
key: Cygwin-py3.${{ matrix.python-minor-version }}-pip-${{ hashFiles('requirements/*/*.txt') }}
373+
restore-keys: |
374+
${{ matrix.os }}-py3.${{ matrix.python-minor-version }}-pip-
375+
376+
- name: Cache ccache
377+
uses: actions/cache@v3
378+
with:
379+
path: C:\cygwin\home\runneradmin\.ccache
380+
key: Cygwin-py3.${{ matrix.python-minor-version }}-ccache-${{ hashFiles('src/*') }}
381+
restore-keys: Cygwin-py3.${{ matrix.python-minor-version }}-ccache-
382+
383+
- name: Cache Matplotlib
384+
uses: actions/cache@v3
385+
with:
386+
path: |
387+
C:\cygwin\home\runneradmin/.cache/matplotlib
388+
!C:\cygwin\home\runneradmin/.cache/matplotlib/tex.cache
389+
!C:\cygwin\home\runneradmin/.cache/matplotlib/test_cache
390+
key: 1-Cygwin-py3.${{ matrix.python-minor-version }}-mpl-${{ github.ref }}-${{ github.sha }}
391+
restore-keys: |
392+
1-Cygwin-py3.${{ matrix.python-minor-version }}-mpl-${{ github.ref }}-
393+
1-Cygwin-py3.${{ matrix.python-minor-version }}-mpl-
394+
395+
- name: Ensure correct python version
396+
shell: bash.exe -eo pipefail -o igncr "{0}"
397+
run: |
398+
/usr/sbin/alternatives --set python /usr/bin/python3.${{ matrix.python-minor-version }}
399+
/usr/sbin/alternatives --set python3 /usr/bin/python3.${{ matrix.python-minor-version }}
400+
401+
- name: Check missing files
402+
shell: bash.exe -eo pipefail -o igncr "{0}"
403+
run: |
404+
ls -l /usr/include/python*/Python.h
405+
file /usr/include/python*/Python.h
406+
ls -l /usr/share/libtool/build-aux/ltmain.sh
407+
file /usr/share/libtool/build-aux/ltmain.sh
408+
409+
- name: Install Python dependencies
410+
shell: bash.exe -eo pipefail -o igncr "{0}"
411+
run: |
412+
python -m pip install --upgrade pip 'setuptools<60' wheel
413+
python -m pip install kiwisolver 'numpy!=1.21.*' pillow importlib_resources
414+
grep -v -F -e psutil requirements/testing/all.txt >requirements_test.txt
415+
python -m pip install --upgrade 'contourpy>=1.0.1' cycler fonttools \
416+
packaging pyparsing python-dateutil setuptools-scm \
417+
-r requirements_test.txt sphinx ipython
418+
python -m pip install --upgrade pycairo 'cairocffi>=0.8' PyGObject &&
419+
python -c 'import gi; gi.require_version("Gtk", "3.0"); from gi.repository import Gtk' &&
420+
echo 'PyGObject is available' ||
421+
echo 'PyGObject is not available'
422+
python -m pip install --upgrade pyqt5 &&
423+
python -c 'import PyQt5.QtCore' &&
424+
echo 'PyQt5 is available' ||
425+
echo 'PyQt5 is not available'
426+
python -mpip install --upgrade pyside2 &&
427+
python -c 'import PySide2.QtCore' &&
428+
echo 'PySide2 is available' ||
429+
echo 'PySide2 is not available'
430+
yes | python -m pip uninstall wxpython || echo 'wxPython already uninstalled'
431+
432+
- name: Install matplotlib
433+
shell: bash.exe -eo pipefail -o igncr "{0}"
434+
env:
435+
AUTOCONF: /usr/bin/autoconf-2.69
436+
MAKEFLAGS: dw
437+
run: |
438+
ccache -s
439+
git describe
440+
# Set flag in a delayed manner to avoid issues with installing other
441+
# packages
442+
cat <<EOT >> mplsetup.cfg
443+
[rc_options]
444+
backend=Agg
445+
446+
[libs]
447+
system_freetype = False
448+
system_qhull = True
449+
EOT
450+
cat mplsetup.cfg
451+
# All dependencies must have been pre-installed, so that the minver
452+
# constraints are held.
453+
python -m pip install --no-deps -ve .
454+
455+
- name: Find DLLs to rebase
456+
shell: bash.exe -eo pipefail -o igncr "{0}"
457+
run: |
458+
find {/usr,/usr/local}/{bin,lib/python3.?/site-packages} /usr/lib/lapack . -name \*.exe -o -name \*.dll -print >files_to_rebase.txt
459+
460+
- name: Rebase DLL list
461+
shell: ash.exe "{0}"
462+
run: "rebase --database --filelist=files_to_rebase.txt"
463+
464+
- name: Check that Matplotlib imports
465+
shell: bash.exe -eo pipefail -o igncr "{0}"
466+
run: |
467+
/usr/bin/python -c "import matplotlib as mpl; import matplotlib.pyplot as plt"
468+
469+
- name: Set ffmpeg path
470+
shell: 'bash.exe -eo pipefail -o igncr "{0}"'
471+
run: |
472+
oldmplrc=$(python -c "from matplotlib import matplotlib_fname as mplrc_file; print(mplrc_file())")
473+
echo "${oldmplrc}"
474+
awk '/animation.ffmpeg_path/ { print "animation.ffmpeg_path: /usr/bin/ffmpeg.exe"; next } { print $0; }' "${oldmplrc}" >matplotlibrc
475+
mkdir -p ~/.config/matplotlib/
476+
cp matplotlibrc ~/.config/matplotlib/matplotlibrc
477+
mkdir -p ~/.matplotlib/
478+
cp matplotlibrc ~/.matplotlib/matplotlibrc
479+
480+
- name: Remove default ACLs on /tmp
481+
shell: bash.exe -eo pipefail -o igncr "{0}"
482+
run: |
483+
cd /tmp && setfacl -b .
484+
485+
- name: Run pytest
486+
shell: bash.exe -eo pipefail -o igncr "{0}"
487+
id: cygwin-run-pytest
488+
run: |
489+
xvfb-run python -mpytest -raR -n auto \
490+
--maxfail=50 --timeout=300 --durations=25 \
491+
--cov-report=xml --cov=lib --log-level=DEBUG --color=yes
492+
493+
- name: Add permissions for image comparisons
494+
if: failure() && steps.cygwin-run-pytest.conclusion == 'failure'
495+
shell: bash.exe -eo pipefail -o igncr "{0}"
496+
run: |
497+
chmod a+rwx -R ./result_images
498+
chmod a+rwx $(find ./result_images -type d)
499+
chmod o+rw -R ./result_images
500+
501+
- name: List result image directory contents
502+
if: failure() && steps.cygwin-run-pytest.conclusion == 'failure'
503+
run: |
504+
dir ./result_images
505+
Get-ACL ./result_images/* | Format-List
506+
Get-ACL ./result_images/test_agg/* | Format-List
507+
508+
- uses: actions/upload-artifact@v3
509+
if: failure()
510+
with:
511+
name: "3.${{ matrix.python-minor-version }} Cygwin result images"
512+
path: ".\\result_images"
513+
514+
- name: Upload code coverage
515+
uses: codecov/codecov-action@v3
516+
294517
# Separate dependent job to only upload one issue from the matrix of jobs
295518
create-issue:
296519
if: ${{ failure() && github.event_name == 'schedule' }}

0 commit comments

Comments
 (0)