-
Notifications
You must be signed in to change notification settings - Fork 1
143 lines (140 loc) · 4.02 KB
/
python.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Build Python
run-name: Python 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,mdns --target ${{matrix.target}} --skip-auditwheel
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Lebai_Python_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,mdns --target ${{matrix.target}}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Lebai_Python_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,mdns --target ${{matrix.target}}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Lebai_Python_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:
- uses: actions/download-artifact@v3
- 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: |
*