Updated wheel build process for new location

This commit is contained in:
Andrew Murray 2023-09-24 22:51:42 +10:00
parent 905cf06b6b
commit bd87653530
14 changed files with 93 additions and 141 deletions

View File

@ -21,14 +21,13 @@ if [[ "$MB_PYTHON_VERSION" == pypy3* ]]; then
fi
echo "::group::Install a virtualenv"
source multibuild/common_utils.sh
source multibuild/travis_steps.sh
source wheels/multibuild/common_utils.sh
source wheels/multibuild/travis_steps.sh
python3 -m pip install virtualenv
before_install
echo "::endgroup::"
echo "::group::Build wheel"
clean_code
build_wheel
ls -l "${GITHUB_WORKSPACE}/${WHEEL_SDIR}/"
echo "::endgroup::"

View File

@ -3,15 +3,13 @@ name: Build Linux wheels
on:
workflow_call:
inputs:
build-commit:
required: true
type: string
artifacts-name:
required: true
type: string
env:
REPO_DIR: Pillow
CONFIG_PATH: "wheels/config.sh"
REPO_DIR: "."
TEST_DEPENDS: "pytest pytest-timeout"
jobs:
@ -49,7 +47,6 @@ jobs:
mb-ml-libc: "musllinux"
mb-ml-ver: "_1_1"
env:
BUILD_COMMIT: ${{ inputs.build-commit }}
MB_PYTHON_VERSION: ${{ matrix.python }}
MB_ML_LIBC: ${{ matrix.mb-ml-libc }}
MB_ML_VER: ${{ matrix.mb-ml-ver }}
@ -61,7 +58,7 @@ jobs:
with:
python-version: "3.x"
- name: Build Wheel
run: .github/workflows/build.sh
run: .github/workflows/wheels-build.sh
- uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifacts-name }}

View File

@ -3,15 +3,13 @@ name: Build macOS wheels
on:
workflow_call:
inputs:
build-commit:
required: true
type: string
artifacts-name:
required: true
type: string
env:
REPO_DIR: Pillow
CONFIG_PATH: "wheels/config.sh"
REPO_DIR: "."
TEST_DEPENDS: "pytest pytest-timeout"
jobs:
@ -37,7 +35,6 @@ jobs:
- python: "pypy3.10-7.3.12"
platform: "arm64"
env:
BUILD_COMMIT: ${{ inputs.build-commit }}
PLAT: ${{ matrix.platform }}
MB_PYTHON_VERSION: ${{ matrix.python }}
TRAVIS_OS_NAME: "osx"
@ -49,7 +46,7 @@ jobs:
with:
python-version: "3.x"
- name: Build Wheel
run: .github/workflows/build.sh
run: .github/workflows/wheels-build.sh
- uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifacts-name }}

View File

@ -1,6 +1,20 @@
name: Wheels
on: [push, pull_request, workflow_dispatch]
on:
push:
paths:
- ".github/workflows/wheels*.yml"
- "wheels/*"
tags:
- "*"
pull_request:
paths:
- ".github/workflows/wheels*.yml"
- "wheels/*"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@ -10,46 +24,17 @@ jobs:
macos:
uses: ./.github/workflows/wheels-macos.yml
with:
build-commit: "HEAD"
artifacts-name: "wheels"
linux:
uses: ./.github/workflows/wheels-linux.yml
with:
build-commit: "HEAD"
artifacts-name: "wheels"
macos-latest:
if: "!startsWith(github.ref, 'refs/tags/')"
uses: ./.github/workflows/wheels-macos.yml
with:
build-commit: "main"
artifacts-name: "wheels-latest"
linux-latest:
if: "!startsWith(github.ref, 'refs/tags/')"
uses: ./.github/workflows/wheels-linux.yml
with:
build-commit: "main"
artifacts-name: "wheels-latest"
release:
name: Create Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [macos, linux]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- name: Upload Release
uses: fnkr/github-action-ghr@v1.3
env:
GHR_PATH: .
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
success:
needs: [macos, linux, macos-latest, linux-latest]
permissions:
contents: none
needs: [macos, linux]
runs-on: ubuntu-latest
name: Wheels Successful
steps:

4
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "multibuild"]
path = wheels/multibuild
url = https://github.com/multi-build/multibuild.git
path = wheels/multibuild
url = https://github.com/multi-build/multibuild.git

View File

@ -1,9 +1,11 @@
if: tag IS present
env:
global:
- REPO_DIR=Pillow
- BUILD_COMMIT=HEAD
- CONFIG_PATH=wheels/config.sh
- REPO_DIR=.
- PLAT=aarch64
- TEST_DEPENDS="pytest-timeout"
- TEST_DEPENDS=pytest-timeout
language: python
# Default Python version is usually 3.6
@ -110,13 +112,11 @@ jobs:
- MB_PYTHON_VERSION=3.12
before_install:
- source multibuild/common_utils.sh
- source multibuild/travis_steps.sh
- source wheels/multibuild/common_utils.sh
- source wheels/multibuild/travis_steps.sh
- before_install
install:
# Maybe get and clean and patch source
- clean_code
- build_multilinux aarch64 build_wheel
- ls -l "${TRAVIS_BUILD_DIR}/${WHEEL_SDIR}/"
@ -130,6 +130,6 @@ deploy:
file_glob: true
file: "${TRAVIS_BUILD_DIR}/${WHEEL_SDIR}/*.whl"
on:
repo: python-pillow/pillow-wheels
repo: python-pillow/Pillow
tags: true
skip_cleanup: true

View File

@ -29,3 +29,4 @@ global-exclude .git*
global-exclude *.pyc
global-exclude *.so
prune .ci
prune wheels

View File

@ -45,12 +45,12 @@ As of 2019, Pillow development is
<a href="https://ci.appveyor.com/project/python-pillow/Pillow"><img
alt="AppVeyor CI build status (Windows)"
src="https://img.shields.io/appveyor/build/python-pillow/Pillow/main.svg?label=Windows%20build"></a>
<a href="https://github.com/python-pillow/pillow-wheels/actions"><img
alt="GitHub Actions wheels build status (Wheels)"
src="https://github.com/python-pillow/pillow-wheels/workflows/Wheels/badge.svg"></a>
<a href="https://app.travis-ci.com/github/python-pillow/pillow-wheels"><img
<a href="https://github.com/python-pillow/Pillow/actions/workflows/wheels.yml"><img
alt="GitHub Actions build status (Wheels)"
src="https://github.com/python-pillow/Pillow/workflows/Wheels/badge.svg"></a>
<a href="https://app.travis-ci.com/github/python-pillow/Pillow"><img
alt="Travis CI wheels build status (aarch64)"
src="https://img.shields.io/travis/com/python-pillow/pillow-wheels/main.svg?label=aarch64%20wheels"></a>
src="https://img.shields.io/travis/com/python-pillow/Pillow/main.svg?label=aarch64%20wheels"></a>
<a href="https://app.codecov.io/gh/python-pillow/Pillow"><img
alt="Code coverage"
src="https://codecov.io/gh/python-pillow/Pillow/branch/main/graph/badge.svg"></a>

View File

@ -10,7 +10,7 @@ Released quarterly on January 2nd, April 1st, July 1st and October 15th.
* [ ] Open a release ticket e.g. https://github.com/python-pillow/Pillow/issues/3154
* [ ] Develop and prepare release in `main` branch.
* [ ] Check [GitHub Actions](https://github.com/python-pillow/Pillow/actions) and [AppVeyor](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm passing tests in `main` branch.
* [ ] Check that all of the wheel builds [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels) pass the tests in Travis CI and GitHub Actions.
* [ ] Check that all of the wheel builds pass the tests in the [GitHub Actions "Wheels" workflow](https://github.com/python-pillow/Pillow/actions/workflows/wheels.yml) and [Travis CI](https://app.travis-ci.com/github/python-pillow/pillow) jobs by manually triggering them.
* [ ] In compliance with [PEP 440](https://peps.python.org/pep-0440/), update version identifier in `src/PIL/_version.py`
* [ ] Update `CHANGES.rst`.
* [ ] Run pre-release check via `make release-test` in a freshly cloned repo.
@ -99,17 +99,14 @@ Released as needed privately to individual vendors for critical security-related
## Binary Distributions
### macOS and Linux
* [ ] Use the [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels):
* [ ] Download wheels from the [GitHub Actions "Wheels" workflow](https://github.com/python-pillow/Pillow/actions/workflows/wheels.yml)
and copy into `dist/`. For example using [GitHub CLI](https://github.com/cli/cli):
```bash
git clone https://github.com/python-pillow/pillow-wheels
cd pillow-wheels
./update-pillow-tag.sh [[release tag]]
```
* [ ] Download wheels from the [Pillow Wheel Builder release](https://github.com/python-pillow/pillow-wheels/releases)
and copy into `dist/`. For example using [GitHub CLI](https://github.com/cli/cli) from the main repo:
```bash
gh release download --dir dist --pattern "*.whl" --repo python-pillow/pillow-wheels
gh run download --dir dist
# select dist-x.y.z
```
* [ ] Download the Linux aarch64 wheels created by Travis CI from [GitHub releases](https://github.com/python-pillow/Pillow/releases)
and copy into `dist`.
### Windows
* [ ] Download the artifacts from the [GitHub Actions "Test Windows" workflow](https://github.com/python-pillow/Pillow/actions/workflows/test-windows.yml)

View File

@ -12,7 +12,7 @@ The fork author's goal is to foster and support active development of PIL throug
.. _GitHub Actions: https://github.com/python-pillow/Pillow/actions
.. _AppVeyor: https://ci.appveyor.com/project/Python-pillow/pillow
.. _Travis CI: https://app.travis-ci.com/github/python-pillow/pillow-wheels
.. _Travis CI: https://app.travis-ci.com/github/python-pillow/Pillow
.. _GitHub: https://github.com/python-pillow/Pillow
.. _Python Package Index: https://pypi.org/project/Pillow/

View File

@ -37,12 +37,12 @@ Pillow for enterprise is available via the Tidelift Subscription. `Learn more <h
:target: https://ci.appveyor.com/project/python-pillow/Pillow
:alt: AppVeyor CI build status (Windows)
.. image:: https://github.com/python-pillow/pillow-wheels/workflows/Wheels/badge.svg
:target: https://github.com/python-pillow/pillow-wheels/actions
:alt: GitHub Actions wheels build status (Wheels)
.. image:: https://github.com/python-pillow/Pillow/workflows/Wheels/badge.svg
:target: https://github.com/python-pillow/Pillow/actions/workflows/wheels.yml
:alt: GitHub Actions build status (Wheels)
.. image:: https://img.shields.io/travis/com/python-pillow/pillow-wheels/main.svg?label=aarch64%20wheels
:target: https://app.travis-ci.com/github/python-pillow/pillow-wheels
.. image:: https://img.shields.io/travis/com/python-pillow/Pillow/main.svg?label=aarch64%20wheels
:target: https://app.travis-ci.com/github/python-pillow/Pillow
:alt: Travis CI wheels build status (aarch64)
.. image:: https://codecov.io/gh/python-pillow/Pillow/branch/main/graph/badge.svg

31
wheels/README.md Normal file
View File

@ -0,0 +1,31 @@
README
------
This directory creates wheels for tagged versions of Pillow.
Archives
--------
https://github.com/python-pillow/pillow-depends contains archives for libraries
that will be built as part of the Pillow build.
In general, there is no need to put library archives there, because the
`multibuild` scripts will download them from their respective URLs.
But, the build will look in that repository before downloading from the
URL, so if there is a library that often fails to download, or you think might
fail to download, then download it and add it to the Git repository.
See the `pre_build` in `config.sh` and the `fetch_unpack` routine in
`multibuild/common_utils.sh` for the logic, and the build recipes in
`multibuild/library_builders.sh` for the filename to give to the downloaded
archive.
Wheels
------
Wheels are
[GitHub Actions artifacts created for tags, relevant changes or manual builds](https://github.com/python-pillow/Pillow/actions/workflows/wheels.yml).
Windows wheels are not created here. Instead, they are
[GitHub Actions artifacts created on each run of the Pillow repository](https://github.com/python-pillow/Pillow/actions/workflows/test-windows.yml?query=branch%3Amain).

View File

@ -1,55 +0,0 @@
Pillow Wheel Builder
====================
This repository creates wheels for tagged versions of Pillow::
./update-pillow-tag.sh <VERSION>
.. image:: https://github.com/python-pillow/pillow-wheels/workflows/Lint/badge.svg
:target: https://github.com/python-pillow/pillow-wheels/actions/workflows/lint.yml
:alt: GitHub Actions build status (Lint)
.. image:: https://github.com/python-pillow/pillow-wheels/workflows/Wheels/badge.svg
:target: https://github.com/python-pillow/pillow-wheels/actions/workflows/wheels.yml
:alt: GitHub Actions build status (Wheels)
.. image:: https://img.shields.io/travis/com/python-pillow/pillow-wheels/main.svg
:target: https://app.travis-ci.com/github/python-pillow/pillow-wheels
:alt: Travis CI build status
Archives
--------
https://github.com/python-pillow/pillow-depends contains archives for libraries
that will be built as part of the Pillow build.
In general, there is no need to put library archives there, because the
``multibuild`` scripts will download them from their respective URLs.
But, the build will look in that repository before downloading from the
URL, so if there is a library that often fails to download, or you think might
fail to download, then download it and add it to the Git repository.
See the ``pre_build`` in ``config.sh`` and the ``fetch_unpack`` routine in
``multibuild/common_utils.sh`` for the logic, and the build recipes in
``multibuild/library_builders.sh`` for the filename to give to the downloaded
archive.
Wheels
------
Wheels are uploaded to https://github.com/python-pillow/pillow-wheels/releases.
Credentials for this specific repo are stored in a Travis CI secret, so the upload
won't work from another repository.
Windows wheels are not created here. Instead, they are
`GitHub Actions artifacts created on each run of the Pillow repository <https://github.com/python-pillow/Pillow/actions/workflows/test-windows.yml?query=branch%3Amain>`_.
PyPI
~~~~
Download wheels from the
`latest release <https://github.com/python-pillow/pillow-wheels/releases>`_ and upload
to PyPI::
python3 -m twine upload Pillow-<VERSION>-*

View File

@ -119,9 +119,9 @@ function pre_build {
fi
# Append licenses
for filename in dependency_licenses/*; do
echo -e "\n\n----\n\n$(basename $filename | cut -f 1 -d '.')\n" | cat >> Pillow/LICENSE
cat $filename >> Pillow/LICENSE
for filename in wheels/dependency_licenses/*; do
echo -e "\n\n----\n\n$(basename $filename | cut -f 1 -d '.')\n" | cat >> LICENSE
cat $filename >> LICENSE
done
}
@ -130,7 +130,7 @@ function pip_wheel_cmd {
if [ -z "$IS_MACOS" ]; then
CFLAGS="$CFLAGS --std=c99" # for Raqm
fi
pip wheel $(pip_opts) \
python3 -m pip wheel $(pip_opts) \
-C raqm=enable -C raqm=vendor -C fribidi=vendor \
-w $abs_wheelhouse --no-deps .
}
@ -138,7 +138,7 @@ function pip_wheel_cmd {
function run_tests_in_repo {
# Run Pillow tests from within source repo
python3 selftest.py
pytest
python3 -m pytest
}
EXP_CODECS="jpg jpg_2000 libtiff zlib"
@ -162,10 +162,10 @@ function run_tests {
curl -fsSL -o pillow-test-images.zip https://github.com/python-pillow/test-images/archive/main.zip
untar pillow-test-images.zip
mv test-images-main/* ../Pillow/Tests/images
mv test-images-main/* ../Tests/images
# Runs tests on installed distribution from an empty directory
(cd ../Pillow && run_tests_in_repo)
(cd .. && run_tests_in_repo)
# Test against expected codecs, modules and features
local ret=0
local codecs=$(python3 -c 'from PIL.features import *; print(" ".join(sorted(get_supported_codecs())))')