-
Notifications
You must be signed in to change notification settings - Fork 14
229 lines (209 loc) · 7.16 KB
/
build.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
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
name: Build Wheels
on:
push:
branches:
- main
- fix-wheel-build
- v*
release:
types: [created]
jobs:
build_wheels:
name: Build Wheels on ${{ matrix.os }}-${{ matrix.platform_id }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-11, windows-2019]
bitness: [32, 64]
include:
# Run 32 and 64 bit version in parallel for Windows
- os: windows-2019
bitness: 64
platform_id: win_amd64
- os: windows-2019
bitness: 32
platform_id: win32
- os: macos-11
bitness: 64
platform_id: macosx_x86_64
exclude:
- os: macos-11
bitness: 32
env:
CIBW_BUILD: cp38-${{ matrix.platform_id }} cp39-${{ matrix.platform_id }} cp310-${{ matrix.platform_id }} cp311-${{ matrix.platform_id }} cp312-${{ matrix.platform_id }}
CIBW_SKIP: pp* cp35* cp36* cp37*
CIBW_BEFORE_BUILD_MACOS: "source packing/build_pango_mac.sh"
CIBW_BEFORE_BUILD_WINDOWS: "python packing/download_dlls.py"
CIBW_ENVIRONMENT_WINDOWS: "PKG_CONFIG_PATH='C:\\cibw\\vendor\\lib\\pkgconfig'"
CIBW_ENVIRONMENT_MACOS: "PKG_CONFIG_PATH='/Users/runner/pangobuild/lib/pkgconfig'"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: python packing/inject-dlls.py {wheel} {dest_dir} C:\cibw\vendor\bin
CIBW_TEST_REQUIRES: pytest pytest-cov
CIBW_TEST_COMMAND: "bash {project}/packing/test_wheels.sh {project}"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: "3.8"
- name: Install cibuildwheel
env:
event_name: ${{ github.event_name }}
continue-on-error: true
shell: bash
run: |
python -m pip install cibuildwheel==2.11.2
echo "$event_name"
- name: Build wheels (Windows)
if: runner.os == 'windows'
run: |
$ErrorActionPreference = 'Stop'
$env:PATH="$env:PATH;C:\cibw\pkg-config\bin"
$env:PKG_CONFIG_PATH="C:\cibw\vendor\lib\pkgconfig"
Copy-Item packing/LICENSE.bin .
Rename-Item LICENSE.bin LICENSE.win32
python -m cibuildwheel --output-dir wheelhouse
- name: Build wheels (Non-Windows)
if: runner.os != 'windows'
run: |
cp packing/LICENSE.bin .
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
name: wheels-${{ runner.os }}-${{ matrix.platform_id }}
test_wheels:
name: Test wheels on ${{ matrix.os }}-${{ matrix.platform_id }}-${{ matrix.python-version }}
needs: [build_wheels]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-10.15, windows-2019]
architecture: [x86, x64]
python-version: ['3.8', '3.9', '3.10', '3.11']
include:
- os: windows-2019
architecture: x64
platform_id: win_amd64
- os: windows-2019
architecture: x86
platform_id: win32
- os: macos-10.15
architecture: x64
platform_id: macosx_x86_64
exclude:
- os: macos-10.15
architecture: x86
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- uses: actions/download-artifact@v3
with:
name: wheels-${{ runner.os }}-${{ matrix.platform_id }}
path: ~/wheelhouse
- name: Install test dependencies
run: |
pip install pytest pytest-cov
- name: Install wheels
run: |
pip install --no-index --find-links ~/wheelhouse ManimPango
- name: Run tests
shell: bash
run: |
bash packing/test_wheels.sh $(pwd)
publish_wheels:
needs: [test_wheels]
name: Upload wheels
runs-on: ubuntu-latest
if: github.event_name== 'release'
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- uses: actions/download-artifact@v3
with:
path: downloads/
- name: Publish release
if: github.event_name == 'release'
shell: bash
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
mkdir -p wheelhouse/
find downloads/ -name \*.whl -exec cp {} wheelhouse \;
pip install twine
twine upload wheelhouse/*.whl
build_sdist:
name: Source distribution
runs-on: ubuntu-latest
if: github.event_name== 'release'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Build Source Distribution
if: ${{ github.event_name== 'release' && runner.os == 'Linux' }}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
sudo apt install libcairo2-dev pkg-config python3-dev
sudo apt-get install libpango1.0-dev
pip install twine
python setup.py sdist
twine upload dist/*
- name: Store artifacts
uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
name: manimpango.tar.gz
- name: Install Dependency
run: pip install requests
- name: Get Upload URL
id: create_release
shell: python
env:
access_token: ${{ secrets.GITHUB_TOKEN }}
tag_act: ${{ github.ref }}
run: |
import requests
import os
ref_tag = os.getenv('tag_act').split('/')[-1]
access_token = os.getenv('access_token')
headers = {
"Accept":"application/vnd.github.v3+json",
"Authorization": f"token {access_token}"
}
url = f"https://api.github.com/repos/ManimCommunity/manimpango/releases/tags/{ref_tag}"
c = requests.get(url,headers=headers)
upload_url=c.json()['upload_url']
with open(os.environ.get("GITHUB_OUTPUT"), "w") as f:
print(f"upload_url={upload_url}", file=f)
print(f"tag_name={ref_tag[1:]}", file=f)
- name: Upload Release Asset
id: upload-release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/ManimPango-${{ steps.create_release.outputs.tag_name }}.tar.gz
asset_name: ManimPango-${{ steps.create_release.outputs.tag_name }}.tar.gz
asset_content_type: application/gzip
success:
needs: [test_wheels]
runs-on: ubuntu-latest
name: Building and testing of wheels success
steps:
- name: Success
run: echo "Building and testing of wheels success"