-
Notifications
You must be signed in to change notification settings - Fork 117
187 lines (159 loc) · 6.04 KB
/
wheels.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
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
name: Wheels
on:
push:
branches:
- master
- stable
- docs
- actions*
tags:
- v*
workflow_dispatch:
jobs:
sdist:
name: Source distribution
runs-on: ubuntu-latest
if: startsWith(github.ref_name, 'docs') != true
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup CMake
uses: jwlawson/[email protected]
- name: Install requirements
run: |
pip install check-manifest twine
- name: Run check-manifest
run: |
python -m check_manifest
- name: Build sdist
run: |
python -m build --sdist --outdir wheelhouse
- name: Install from sdist
run: |
pip install wheelhouse/*.tar.gz
- name: Check sdist
run: |
python -m twine check wheelhouse/*
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse/*.tar.gz
wheels:
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
cibw-arch: manylinux_x86_64
- runs-on: ubuntu-latest
cibw-arch: manylinux_i686
- runs-on: ubuntu-latest
cibw-arch: musllinux_x86_64
- runs-on: ubuntu-latest
cibw-arch: musllinux_i686
- runs-on: macos-latest
cibw-arch: macosx_x86_64
- runs-on: macos-latest
cibw-arch: macosx_arm64
- runs-on: macos-latest
cibw-arch: macosx_universal2
- runs-on: windows-latest
cibw-arch: win_amd64
- runs-on: windows-latest
cibw-arch: win32
python-arch: x86
name: Wheels • ${{ matrix.cibw-arch }}
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: ${{ matrix.python-arch }}
- name: Setup CMake
uses: jwlawson/[email protected]
- name: Install requirements
run: |
pip install cibuildwheel twine
- name: Configure cibuildwheel
shell: bash
run: |
CMAKE_ARCH="${{ matrix.cibw-arch == 'win32' && '-A Win32' || '' }}"
CMAKE_OSX_ARCHITECTURES=${{ matrix.cibw-arch == 'macosx_x86_64' && 'x86_64' || matrix.cibw-arch == 'macosx_arm64' && 'arm64' || matrix.cibw-arch == 'macosx_universal2' && '"arm64;x86_64"' || '' }}
echo "CIBW_ARCHS_MACOS=x86_64 arm64 universal2" >> $GITHUB_ENV
echo "CIBW_BUILD=*-${{ matrix.cibw-arch }}" >> $GITHUB_ENV
echo "CIBW_MANYLINUX_X86_64_IMAGE=manylinux2014" >> $GITHUB_ENV
echo "CIBW_MANYLINUX_I686_IMAGE=manylinux2014" >> $GITHUB_ENV
CIBW_ENVIRONMENT_COMMON="PARSELMOUTH_EXTRA_CMAKE_ARGS=\"-DPREBUILT_DEPENDENCIES=\$(python -c 'import os; print(os.getcwd().replace(os.path.sep, '/'))')/build_dependencies\" CMAKE_BUILD_PARALLEL_LEVEL=2"
echo "CIBW_ENVIRONMENT=$CIBW_ENVIRONMENT_COMMON" >> $GITHUB_ENV
echo "CIBW_ENVIRONMENT_LINUX=$CIBW_ENVIRONMENT_COMMON PIP_ONLY_BINARY='numpy'" >> $GITHUB_ENV
echo "CIBW_ENVIRONMENT_MACOS=$CIBW_ENVIRONMENT_COMMON MACOSX_DEPLOYMENT_TARGET=10.9 CMAKE_OSX_ARCHITECTURES=\"$CMAKE_OSX_ARCHITECTURES\"" >> $GITHUB_ENV
CIBW_BEFORE_ALL_COMMON="cmake -S . -B build_dependencies $CMAKE_ARCH && cmake --build build_dependencies --target praat -j 2"
echo "CIBW_BEFORE_ALL=$CIBW_BEFORE_ALL_COMMON" >> $GITHUB_ENV
echo "CIBW_BEFORE_ALL_WINDOWS=$CIBW_BEFORE_ALL_COMMON --config Release" >> $GITHUB_ENV
echo "CIBW_BEFORE_BUILD=rm -rf _skbuild" >> $GITHUB_ENV
- name: Only build ReadTheDocs wheel
if: startsWith(github.ref_name, 'docs')
shell: bash
run: |
echo "CIBW_BUILD=cp311-manylinux_x86_64" >> $GITHUB_ENV
- name: Run cibuildwheel
if: startsWith(github.ref_name, 'docs') != true || matrix.cibw-arch == 'manylinux_x86_64'
run: |
cibuildwheel
- name: Check built wheels
if: startsWith(github.ref_name, 'docs') != true || matrix.cibw-arch == 'manylinux_x86_64'
run: |
twine check wheelhouse/*
- name: Upload built wheels
if: startsWith(github.ref_name, 'docs') != true
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse/praat_parselmouth-*.whl
if-no-files-found: error
- name: Upload wheel for ReadTheDocs
if: matrix.cibw-arch == 'manylinux_x86_64' && github.ref_type == 'branch' && !startsWith(github.ref_name, 'actions')
uses: actions/upload-artifact@v3
with:
name: rtd-wheel
path: wheelhouse/praat_parselmouth-*-cp311-cp311-*manylinux2014_x86_64*.whl
if-no-files-found: error
trigger_rtd:
name: Trigger ReadTheDocs build
runs-on: ubuntu-latest
if: github.ref_type == 'branch' && !startsWith(github.ref_name, 'actions')
needs: [wheels]
steps:
- name: Trigger ReadTheDocs webhook
run: |
curl -X POST -d "branches=${{ github.ref_name }}" -d "token=${{ secrets.READTHEDOCS_WEBHOOK_TOKEN }}" https://readthedocs.org/api/v2/webhook/parselmouth/15985/
create_release:
name: Create release
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
needs: [sdist, wheels]
steps:
- name: Collect sdist and wheels
uses: actions/download-artifact@v3
with:
name: wheels
path: wheelhouse
- name: Upload sdist and wheels to release
uses: ncipollo/release-action@v1
with:
name: ${{ github.ref_name }}
draft: true
artifacts: wheelhouse/*
token: ${{ secrets.GITHUB_TOKEN }}