1
0
Fork 0
mirror of https://github.com/ultrajson/ultrajson.git synced 2024-06-01 05:26:08 +02:00

Split macOS/Windows and Linux, and split Linux into matrix

This commit is contained in:
Hugo van Kemenade 2021-09-10 15:13:30 +03:00
parent 0b446e0d66
commit c7125ada87
2 changed files with 72 additions and 34 deletions

View File

@ -1,4 +1,4 @@
name: Deploy wheels
name: Deploy Linux wheels
on:
push:
@ -7,17 +7,21 @@ on:
release:
types:
- published
jobs:
build:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
wheel: [
"manylinux2014_aarch64",
"manylinux2014_i686",
"manylinux2014_x86_64",
]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10-dev"]
include:
# Add version-tag variable to existing jobs. Only used for Linux.
# Add version-tag variable to existing jobs
- { python-version: "3.6", version-tag: "cp36-cp36m" }
- { python-version: "3.7", version-tag: "cp37-cp37m" }
- { python-version: "3.8", version-tag: "cp38-cp38" }
@ -38,44 +42,17 @@ jobs:
run: |
python -m pip install --upgrade -q pip pytest wheel setuptools twine
- name: Test with pytest
if: matrix.os != 'ubuntu-latest'
run: |
pip install .
pytest
- name: Build macOS/Windows wheel
if: matrix.os != 'ubuntu-latest'
run: python setup.py -q bdist_wheel
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-qemu-action@v1
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-buildx-action@v1
- name: Build x86_64 Linux wheels
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
# Build all at once
- name: Build ${{ matrix.wheel }} wheels
run: |
docker run -v `pwd`:/io quay.io/pypa/manylinux2014_x86_64 /io/scripts/build-manylinux-wheels.sh
- name: Build i686 Linux wheels
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
# Build all at once
run: |
docker run -v `pwd`:/io quay.io/pypa/manylinux2014_i686 /io/scripts/build-manylinux-wheels.sh
- name: Build aarch64 Linux wheels
if: matrix.os == 'ubuntu-latest'
# aarch64 building is slow, let's pass version-tag to build each Python version in parallel
run: |
docker run -v `pwd`:/io quay.io/pypa/manylinux2014_aarch64 /io/scripts/build-manylinux-wheels.sh ${{ matrix.version-tag }}
docker run -v `pwd`:/io quay.io/pypa/${{ matrix.wheel }} /io/scripts/build-manylinux-wheels.sh ${{ matrix.version-tag }}
- name: Upload as build artifacts
uses: actions/upload-artifact@v2

View File

@ -0,0 +1,61 @@
name: Deploy Windows/macOS wheels
on:
push:
branches:
- main
release:
types:
- published
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macOS-latest]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10-dev"]
steps:
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade -q pip pytest wheel setuptools twine
- name: Test with pytest
run: |
pip install .
pytest
- name: Build wheel
run: python setup.py -q bdist_wheel
- name: Upload as build artifacts
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist/*.whl
- name: Publish package to PyPI
if: github.event.action == 'published'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: twine upload --skip-existing dist/*.whl
- name: Publish package to TestPyPI
if: github.repository == 'ultrajson/ultrajson'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.test_pypi_password }}
run: |
twine upload --repository-url https://test.pypi.org/legacy/ --skip-existing dist/*.whl