-
Notifications
You must be signed in to change notification settings - Fork 82
271 lines (233 loc) · 9.4 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
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
name: Wheels
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
release:
types:
- published
# Ensures Surelog/wheels are compatible with macOS 10.15+
env:
MACOSX_DEPLOYMENT_TARGET: "10.15"
jobs:
build_surelog:
name: Build Surelog for ${{ matrix.platform.os }} ${{ matrix.platform.arch}}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- os: ubuntu-latest
arch: x86_64
- os: ubuntu-latest
arch: aarch64
- os: macos-13
arch: universal
- os: windows-latest
arch: x86_64
steps:
- uses: actions/checkout@v4
# This facilitates building Linux+arm64 wheels
# https://cibuildwheel.readthedocs.io/en/stable/faq/#emulation
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
# Explicitly use "shell: bash" to make this work on Windows
- name: Get Surelog version
id: get-surelog
run: |
echo "version=$(python3 setup/_tools.py --tool surelog --field git-commit)" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/cache@v4
id: surelog-cache
with:
path: |
siliconcompiler/tools/surelog/bin/surelog*
siliconcompiler/tools/surelog/lib/surelog/sv/builtin.sv
key: ${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ steps.get-surelog.outputs.version }}
- name: Setup Java
if: (matrix.platform.os == 'macos-13' || matrix.platform.os == 'windows-latest') && steps.surelog-cache.outputs.cache-hit != 'true'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
java-package: jre
architecture: x64
- name: Setup Python
if: (matrix.platform.os == 'macos-13' || matrix.platform.os == 'windows-latest') && steps.surelog-cache.outputs.cache-hit != 'true'
uses: actions/setup-python@v5
with:
python-version: 3.8
architecture: x64
cache: pip
- name: Build Surelog (Windows)
if: matrix.platform.os == 'windows-latest' && steps.surelog-cache.outputs.cache-hit != 'true'
run: |
.github/workflows/bin/install_surelog_win.bat
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
git config --system core.longpaths true
- name: Build Surelog (macOS)
if: matrix.platform.os == 'macos-13' && steps.surelog-cache.outputs.cache-hit != 'true'
run: .github/workflows/bin/install_surelog_macos.sh
- name: Build Surelog (Linux x86)
if: matrix.platform.os == 'ubuntu-latest' && matrix.platform.arch == 'x86_64'&& steps.surelog-cache.outputs.cache-hit != 'true'
uses: docker://quay.io/pypa/manylinux2014_x86_64:latest
with:
args: ./.github/workflows/bin/install_surelog_linux.sh
- name: Build Surelog (Linux arm64)
if: matrix.platform.os == 'ubuntu-latest' && matrix.platform.arch == 'aarch64' && steps.surelog-cache.outputs.cache-hit != 'true'
uses: docker://quay.io/pypa/manylinux2014_aarch64:latest
with:
args: ./.github/workflows/bin/install_surelog_linux.sh
build_wheels:
name: Wheels on ${{ matrix.platform.os }} ${{ matrix.platform.arch}} ${{ matrix.python-version }}
runs-on: ${{ matrix.platform.os }}
needs: build_surelog
strategy:
fail-fast: false
matrix:
python-version: [cp38, cp39, cp310, cp311, cp312]
platform:
- os: ubuntu-latest
arch: x86_64
- os: ubuntu-latest
arch: aarch64
- os: macos-13
arch: universal
- os: windows-latest
arch: x86_64
env:
CIBW_ARCHS_LINUX: ${{ matrix.platform.arch }}
steps:
- uses: actions/checkout@v4
# This facilitates building Linux+arm64 wheels
# https://cibuildwheel.readthedocs.io/en/stable/faq/#emulation
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
# Explicitly use "shell: bash" to make this work on Windows
- name: Get Surelog version
id: get-surelog
run: |
echo "version=$(python3 setup/_tools.py --tool surelog --field git-commit)" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/cache@v4
id: surelog-cache
with:
path: |
siliconcompiler/tools/surelog/bin/surelog*
siliconcompiler/tools/surelog/lib/surelog/sv/builtin.sv
key: ${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ steps.get-surelog.outputs.version }}
# We should be guaranteed a hit after build_surelog executes
- name: Verify Surelog cache hit
if: steps.surelog-cache.outputs.cache-hit != 'true'
run: exit 1
- name: Setup env (Windows)
if: matrix.platform.os == 'windows-latest'
run: |
choco install -y graphviz
.github/workflows/bin/install_klayout_win.bat
- name: Setup env (macOS)
if: matrix.platform.os == 'macos-13'
run: |
brew install graphviz
brew install --cask klayout
# https://github.com/ponty/PyVirtualDisplay/blob/master/.github/workflows/main.yml#L45
brew install --cask xquartz
echo "/opt/X11/bin" >> $GITHUB_PATH
mkdir -p /tmp/.X11-unix
sudo chmod 1777 /tmp/.X11-unix
sudo chown root /tmp/.X11-unix
- uses: pypa/cibuildwheel@v2.18
env:
CIBW_BEFORE_ALL_LINUX: >
src_path="{package}" {package}/.github/workflows/bin/setup_wheel_env_linux.sh
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BUILD: ${{ matrix.python-version }}*
CIBW_SKIP: "pp* *win32 *i686 *-musllinux_*"
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_TEST_SKIP: "*_arm64"
CIBW_TEST_EXTRAS: test
CIBW_TEST_COMMAND: >
pytest {package}/tests/ -m "not eda" &&
pytest {package}/tests/tools/test_surelog.py &&
pytest {package}/tests/flows/test_show.py -k "not openroad"
# On Linux, check if KL is installed before running show tests (not included for ARM64)
CIBW_TEST_COMMAND_LINUX:
pytest {package}/tests/ -m "not eda" &&
pytest {package}/tests/tools/test_surelog.py &&
if command -v klayout; then pytest {package}/tests/flows/test_show.py -k "not openroad"; fi
# "if: always()" ensures that we always upload any wheels that have
# been created, even if cibuildwheel action fails
- name: Upload wheels
if: always()
uses: actions/upload-artifact@v4
with:
path: wheelhouse/*.whl
name: siliconcompiler-${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ matrix.python-version }}
retention-days: 14
publish:
needs: [build_wheels]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published' && !contains(github.event.release.body, 'NOPUBLISH')
steps:
- uses: actions/download-artifact@v4
with:
pattern: siliconcompiler-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@v1.8.14
with:
user: __token__
password: ${{ secrets.PYPI_DEPLOY }}
- name: Add wheels to GitHub release artifacts
uses: softprops/action-gh-release@v2
with:
files: dist/*.whl
package_offline:
# We want to run this on the official PEP Python-wheel building platform to
# ensure the downloaded wheels have the broadest compatibility. Using the
# '--platform' tag for 'pip download' doesn't work for us, since it requires
# setting --only-binary=:all: and some of our deps aren't available as
# wheels on some platforms.
needs: [build_wheels]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: [cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311, cp312-cp312]
steps:
- uses: actions/download-artifact@v4
with:
pattern: siliconcompiler-*
path: dist
merge-multiple: true
- name: Package SC
run: |
docker run --name sc_package -dit quay.io/pypa/manylinux2014_x86_64:latest
docker cp ./dist/siliconcompiler*${{matrix.python}}*linux*x86_64.whl sc_package:/
export wheel=$(docker exec sc_package bash -c "ls siliconcompiler*")
docker exec sc_package mkdir sc_dependencies
docker exec sc_package $python -m pip download pip -d sc_dependencies
docker exec sc_package $python -m pip download $wheel -d sc_dependencies
docker exec sc_package tar czvf sc_dependencies-${{matrix.python}}.tar.gz sc_dependencies $wheel
docker cp sc_package:sc_dependencies-${{matrix.python}}.tar.gz ./
docker stop sc_package
docker rm sc_package
env:
python: /opt/python/${{matrix.python}}/bin/python
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: sc_plus_dependencies-${{matrix.python}}
path: sc_dependencies*.tar.gz
retention-days: 14
- name: Add wheels to GitHub release artifacts
if: github.event_name == 'release' && github.event.action == 'published' && !contains(github.event.release.body, 'NOPUBLISH')
uses: softprops/action-gh-release@v2
with:
files: sc_dependencies*.tar.gz