-
Notifications
You must be signed in to change notification settings - Fork 0
201 lines (172 loc) · 6.37 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
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"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
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
outputs:
version: ${{ steps.get-surelog.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
# 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 siliconcompiler/setup/_tools.py --tool surelog --field git-commit)" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/cache@v4
id: surelog-cache
with:
path: |
surelog/bin/surelog*
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
- 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
- name: Upload Surelog
if: always() && !cancelled()
uses: actions/upload-artifact@v4
with:
name: surelog-${{ matrix.platform.os }}-${{ matrix.platform.arch }}
path: |
surelog/bin/surelog*
Surelog/build/bin/surelog*
retention-days: 14
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, cp313]
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
with:
submodules: true
# 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
- uses: actions/cache@v4
id: surelog-cache
with:
path: |
surelog/bin/surelog*
key: ${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ needs.build_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
- uses: pypa/[email protected]
env:
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_EXTRAS: test
CIBW_TEST_COMMAND: pytest {package}/tests/
# "if: always()" ensures that we always upload any wheels that have
# been created, even if cibuildwheel action fails
- name: Upload wheels
if: always() && !cancelled()
uses: actions/upload-artifact@v4
with:
path: wheelhouse/*.whl
name: sc_surelog-${{ 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')
permissions:
contents: write
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: sc_surelog-*
path: dist
merge-multiple: true
- uses: pypa/[email protected]
- name: Add wheels to GitHub release artifacts
uses: softprops/action-gh-release@v2
with:
files: dist/*.whl