Merge pull request #1 from radarhere/add-cygwin-to-ci

CI: Add a Cygwin run to GitHub Actions

There are still a few things that are weird, but this looks much better than what I have now.
This commit is contained in:
DWesl 2022-02-02 23:02:24 -05:00 committed by GitHub
commit 6b05452d18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 95 additions and 83 deletions

View File

@ -3,7 +3,7 @@
# gather the coverage data # gather the coverage data
python3 -m pip install codecov python3 -m pip install codecov
if [[ $MATRIX_DOCKER ]]; then if [[ $MATRIX_DOCKER ]]; then
coverage xml --ignore-errors python3 -m coverage xml --ignore-errors
else else
coverage xml python3 -m coverage xml
fi fi

8
.ci/build_cygwin.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
set -e
python3 -m coverage erase
make clean
CFLAGS="-coverage -Werror=implicit-function-declaration" python3 -m pip install -v --global-option="build_ext" .
python3 selftest.py

View File

@ -13,17 +13,20 @@ aptget_update()
return 1 return 1
fi fi
} }
aptget_update || aptget_update retry || aptget_update retry if [[ $(uname) != CYGWIN* ]]; then
aptget_update || aptget_update retry || aptget_update retry
fi
set -e set -e
sudo apt-get -qq install libfreetype6-dev liblcms2-dev python3-tk\ if [[ $(uname) != CYGWIN* ]]; then
ghostscript libffi-dev libjpeg-turbo-progs libopenjp2-7-dev\ sudo apt-get -qq install libfreetype6-dev liblcms2-dev python3-tk\
cmake meson imagemagick libharfbuzz-dev libfribidi-dev ghostscript libffi-dev libjpeg-turbo-progs libopenjp2-7-dev\
cmake meson imagemagick libharfbuzz-dev libfribidi-dev
python3 -m pip install --upgrade pip
fi
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade wheel python3 -m pip install --upgrade wheel
PYTHONOPTIMIZE=0 python3 -m pip install cffi
python3 -m pip install coverage python3 -m pip install coverage
python3 -m pip install defusedxml python3 -m pip install defusedxml
python3 -m pip install olefile python3 -m pip install olefile
@ -32,24 +35,30 @@ python3 -m pip install -U pytest-cov
python3 -m pip install -U pytest-timeout python3 -m pip install -U pytest-timeout
python3 -m pip install pyroma python3 -m pip install pyroma
python3 -m pip install test-image-results python3 -m pip install test-image-results
python3 -m pip install numpy
# PyQt5 doesn't support PyPy3 if [[ $(uname) != CYGWIN* ]]; then
if [[ $GHA_PYTHON_VERSION == 3.* ]]; then PYTHONOPTIMIZE=0 python3 -m pip install cffi
# arm64, ppc64le, s390x CPUs: python3 -m pip install numpy
# "ERROR: Could not find a version that satisfies the requirement pyqt5"
sudo apt-get -qq install libxcb-xinerama0 pyqt5-dev-tools # PyQt5 doesn't support PyPy3
python3 -m pip install pyqt5 if [[ $GHA_PYTHON_VERSION == 3.* ]]; then
# arm64, ppc64le, s390x CPUs:
# "ERROR: Could not find a version that satisfies the requirement pyqt5"
sudo apt-get -qq install libxcb-xinerama0 pyqt5-dev-tools
python3 -m pip install pyqt5
fi
# webp
pushd depends && ./install_webp.sh && popd
# libimagequant
pushd depends && ./install_imagequant.sh && popd
# raqm
pushd depends && ./install_raqm.sh && popd
# extra test images
pushd depends && ./install_extra_test_images.sh && popd
else
cd depends && ./install_extra_test_images.sh && cd ..
fi fi
# webp
pushd depends && ./install_webp.sh && popd
# libimagequant
pushd depends && ./install_imagequant.sh && popd
# raqm
pushd depends && ./install_raqm.sh && popd
# extra test images
pushd depends && ./install_extra_test_images.sh && popd

1
.github/mergify.yml vendored
View File

@ -8,6 +8,7 @@ pull_request_rules:
- status-success=Docker Test Successful - status-success=Docker Test Successful
- status-success=Windows Test Successful - status-success=Windows Test Successful
- status-success=MinGW Test Successful - status-success=MinGW Test Successful
- status-success=Cygwin Test Successful
- status-success=continuous-integration/appveyor/pr - status-success=continuous-integration/appveyor/pr
actions: actions:
merge: merge:

View File

@ -4,88 +4,82 @@ on: [push, pull_request, workflow_dispatch]
jobs: jobs:
build: build:
runs-on: windows-2019 runs-on: windows-latest
name: Cygwin Python 3.8 strategy:
fail-fast: false
matrix:
python-minor-version: [7, 8]
architecture: ["x86", "x86_64"]
timeout-minutes: 30
name: Python 3.${{ matrix.python-minor-version }} ${{ matrix.architecture }}
steps: steps:
- name: Fix line endings
run: |
git config --global core.autocrlf input
- name: Checkout Pillow - name: Checkout Pillow
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set up Cygwin - name: Install Cygwin
uses: egor-tensin/setup-cygwin@v3 uses: cygwin/cygwin-install-action@v1
with: with:
platform: x64 platform: ${{ matrix.architecture }}
packages: > packages: >
libfreetype-devel libimagequant-devel libjpeg-devel ImageMagick jpeg python3${{ matrix.python-minor-version }}-cffi
liblcms2-devel libopenjp2-devel libraqm-devel python3${{ matrix.python-minor-version }}-devel
libtiff-devel libwebp-devel libxcb-devel libpng-devel python3${{ matrix.python-minor-version }}-numpy
ImageMagick jpeg netpbm perl xorg-server-extra python3${{ matrix.python-minor-version }}-sip
xorg-server-common xinit subversion python38-setuptools python3${{ matrix.python-minor-version }}-tkinter ghostscript
python38-devel python38-tkinter python38-wheel libfreetype-devel libimagequant-devel libjpeg-devel liblcms2-devel
python38-pip python38-olefile python38-numpy libopenjp2-devel libraqm-devel libtiff-devel libwebp-devel libxcb-devel
python38-pytest python38-sphinx python38-packaging libxcb-xinerama0 qt5-devel-tools xorg-server-extra zlib-devel
python38-cffi python38-requests
install-dir: 'C:\tools\cygwin'
- name: Clean up path
uses: egor-tensin/cleanup-path@v2
with:
dirs: 'C:\tools\cygwin\bin;C:\tools\cygwin\lib\lapack'
- name: Build system information - name: Build system information
run: C:\tools\cygwin\bin\python3.8 .github/workflows/system-info.py
- name: Ensure Python dependencies are installed
run: | run: |
C:\tools\cygwin\bin\python3.8 -m pip install pip wheel setuptools bash.exe -c "python3 .github/workflows/system-info.py"
C:\tools\cygwin\bin\python3.8 -m pip install -r requirements.txt
C:\tools\cygwin\bin\python3.8 -m pip install pytest-forked
- name: Download extra test images - name: Install dependencies
run: | run: |
C:\tools\cygwin\bin\dash -c "tr -d '\r' <depends/install_extra_test_images.sh >install_extra_test_images.sh" bash.exe .ci/install.sh
C:\tools\cygwin\bin\dash -c "mv install_extra_test_images.sh depends/install_extra_test_images.sh"
C:\tools\cygwin\bin\dash -c "cd depends; dash install_extra_test_images.sh"
- name: Build Pillow - name: Build
run: | run: |
C:\tools\cygwin\bin\python3.8 setup.py bdist_wheel bash.exe .ci/build_cygwin.sh
- name: Install Pillow - name: Test
run: | run: |
C:\tools\cygwin\bin\dash -c '/usr/bin/python3.8 -m pip install dist/*.whl' bash.exe xvfb-run -s '-screen 0 1024x768x24' .ci/test.sh
- name: Check Pillow configuration - name: Prepare to upload errors
if: failure()
run: | run: |
C:\tools\cygwin\bin\python3.8 selftest.py mkdir -p Tests/errors
- name: Test Pillow - name: Upload errors
run: | uses: actions/upload-artifact@v2
C:\tools\cygwin\bin\mv .ci/test.sh .ci/test.sh.dos if: failure()
C:\tools\cygwin\bin\dash -c "/bin/tr -d '\r' <.ci/test.sh.dos >.ci/test.sh" with:
C:\tools\cygwin\bin\chmod u+x .ci/test.sh name: errors
C:\tools\cygwin\bin\dash /usr/bin/xvfb-run -s '-screen 0 1024x768x24' .ci/test.sh .8 --ignore=Tests/test_numpy.py path: Tests/errors
- name: Test the possibly-segfaulting NumPy tests separately
run: |
C:\tools\cygwin\bin\python3.8 -m pytest --forked Tests/test_numpy.py -k roundtrip
- name: After success - name: After success
run: | run: |
C:\tools\cygwin\bin\mv .ci/after_success.sh .ci/after_success.sh.dos bash.exe .ci/after_success.sh
C:\tools\cygwin\bin\dash -c "tr -d '\r' <.ci/after_success.sh.dos >.ci/after_success.sh"
C:\tools\cygwin\bin\bash .ci/after_success.sh
- name: Upload coverage - name: Upload coverage
uses: codecov/codecov-action@v2 uses: codecov/codecov-action@v2
with: with:
file: ./coverage.xml file: ./coverage.xml
flags: GHA_Cygwin flags: GHA_Cygwin
name: ${{ runner.os }} Cygwin Python 3.8 ${{ matrix.architecture }} name: Cygwin Python 3.${{ matrix.python-minor-version }} ${{ matrix.architecture }}
- name: After failure success:
if: failure() needs: build
run: | runs-on: ubuntu-latest
C:\tools\cygwin\bin\uname -a name: Cygwin Test Successful
C:\tools\cygwin\bin\python3.8 -m pip list steps:
C:\tools\cygwin\bin\python3.8 -m pip show --files Pillow - name: Success
run: echo Cygwin Test Successful