Files
ncnn/.github/workflows/release-python.yml
T
2022-06-29 22:38:21 +08:00

140 lines
2.9 KiB
YAML

name: release-python
on:
push:
tags:
- '*'
jobs:
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install deps
run: python -m pip install twine build
- name: Build SDist
run: python -m build -s
- name: Check metadata
run: twine check dist/*
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019, macos-10.15]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Build wheels
uses: pypa/cibuildwheel@2.7.0
env:
CIBW_ARCHS_MACOS: x86_64 universal2 arm64
CIBW_ARCHS_LINUX: x86_64 i686
- name: Show files
run: ls -lh wheelhouse
shell: bash
- name: Verify clean directory
run: git diff --exit-code
shell: bash
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl
build_wheels_qemu:
name: Build wheels ${{ matrix.arch }} ${{ matrix.build }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
arch: [aarch64, ppc64le, s390x]
build: ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp310-*"]
include:
- arch: aarch64
build: "pp37-*"
- arch: aarch64
build: "pp38-*"
- arch: aarch64
build: "pp39-*"
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@2.7.0
env:
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.build }}
- name: Show files
run: ls -lh wheelhouse
shell: bash
- name: Verify clean directory
run: git diff --exit-code
shell: bash
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl
upload_all:
permissions:
contents: none
name: Upload
needs: [build_wheels, build_wheels_qemu, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}