-
Notifications
You must be signed in to change notification settings - Fork 12
195 lines (189 loc) · 6.11 KB
/
publish-pypi.yaml
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
on:
release:
types: [created, edited]
name: publish pypi
jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
python: [
{ version: '3.8', abi: 'cp38-cp38' },
{ version: '3.9', abi: 'cp39-cp39' },
{ version: '3.10', abi: 'cp310-cp310' },
{ version: '3.11', abi: 'cp311-cp311' },
{ version: '3.12', abi: 'cp312-cp312' },
]
target: [x86_64, i686, aarch64, armv7]
steps:
- uses: actions/checkout@v4
- uses: messense/maturin-action@v1
name: build pylancelot for linux (${{ matrix.target }})
env:
PYO3_CROSS_LIB_DIR: /opt/python/${{ matrix.python.abi }}/lib
with:
maturin-version: 1.4.0
target: ${{ matrix.target }}
manylinux: auto
command: build
args: --interpreter=python${{ matrix.python.version }} --release --strip --manifest-path=./pylancelot/Cargo.toml
- uses: messense/maturin-action@v1
name: build pyflirt for linux (${{ matrix.target }})
env:
PYO3_CROSS_LIB_DIR: /opt/python/${{ matrix.python.abi }}/lib
with:
maturin-version: 1.4.0
target: ${{ matrix.target }}
manylinux: auto
command: build
args: --interpreter=python${{ matrix.python.version }} --release --strip --manifest-path=./pyflirt/Cargo.toml
- uses: actions/upload-artifact@v4
name: upload
with:
name: wheels-linux-${{ matrix.python.version }}-${{ matrix.target }}
path: target/wheels/*.whl
windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
python: [
{ version: '3.8' },
{ version: '3.9' },
{ version: '3.10' },
{ version: '3.11' },
{ version: '3.12' },
]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
architecture: ${{ matrix.target }}
- name: install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- uses: messense/maturin-action@v1
name: build pylancelot for windows (${{ matrix.target }})
with:
maturin-version: 1.4.0
command: build
target: ${{ matrix.target }}
args: --interpreter=python${{ matrix.python.version }} --release --strip --manifest-path=./pylancelot/Cargo.toml
- uses: messense/maturin-action@v1
name: build pyflirt for windows (${{ matrix.target }})
with:
maturin-version: 1.4.0
command: build
target: ${{ matrix.target }}
args: --interpreter=python${{ matrix.python.version }} --release --strip --manifest-path=./pyflirt/Cargo.toml
- uses: actions/upload-artifact@v4
name: upload
with:
name: wheels-windows-${{ matrix.python.version }}-${{ matrix.target }}
path: target/wheels/*.whl
macos:
runs-on: macos-latest
strategy:
matrix:
python: [
{ version: '3.8' },
{ version: '3.9' },
{ version: '3.10' },
{ version: '3.11' },
{ version: '3.12' },
]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
architecture: x64
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.24.3'
- name: install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
#
# aarch64 build
#
- name: Install aarch64-apple-darwin toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-apple-darwin
- uses: messense/maturin-action@v1
name: build pylancelot for macos (universal2)
env:
# needed due to: https://stackoverflow.com/a/56092773/87207
MACOSX_DEPLOYMENT_TARGET: 10.9
with:
maturin-version: 1.4.0
command: build
args: --interpreter=python${{ matrix.python.version }} --release --target universal2-apple-darwin --strip --manifest-path=./pylancelot/Cargo.toml
- uses: messense/maturin-action@v1
name: build pyflirt for macos (universal2)
env:
MACOSX_DEPLOYMENT_TARGET: 10.9
with:
maturin-version: 1.4.0
command: build
args: --interpreter=python${{ matrix.python.version }} --release --target universal2-apple-darwin --strip --manifest-path=./pyflirt/Cargo.toml
#
# x86_64 build
#
- uses: messense/maturin-action@v1
name: build pylancelot for macos (x86_64)
env:
MACOSX_DEPLOYMENT_TARGET: 10.9
with:
maturin-version: 1.4.0
command: build
target: x86_64
args: --interpreter=python${{ matrix.python.version }} --release --strip --manifest-path=./pylancelot/Cargo.toml
- uses: messense/maturin-action@v1
name: build pyflirt for macos (x86_64)
env:
MACOSX_DEPLOYMENT_TARGET: 10.9
with:
maturin-version: 1.4.0
command: build
target: x86_64
args: --interpreter=python${{ matrix.python.version }} --release --strip --manifest-path=./pyflirt/Cargo.toml
- uses: actions/upload-artifact@v4
name: upload
with:
name: wheels-macos-${{ matrix.python.version }}
path: target/wheels/*.whl
pypi-publish:
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [ macos, windows, linux ]
environment:
name: release
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts/
- name: move files to dist/
run: |
shopt -s globstar # Enable recursive globbing (**)
rm -rf dist/
mkdir dist/
cp -r artifacts/**/*.whl dist/
- name: publish package
uses: pypa/gh-action-pypi-publish@f5622bde02b04381239da3573277701ceca8f6a0 # release/v1
with:
skip-existing: true
verbose: true
print-hash: true