Python AsyncIO building #52
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 Python AsyncIO | |
run-name: Python AsyncIO building | |
on: [push, pull_request] | |
permissions: | |
contents: write | |
pull-requests: read | |
jobs: | |
builds_linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
archit: [x86_64, aarch64] | |
include: | |
- archit: x86_64 | |
target: x86_64-unknown-linux-gnu | |
- archit: aarch64 | |
target: aarch64-unknown-linux-gnu | |
runs-on: ubuntu-latest | |
container: registry.cn-shanghai.aliyuncs.com/lebai/util:14.04 | |
steps: | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install Cross Compiler | |
if: ${{ matrix.archit == 'aarch64'}} | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Build | |
uses: PyO3/maturin-action@v1 | |
with: | |
container: off | |
manylinux: 2_17 | |
command: build | |
args: --release --features ffi_py_asyncio,mdns --target ${{matrix.target}} --skip-auditwheel | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Lebai_Python_AsyncIO_SDK_Linux_${{matrix.archit}} | |
path: ./target/wheels/*.whl | |
builds_macos: | |
strategy: | |
fail-fast: false | |
matrix: | |
archit: [x86_64, aarch64] | |
include: | |
- archit: x86_64 | |
target: x86_64-apple-darwin | |
- archit: aarch64 | |
target: aarch64-apple-darwin | |
runs-on: macos-latest | |
steps: | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Build | |
uses: PyO3/maturin-action@v1 | |
with: | |
container: off | |
command: build | |
args: --release --features ffi_py_asyncio,mdns --target ${{matrix.target}} | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Lebai_Python_AsyncIO_SDK_MacOS_${{matrix.archit}} | |
path: ./target/wheels/*.whl | |
builds_windows: | |
strategy: | |
fail-fast: false | |
matrix: | |
archit: [x86_64] | |
include: | |
- archit: x86_64 | |
target: x86_64-pc-windows-msvc | |
runs-on: windows-latest | |
steps: | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Build | |
uses: PyO3/maturin-action@v1 | |
with: | |
container: off | |
command: build | |
args: --release --features ffi_py_asyncio,mdns --target ${{matrix.target}} | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Lebai_Python_AsyncIO_SDK_Windows_${{matrix.archit}} | |
path: ./target/wheels/*.whl | |
release: | |
if: ${{ contains(github.ref, 'tags/v') }} | |
needs: [builds_linux, builds_macos, builds_windows] | |
strategy: | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- uses: actions/download-artifact@v3 | |
- name: Release | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
uses: PyO3/maturin-action@v1 | |
with: | |
container: off | |
command: upload | |
args: --skip-existing */*.whl | |
- name: Zip Artifact | |
run: for dir in `ls`; do zip -r ${dir}.zip ${dir}; done | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: false | |
prerelease: false | |
files: | | |
* |