-
Notifications
You must be signed in to change notification settings - Fork 3
297 lines (225 loc) · 6.84 KB
/
ci.yml
File metadata and controls
297 lines (225 loc) · 6.84 KB
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
name: CI
on:
push:
branches: [ "main" ]
tags: [ "v0.*", "v1.*" ]
pull_request:
branches: [ "main" ]
workflow_dispatch: {}
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install isort==5.13.2 flake8==7.0.0
- name: Check coding style (flake8)
run: "flake8 alsa_midi tests"
- name: Check imports sorting (isort)
run: "isort --check --dont-follow-links alsa_midi tests"
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
sudo apt update
sudo apt install -y libasound2-dev
- name: Run tests
run: "tox -e py -- -vv"
test-on-alsa-kernel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Multipass
run: |
sudo snap install multipass --classic
sudo snap wait system seed.loaded
sleep 5
- name: Start Multipass VM
run: |
sudo multipass launch 24.04 -n test-vm
sleep 10
- name: Run tests in Multipass VM
run: |
set -x
sudo multipass exec test-vm -- sudo modprobe snd-seq-device
sudo multipass exec test-vm -- sudo modprobe snd-seq-dummy
sudo multipass exec test-vm -- sudo modprobe snd-rawmidi
sudo multipass exec test-vm -- sudo sh -c 'chmod a+rw /dev/snd/*'
sudo multipass transfer --recursive $PWD test-vm:/home/ubuntu/code
sudo multipass exec test-vm -- sudo apt install -y python3-cffi python3-venv python3-pip python3-wheel python3-venv libffi-dev libasound-dev alsa-utils
curl -LsSf https://astral.sh/uv/install.sh | sudo multipass exec test-vm -- sh
sudo multipass exec test-vm -- bash -c '. $HOME/.local/bin/env && cd code && uvx tox -e py -- -vv'
- name: Stop and delete VM
run: |
sudo multipass stop test-vm
sudo multipass delete test-vm
sudo multipass purge
build-pure:
needs:
- test
- test-on-alsa-kernel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine
sudo apt update
- name: Build
run: |
export PY_ALSA_MIDI_NO_COMPILE=1
python -m build .
twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: dist-pure
path: dist
# separate jobs, as matrix does not work with 'uses: docker://' and 'container:' does not work well with 'actions/checkout'
build-manylinux_2_12_x86_64:
needs:
- test
- test-on-alsa-kernel
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build and test ${{ matrix.manylinux-tag }} wheels
uses: docker://quay.io/pypa/manylinux2010_x86_64
with:
args: ./build-wheels.sh manylinux_2_12_x86_64
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: wheelhouse-manylinux_2_12_x86_64
path: wheelhouse
build-manylinux_2_12_i686:
needs:
- test
- test-on-alsa-kernel
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build and test ${{ matrix.manylinux-tag }} wheels
uses: docker://quay.io/pypa/manylinux2010_i686
with:
args: linux32 ./build-wheels.sh manylinux_2_12_i686
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: wheelhouse-manylinux_2_12_i686
path: wheelhouse
build-manylinux_2_17_x86_64:
needs:
- test
- test-on-alsa-kernel
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build and test ${{ matrix.manylinux-tag }} wheels
uses: docker://quay.io/pypa/manylinux2014_x86_64
with:
args: ./build-wheels.sh manylinux_2_17_x86_64
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: wheelhouse-manylinux_2_17_x86_64
path: wheelhouse
build-manylinux_2_17_i686:
needs:
- test
- test-on-alsa-kernel
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build and test ${{ matrix.manylinux-tag }} wheels
uses: docker://quay.io/pypa/manylinux2014_i686
with:
args: linux32 ./build-wheels.sh manylinux_2_17_i686
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: wheelhouse-manylinux_2_17_i686
path: wheelhouse
build-manylinux_2_28_x86_64:
needs:
- test
- test-on-alsa-kernel
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build and test ${{ matrix.manylinux-tag }} wheels
uses: docker://quay.io/pypa/manylinux_2_28_x86_64
with:
args: ./build-wheels.sh manylinux_2_28_x86_64
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: wheelhouse-manylinux_2_28_x86_64
path: wheelhouse
publish:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
environment:
name: pypi
url: https://pypi.org/p/alsa-midi
permissions:
id-token: write
needs:
- build-pure
- build-manylinux_2_12_x86_64
- build-manylinux_2_12_i686
- build-manylinux_2_17_x86_64
- build-manylinux_2_17_i686
- build-manylinux_2_28_x86_64
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v7
- name: Collect dist files
run: |
ls -lR .
mkdir -p dist
mv wheelhouse-*/*manylinux*.whl dist/
mv dist-pure/*-py3-none-any.whl dist/
mv dist-pure/*.tar.gz dist/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1