From bd87653530bb522febf651cb9307a105d5641685 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sun, 24 Sep 2023 22:51:42 +1000 Subject: [PATCH] Updated wheel build process for new location --- .github/workflows/wheels-build.sh | 5 ++- .github/workflows/wheels-linux.yml | 9 ++--- .github/workflows/wheels-macos.yml | 9 ++--- .github/workflows/wheels.yml | 51 ++++++++++----------------- .gitmodules | 4 +-- .travis.yml | 16 ++++----- MANIFEST.in | 1 + README.md | 10 +++--- RELEASING.md | 17 ++++----- docs/about.rst | 2 +- docs/index.rst | 10 +++--- wheels/README.md | 31 +++++++++++++++++ wheels/README.rst | 55 ------------------------------ wheels/config.sh | 14 ++++---- 14 files changed, 93 insertions(+), 141 deletions(-) create mode 100644 wheels/README.md delete mode 100644 wheels/README.rst diff --git a/.github/workflows/wheels-build.sh b/.github/workflows/wheels-build.sh index 56397b785..0948a1b94 100755 --- a/.github/workflows/wheels-build.sh +++ b/.github/workflows/wheels-build.sh @@ -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::" diff --git a/.github/workflows/wheels-linux.yml b/.github/workflows/wheels-linux.yml index 7b596cf55..e5a7d0e50 100644 --- a/.github/workflows/wheels-linux.yml +++ b/.github/workflows/wheels-linux.yml @@ -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 }} diff --git a/.github/workflows/wheels-macos.yml b/.github/workflows/wheels-macos.yml index d61399639..b4f7d6d81 100644 --- a/.github/workflows/wheels-macos.yml +++ b/.github/workflows/wheels-macos.yml @@ -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 }} diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 9c13f9315..4381a9856 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -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: diff --git a/.gitmodules b/.gitmodules index 0c15f2bba..80d5ab16c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/.travis.yml b/.travis.yml index 193fa932f..4c0320e87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/MANIFEST.in b/MANIFEST.in index 606e7e074..2bbddefa3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -29,3 +29,4 @@ global-exclude .git* global-exclude *.pyc global-exclude *.so prune .ci +prune wheels diff --git a/README.md b/README.md index af1ca57c2..994146cd5 100644 --- a/README.md +++ b/README.md @@ -45,12 +45,12 @@ As of 2019, Pillow development is AppVeyor CI build status (Windows) - GitHub Actions wheels build status (Wheels) - GitHub Actions build status (Wheels) + Travis CI wheels build status (aarch64) + src="https://img.shields.io/travis/com/python-pillow/Pillow/main.svg?label=aarch64%20wheels"> Code coverage diff --git a/RELEASING.md b/RELEASING.md index 604bb1b8c..0229dbbc1 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -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) diff --git a/docs/about.rst b/docs/about.rst index 03829c133..872ac0ea6 100644 --- a/docs/about.rst +++ b/docs/about.rst @@ -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/ diff --git a/docs/index.rst b/docs/index.rst index 418844ba7..99da614a4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -37,12 +37,12 @@ Pillow for enterprise is available via the Tidelift Subscription. `Learn more - -.. 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 `_. - -PyPI -~~~~ - -Download wheels from the -`latest release `_ and upload -to PyPI:: - - python3 -m twine upload Pillow--* diff --git a/wheels/config.sh b/wheels/config.sh index 15b478859..1907e2099 100644 --- a/wheels/config.sh +++ b/wheels/config.sh @@ -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())))')