Only build sdist once #81
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Build | |
on: [push, pull_request] | |
jobs: | |
build_sdist: | |
name: Build sdist | |
runs-on: ubuntu-latest | |
outputs: | |
sdist_name: ${{ steps.build_sdist.outputs.sdist_name }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Debug patch | |
run: patch -d uwsgi -p1 < uwsgi-version-debug.txt | |
- name: Build sdist | |
id: build_sdist | |
run: | | |
git submodule update --init | |
make sdist | |
echo "sdist_name=pyuwsgi-$(make version)" >> $GITHUB_OUTPUT | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
build_wheels: | |
name: Build wheels for ${{ matrix.os }} | |
needs: [build_sdist] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, macos-11] | |
fail-fast: false | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Unpack sdist | |
run: | | |
tar -xvzf "dist/${{ needs.build_sdist.outputs.sdist_name }}.tar.gz" | |
rm -rf dist | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v1 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
output-dir: dist | |
package-dir: ./${{ needs.build_sdist.outputs.sdist_name }} | |
env: | |
CIBW_ARCHS_LINUX: auto aarch64 | |
CIBW_ARCHS_MACOS: x86_64 | |
# cross-compile for arm64 on macos isn't working yet | |
# https://github.com/lincolnloop/pyuwsgi-wheels/issues/18 | |
# CIBW_ARCHS_MACOS: x86_64 arm64 | |
# tesing on emulated arm64 isn't supported for MacOS | |
# CIBW_TEST_SKIP: "*-macosx_arm64" | |
CIBW_SKIP: cp36-* pp* | |
CIBW_ENVIRONMENT: APPEND_VERSION=".post0" UWSGI_PROFILE=pyuwsginossl | |
CIBW_TEST_COMMAND: pyuwsgi --help | |
CIBW_BEFORE_ALL: ./patch-uwsgi-packaging.sh uwsgi | |
CIBW_BEFORE_BUILD_MACOS: IS_MACOS=1 ./pre_build.sh | |
CIBW_BEFORE_BUILD_LINUX: ./pre_build.sh && (yum install -y zlib-devel || apk add zlib-dev) | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
verify: | |
name: Verify wheels | |
runs-on: ubuntu-latest | |
needs: [build_wheels] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Verify wheels | |
run: ls -lh dist | |
pypi-publish: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
needs: [verify] | |
name: Upload release to PyPI | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/pyuwsgi | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |