-
Notifications
You must be signed in to change notification settings - Fork 375
358 lines (308 loc) · 12.1 KB
/
openlane_ci.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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
name: CI
on:
# Runs on all pushes to branches
push:
# Runs on all PRs
pull_request:
# Runs every day at midnight UTC
schedule:
- cron: "0 0 * * *"
# Manual Dispatch
workflow_dispatch:
jobs:
pdk_build:
name: Fetch or Build PDK
runs-on: ubuntu-20.04
strategy:
matrix:
pdk: [sky130A, gf180mcuC]
steps:
- uses: actions/checkout@v3
- name: Set up environment variables
uses: ./.github/actions/set_env_variables
- name: Set up GITHUB_TOKEN
run: |
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Get Volare Build/Push Dependencies
run: |
# Magic Build Dependencies
sudo apt-get install -y tcsh tcl-dev tk-dev libcairo2-dev m4
# GHR (Pushing)
go install github.com/tcnksm/ghr@latest
- name: Set GITHUB_TOKEN
run: |
if [ "${{ secrets.MY_TOKEN }}" != "" ]; then
echo "GITHUB_TOKEN=${{ secrets.MY_TOKEN }}" >> $GITHUB_ENV
else
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
fi
- name: Build (or Get) PDK
run: |
export PATH=$PATH:$(go env GOPATH)/bin
export OPDKS_VER="$(python3 ./dependencies/tool.py open_pdks -f commit)"
PDK=${{ matrix.pdk }}
PDK_FAMILY=${PDK%?}
sudo mkdir -p ${{ env.PDK_ROOT }}
sudo chown -R $USER:$USER ${{ env.PDK_ROOT }}
python3 -m pip install --upgrade --no-cache-dir volare>=0.12.3
export OPDKS_VER="$(python3 ./dependencies/tool.py open_pdks -f commit)"
volare enable --pdk $PDK_FAMILY $OPDKS_VER
- name: Tarball PDK
run: |
tar -cf /tmp/${{ matrix.pdk }}.tar -C $PDK_ROOT/${{ matrix.pdk }} .
- name: Upload PDK Tarball
uses: actions/upload-artifact@v4
with:
name: pdk-tarball-${{ matrix.pdk }}
path: /tmp/${{ matrix.pdk }}.tar
prepare_test_matrices:
name: Prepare Test Matrices
runs-on: ubuntu-20.04
outputs:
design_matrix: ${{ steps.set-matrix.outputs.design_matrix }}
issue_regression_matrix: ${{ steps.set-matrix.outputs.issue_regression_matrix }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Python Dependencies
run: |
python3 -m pip install click pyyaml
- name: Determine If Running Extended Test Set
run: |
export EVENT_NAME=${{ github.event_name }};
python3 ./.github/scripts/determine_test_set.py
- name: Set Matrix
id: set-matrix
run: |
if [[ "$USE_ETS" = "1" ]]; then
echo "design_matrix=$(python3 ./.github/test_sets/get_test_matrix.py --scl sky130A/sky130_fd_sc_hd --scl gf180mcuC/gf180mcu_fd_sc_mcu7t5v0 fastest_test_set extended_test_set)" >> $GITHUB_OUTPUT
else
echo "design_matrix=$(python3 ./.github/test_sets/get_test_matrix.py --scl sky130A/sky130_fd_sc_hd --scl gf180mcuC/gf180mcu_fd_sc_mcu7t5v0 fastest_test_set)" >> $GITHUB_OUTPUT
fi
echo "issue_regression_matrix=$(python3 -m tests get_matrix)" >> $GITHUB_OUTPUT
docker_build_amd64:
name: Docker Build (amd64)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Build
uses: ./.github/actions/docker_build
with:
arch: amd64
dockerhub_user: ${{ secrets.DOCKERHUB_USER }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
tool_repository: ${{ vars.TOOL_DOCKER_IMAGE }}
docker_build_arm64v8:
name: Docker Build (arm64v8)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Build
uses: ./.github/actions/docker_build
with:
arch: arm64v8
dockerhub_user: ${{ secrets.DOCKERHUB_USER }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
tool_repository: ${{ vars.TOOL_DOCKER_IMAGE }}
issue_regression_test:
name: Regression Test (Test ${{ matrix.test }})
needs: [docker_build_amd64, pdk_build, prepare_test_matrices]
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.prepare_test_matrices.outputs.issue_regression_matrix) }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up environment variables
uses: ./.github/actions/set_env_variables
- name: Download Docker Image
uses: actions/download-artifact@v4
with:
name: docker-image-amd64
path: /tmp
- name: Import Docker Image
run: docker load --input /tmp/image-amd64.tar
- name: Download PDK Tarball
uses: actions/download-artifact@v4
with:
name: pdk-tarball-sky130A
path: /tmp
- name: Unpack PDK Tarball
run: |
sudo mkdir -p ${{ env.PDK_ROOT }}/sky130A
sudo chown -R $USER:$USER ${{ env.PDK_ROOT }}
tar -xf /tmp/sky130A.tar -C $PDK_ROOT/sky130A .
- name: Get Pyyaml
run: python3 -m pip install pyyaml
- name: Run Issue Regression Test
run: |
OPENLANE_IMAGE_NAME=efabless/openlane:current\
make run_issue_regression ISSUE_REGRESSION_DESIGN=${{ matrix.test }}
- name: Upload Logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: test_${{ matrix.test }}_logs
path: ./test_logs
# Each test has two components: a fast test set and an extended test set.
# The fast test set is run on all PRs, etc. The extended test set runs on schedule.
test:
name: Test Design ${{ matrix.design.name }} (${{ matrix.design.pdk }}/${{matrix.design.scl}})
needs: [docker_build_amd64, pdk_build, prepare_test_matrices]
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.prepare_test_matrices.outputs.design_matrix) }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up environment variables
uses: ./.github/actions/set_env_variables
- name: Download Docker Image (amd64)
uses: actions/download-artifact@v4
with:
name: docker-image-amd64
path: /tmp
- name: Import Docker Image
run: docker load --input /tmp/image-amd64.tar
- name: Download PDK Tarball
uses: actions/download-artifact@v4
with:
name: pdk-tarball-${{ matrix.design.pdk }}
path: /tmp
- name: Unpack PDK Tarball
run: |
sudo mkdir -p ${{ env.PDK_ROOT }}/${{ matrix.design.pdk }}
sudo chown -R $USER:$USER ${{ env.PDK_ROOT }}
tar -xf /tmp/${{ matrix.design.pdk }}.tar -C $PDK_ROOT/${{ matrix.design.pdk }} .
- name: Set PDK Variant
run: |
echo "PDK=${{ matrix.design.pdk }}" >> $GITHUB_ENV
- name: Set SCL
run: |
echo "STD_CELL_LIBRARY=${{ matrix.design.scl }}" >> $GITHUB_ENV
- name: Get Pyyaml
run: python3 -m pip install pyyaml
- name: Run Test
run: |
OPENLANE_IMAGE_NAME=efabless/openlane:current-amd64\
python3 ${GITHUB_WORKSPACE}/.github/scripts/run_tests.py ${{ matrix.design.name }}
- name: Escape Design Name
if: ${{ always() }}
run: |
design_name=${{ matrix.design.name }}
escaped_design_name=${design_name//\//_}
echo "ESCAPED_DESIGN_NAME=$escaped_design_name" >> $GITHUB_ENV
- name: Upload Run Tarball
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ESCAPED_DESIGN_NAME }}-${{ matrix.design.pdk }}
path: ./reproducible.tar.gz
cleanup_and_deploy:
name: Cleanup (and Possibly Deployment)
needs:
[docker_build_amd64, docker_build_arm64v8, test, issue_regression_test]
if: always()
runs-on: ubuntu-20.04
steps:
- name: Check If Going To Push An Image To Docker
# # Uncomment the next line if you want to only build & push a container if entire test set succeeds
# if: needs.test.result == 'success'
# Ruby snippet to print 0 if this is a PR or if there is no DOCKERHUB_USER secret set, otherwise, 1
run: |
export PUSHING=$(ruby -e 'if ("${{ github.event_name }}" != "pull_request" && "${{ secrets.DOCKERHUB_USER }}" != ""); print(1) else print(0) end')
echo "PUSHING=$PUSHING" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
- name: Set up environment variables
uses: ./.github/actions/set_env_variables
- name: Download Docker Image (amd64)
uses: actions/download-artifact@v4
with:
name: docker-image-amd64
path: /tmp
- name: Download Docker Image (arm64v8)
uses: actions/download-artifact@v4
with:
name: docker-image-arm64v8
path: /tmp
- name: Delete Docker Image (amd64)
uses: geekyeggo/delete-artifact@v1
with:
name: docker-image-amd64
- name: Delete Docker Image (arm64v8)
uses: geekyeggo/delete-artifact@v1
with:
name: docker-image-arm64v8
- name: Delete PDK
uses: geekyeggo/delete-artifact@v1
with:
name: pdk-tarball
- name: Write Hash
run: |
echo "GIT_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Import Docker Images
if: ${{ env.PUSHING == '1' }}
run: |
for arch in amd64 arm64v8; do
docker load --input /tmp/image-$arch.tar
done
- name: Create Tag (If scheduled or dispatched)
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && (env.BRANCH_NAME == vars.MAIN_BRANCH || env.BRANCH_NAME == 'superstable') }}
run: cd ${GITHUB_WORKSPACE}/ && python3 ${GITHUB_WORKSPACE}/.github/scripts/generate_tag.py
- name: Tag Commit (If scheduled or dispatched)
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && env.NEW_TAG != 'NO_NEW_TAG' }}
uses: tvdias/[email protected]
with:
tag: "${{ env.NEW_TAG }}"
repo-token: "${{ secrets.MY_TOKEN }}"
- name: Login to DockerHub
if: ${{ env.PUSHING == '1' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Start Tag List
if: ${{ env.PUSHING == '1' }}
run: |
echo "TAG_LIST=" >> $GITHUB_ENV
- name: Docker Tag (Main Branch Hashes)
if: ${{ env.PUSHING == '1' && github.event_name == 'push' && env.BRANCH_NAME == vars.MAIN_BRANCH }}
run: |
echo "TAG_LIST=$TAG_LIST ${{ env.GIT_COMMIT_HASH }}" >> $GITHUB_ENV
- name: Docker Tag (Branches)
if: ${{ env.PUSHING == '1' && github.event_name == 'push' }}
run: |
echo "TAG_LIST=$TAG_LIST ${{ env.BRANCH_NAME }}" >> $GITHUB_ENV
- name: Docker Push (Version Tag/Latest)
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && env.NEW_TAG != 'NO_NEW_TAG' }}
run: |
echo "TAG_LIST=$TAG_LIST ${{ env.NEW_TAG }} latest" >> $GITHUB_ENV
- name: Docker Pushes
if: ${{ env.PUSHING == '1' }}
run: |
for tag in $TAG_LIST; do
for arch in amd64 arm64v8; do
docker image tag efabless/openlane:current-$arch ${{ vars.DOCKER_IMAGE }}:$tag-$arch
docker push ${{ vars.DOCKER_IMAGE }}:$tag-$arch
done
docker manifest create ${{ vars.DOCKER_IMAGE }}:$tag\
--amend ${{ vars.DOCKER_IMAGE }}:$tag-amd64\
--amend ${{ vars.DOCKER_IMAGE }}:$tag-arm64v8
docker manifest push ${{ vars.DOCKER_IMAGE }}:$tag
done