-
Notifications
You must be signed in to change notification settings - Fork 0
253 lines (198 loc) · 5.1 KB
/
build.yaml
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
name: Build, Sign & Publish
on:
push:
pull_request:
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- amd64
- arm64
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y \
build-essential wget m4 xz-utils \
make cmake libeigen3-dev \
liblapack-dev libopenblas-dev
- name: Build wheel
run: |
./build.sh
readelf -d flatter-linux | grep 'NEEDED'
- name: Test the Package
run: |
./test.sh
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.arch }}-linux
path: dist/*.whl
build-darwin:
runs-on: macos-latest
strategy:
matrix:
arch:
- arm64
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
brew install make wget cmake eigen
- name: Build wheel
run: |
./build.sh
- name: Test the package
run: |
./test.sh
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.arch }}-darwin
path: dist/*.whl
test-darwin:
name: Fresh Install on macOS
runs-on: macos-latest
strategy:
matrix:
arch:
- arm64
needs:
- build-darwin
steps:
- uses: actions/checkout@v3
- name: Delete everything except tests.py
run: |
find . -type f -not -name 'tests.py' -delete
- name: Download the wheel artifact
uses: actions/download-artifact@v4
with:
name: wheel-${{ matrix.arch }}-darwin
- name: Run Tests
run: |
python3 -m venv venv
. venv/bin/activate
PYTHONPATH= pip install *.whl
python3 tests.py
test-linux:
name: Fresh Install on Linux
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- amd64
- arm64
needs:
- build-linux
steps:
- uses: actions/checkout@v3
- name: Delete everything except tests.py
run: |
find . -type f -not -name 'tests.py' -delete
- name: Download the wheel artifact
uses: actions/download-artifact@v4
with:
name: wheel-${{ matrix.arch }}-linux
- name: Run Tests
run: |
python3 -m venv venv
. venv/bin/activate
PYTHONPATH= pip install *.whl
python3 tests.py
collect-artifacts:
name: Collect Build Artifacts
needs:
- test-linux
- test-darwin
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheel-*
path: dist/
merge-multiple: true
- name: Upload merged artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts
path: dist/
publish-to-pypi:
name: >-
Publish to PyPI
needs:
- collect-artifacts
# only publish on tags
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/flatn
permissions:
contents: write
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: artifacts
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: Sign & Create Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: artifacts
path: dist/
- name: Sign the distribution with SigStore
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
"$GITHUB_REF_NAME"
--repo "$GITHUB_REPOSITORY"
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
"$GITHUB_REF_NAME" dist/**
--repo "$GITHUB_REPOSITORY"
publish-to-testpypi:
name: >-
Publish to TestPyPI
needs:
- collect-artifacts
# only test publish on master branch
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/flatn
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: artifacts
path: dist/
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/