Skip to content

Commit eca3e0e

Browse files
authored
Merge pull request #121 from brunoenten/master
Working cibuildwheel github action
2 parents c8676c1 + 56a579f commit eca3e0e

File tree

4 files changed

+136
-5
lines changed

4 files changed

+136
-5
lines changed

.github/workflows/main.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Build sdist and wheel and publish to PyPI and TestPyPI
2+
3+
#on: [push, pull_request]
4+
on:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
branches:
10+
- master
11+
12+
jobs:
13+
build_sdist:
14+
name: Build sdist
15+
runs-on: ubuntu-latest
16+
steps:
17+
18+
- uses: actions/checkout@v3
19+
with:
20+
submodules: true
21+
22+
- name: Install ninja
23+
run: pipx install ninja
24+
25+
- name: Build sdist
26+
run: pipx run build --sdist
27+
28+
- name: Check metadata
29+
run: pipx run twine check --strict dist/*
30+
31+
- uses: actions/upload-artifact@v3
32+
with:
33+
path: dist/*.tar.gz
34+
35+
build_wheels:
36+
name: Build wheels on ${{ matrix.os }}
37+
runs-on: ${{ matrix.os }}
38+
strategy:
39+
matrix:
40+
os: [ubuntu-latest, windows-latest, macos-latest]
41+
steps:
42+
43+
- uses: actions/checkout@v3
44+
with:
45+
submodules: true
46+
47+
- name: Build wheels
48+
uses: pypa/cibuildwheel@v2.11.4
49+
50+
- uses: actions/upload-artifact@v3
51+
with:
52+
path: wheelhouse/*.whl
53+
54+
build_arch_wheels:
55+
name: Build wheels on Linux ${{ matrix.arch }}
56+
runs-on: ubuntu-20.04
57+
strategy:
58+
matrix:
59+
arch: [aarch64]
60+
steps:
61+
62+
- uses: actions/checkout@v3
63+
with:
64+
submodules: true
65+
66+
- uses: docker/setup-qemu-action@v2
67+
with:
68+
platforms: all
69+
70+
- uses: pypa/cibuildwheel@v2.11.3
71+
env:
72+
CIBW_ARCHS: ${{ matrix.arch }}
73+
74+
- name: Verify clean directory
75+
run: git diff --exit-code
76+
shell: bash
77+
78+
- name: Upload wheels
79+
uses: actions/upload-artifact@v3
80+
with:
81+
path: wheelhouse/*.whl
82+
83+
upload_pypi:
84+
needs: [build_arch_wheels, build_wheels, build_sdist]
85+
runs-on: ubuntu-latest
86+
environment: PyPI release
87+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
88+
steps:
89+
90+
- uses: actions/download-artifact@v3
91+
with:
92+
# unpacks default artifact into dist/
93+
# if `name: artifact` is omitted, the action will create extra parent dir
94+
name: artifact
95+
path: dist
96+
97+
- name: Publish distribution to Test PyPI
98+
uses: pypa/gh-action-pypi-publish@v1.6.4
99+
with:
100+
skip_existing: true
101+
user: __token__
102+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
103+
repository_url: https://test.pypi.org/legacy/
104+
105+
- name: Publish distribution to PyPI
106+
if: startsWith(github.ref, 'refs/tags/v')
107+
uses: pypa/gh-action-pypi-publish@v1.6.4
108+
with:
109+
user: __token__
110+
password: ${{ secrets.PYPI_API_TOKEN }}

meson.build

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,30 @@ project(
66
default_options: [
77
'warning_level=2'
88
],
9-
meson_version: '>=0.60.0'
9+
meson_version: '>=0.63.0'
1010
)
1111

12-
# Dependencies
1312
cpp = meson.get_compiler('cpp')
13+
14+
## From https://github.com/numpy/numpy/blob/main/numpy/meson.build
15+
# Platform detection
16+
if host_machine.system() == 'windows' and cpp.get_id() == 'gcc'
17+
# For mingw-w64, link statically against the UCRT.
18+
gcc_link_args = ['-lucrt', '-static']
19+
20+
add_project_link_arguments(gcc_link_args, language: ['c', 'cpp'])
21+
# Force gcc to float64 long doubles for compatibility with MSVC
22+
# builds, for C only.
23+
add_project_arguments('-mlong-double-64', language: 'c')
24+
# Make fprintf("%zd") work (see https://github.com/rgommers/scipy/issues/118)
25+
add_project_arguments('-D__USE_MINGW_ANSI_STDIO=1', language: ['c', 'cpp'])
26+
# Manual add of MS_WIN64 macro when not using MSVC.
27+
# https://bugs.python.org/issue28267
28+
add_project_arguments('-DMS_WIN64', language: ['c', 'cpp'])
29+
endif
30+
##
31+
32+
# Dependencies
1433
jack2_dep = dependency('jack', version: '>=1.9.11', required: false)
1534
jack1_dep = dependency('jack', version: ['>=0.125.0', '<1.0'], required: false)
1635
alsa_dep = dependency('alsa', required: false)
@@ -20,7 +39,7 @@ coremidi_dep = dependency(
2039
modules: ['coreaudio', 'coremidi', 'foundation'],
2140
required: false
2241
)
23-
winmm_dep = dependency('winmm', required: false)
42+
winmm_dep = cpp.find_library('winmm', required: false)
2443

2544
if not jack2_dep.found() and jack1_dep.found()
2645
jack_dep = jack1_dep

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ manylinux-aarch64-image = "manylinux_2_28"
9090
build = "cp3{8,9,10,11}-manylinux*"
9191
archs = ["auto64"]
9292
before-all = [
93-
"yum install -y alsa-lib-devel alsa-utils",
93+
"dnf -y install alsa-lib-devel alsa-utils",
9494
"pipx install ninja",
9595
"curl -o jack2-1.9.21.tar.gz https://codeload.github.com/jackaudio/jack2/tar.gz/refs/tags/v1.9.21",
9696
"tar -xzf jack2-1.9.21.tar.gz",

rtmidi/meson.build

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ if host_machine.system() == 'linux' and alsa_dep.found() and get_option('alsa')
2525
endif
2626

2727
if host_machine.system() == 'windows' and get_option('winmm')
28-
defines += ['-D__WINDOWS_MM__', '/EHsc']
28+
if meson.get_compiler('cpp').get_id() != 'gcc'
29+
defines += ['-D__WINDOWS_MM__', '/EHsc']
30+
endif
2931
dependencies += [winmm_dep]
3032
endif
3133

0 commit comments

Comments
 (0)