-
Notifications
You must be signed in to change notification settings - Fork 21
478 lines (422 loc) · 14 KB
/
main.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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
name: 'main'
run-name: ${{ github.event_name == 'workflow_dispatch' && github.ref_name || '' }}
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GHA_CUSTOM_LINE_PREFIX: "▌"
jobs:
emit-workflow-info:
name: Emit Workflow Info
if: ${{ github.event_name == 'workflow_dispatch' }}
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
container: 'bitnami/git:2.40.1-debian-11-r4'
steps:
- uses: actions/checkout@v3
with:
submodules: false
fetch-depth: 1
style-check:
name: Style check
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
container: bitnami/git:2.40.1-debian-11-r4
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Install dependencies
run: |
apt-get update -q
apt-get install -y git clang-format python3 jq
- name: Sources format check
run: |
./.github/scripts/format_sources.sh
if ! git diff --exit-code; then
echo
echo "Format locally using: ./.github/scripts/format_sources.sh"
echo
false
fi
- name: Sort check
run: |
./.github/scripts/sort_passlists.sh
if ! git diff --exit-code; then
echo
echo "Sort locally using: ./.github/scripts/sort_passlists.sh"
echo
false
fi
build-binaries:
strategy:
matrix:
include:
- name: 'Build Synlig Release'
artifact-name: 'binaries-release'
apt-extra-deps: 'gcc g++'
cc: 'gcc'
cxx: 'g++'
build-binaries-args: 'install install@surelog PREFIX=out'
submodules: 'third_party/yosys third_party/surelog'
- name: 'Build Plugin'
artifact-name: 'binaries-plugin'
cc: 'gcc'
cxx: 'g++'
apt-extra-deps: 'gcc g++'
build-binaries-args: 'install-plugin install@surelog PREFIX=out'
submodules: 'third_party/yosys third_party/surelog'
- name: 'Build Synlig (ASAN)'
artifact-name: 'binaries-asan'
cc: 'clang-15'
cxx: 'clang++-15'
apt-extra-deps: 'clang-15'
build-binaries-args: 'install@surelog install@asan PREFIX=out'
submodules: 'third_party/yosys third_party/surelog'
- name: 'Build Package'
artifact-name: 'binaries-package'
apt-extra-deps: 'gcc g++'
cc: 'gcc'
cxx: 'g++'
build-binaries-args: 'install PREFIX=out'
submodules: 'third_party/yosys third_party/surelog'
- name: 'Build PySynlig'
artifact-name: 'binaries-pysynlig'
apt-extra-deps: 'gcc g++'
cc: 'gcc'
cxx: 'g++'
build-binaries-args: 'install@surelog install@pysynlig PREFIX=out'
submodules: 'third_party/yosys third_party/surelog third_party/pybind11'
name: ${{ matrix.name }}
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
container: debian:bookworm
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
BUILD_BINARIES_ARGS: ${{ matrix.build-binaries-args }}
CCACHE_DIR: "${{ github.workspace }}/.cache/"
DEBIAN_FRONTEND: noninteractive
GHA_MACHINE_TYPE: "n2-highmem-8"
steps:
- uses: actions/checkout@v3
with:
submodules: false
fetch-depth: 1
- name: Set up common configuration
run: |
./.github/scripts/set-up-common-debian-configuration.sh
./.github/scripts/set-up-common-git-configuration.sh
- name: Install dependencies
run: |
apt-get update -q
apt-get install -y \
ant \
bison \
build-essential \
ccache \
cmake \
default-jre \
flex \
git \
google-perftools \
libffi-dev \
libfl-dev \
libgoogle-perftools-dev \
libreadline-dev \
pkg-config \
python3 \
python3-dev \
python3-pip \
python3-orderedmultidict \
swig \
tcl-dev \
tclsh \
uuid \
uuid-dev \
wget \
${{ matrix.apt-extra-deps }} \
;
- name: Checkout submodules
run: |
git submodule sync
git submodule update --depth 1 --init --recursive --checkout \
${{ matrix.submodules }} \
;
- name: Setup cache
uses: actions/cache@v2
with:
path: ${{ env.CCACHE_DIR }}
key: cache_${{ matrix.artifact-name }}_${{ github.run_id }}
restore-keys: cache_${{ matrix.artifact-name }}_
- name: Build binaries
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j $(nproc) ${BUILD_BINARIES_ARGS}
# By default actions/upload-artifact@v4 do not preserve file permissions
# tar directory to workaround this issue
# See https://github.com/actions/upload-artifact/issues/38
tar -cvf ${{ matrix.artifact-name }}.tar out
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: |
${{ matrix.artifact-name }}.tar
- name: Upload load graphs
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: plots_${{ matrix.artifact-name }}
path: |
**/plot_*.svg
build-tools:
name: Build tools
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
container: debian:bookworm
env:
DEBIAN_FRONTEND: noninteractive
GHA_MACHINE_TYPE: "n2-standard-4"
steps:
- uses: actions/checkout@v3
with:
submodules: false
fetch-depth: 1
- name: Set up common Debian configuration
run: |
./.github/scripts/set-up-common-debian-configuration.sh
./.github/scripts/set-up-common-git-configuration.sh
- name: Install dependencies
run: |
apt-get update -q
apt-get install -y \
ant \
bison \
build-essential \
ccache \
cmake \
default-jre \
flex \
git \
gcc \
g++ \
google-perftools \
libffi-dev \
libfl-dev \
libgoogle-perftools-dev \
libreadline-dev \
pkg-config \
python3 \
python3-dev \
python3-pip \
python3-orderedmultidict \
swig \
tcl-dev \
tclsh \
uuid \
uuid-dev \
wget \
;
- name: Checkout submodules
run: |
git submodule sync
git submodule update --depth 1 --init --recursive --checkout \
third_party/sv2v \
third_party/yosys \
;
- name: Build sv2v
run: |
export PATH=$PWD/install/bin:/usr/local/bin:${PATH}
wget -qO- https://get.haskellstack.org/ | sh -s - -f -d /usr/local/bin
make install@sv2v -j $(nproc) PREFIX=out
- name: Build tools
run: |
make install@yosys-tools -j $(nproc) PREFIX=out
- name: Pack tools
run: |
tar -cvf tools.tar out
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: tools
path: |
tools.tar
- name: Upload load graphs
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: plots_build_tools
path: |
**/plot_*.svg
tests-parsing:
name: Parsing Tests
uses: ./.github/workflows/parsing-tests.yml
secrets:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
permissions:
pull-requests: write
needs: build-binaries
tests-formal-verification:
name: Formal Verification Tests
uses: ./.github/workflows/formal-verification.yml
needs:
- build-binaries
- build-tools
tests-bsg-micro-designs-diff:
name: Diff generated BSG Micro Designs tests
uses: ./.github/workflows/bsg-test-diff.yml
needs:
- build-binaries
tests-large-designs:
name: Large Designs Tests
uses: ./.github/workflows/large-designs.yml
needs: build-binaries
release:
permissions:
contents: write
name: Release Package
needs:
- build-binaries
- tests-parsing
- tests-formal-verification
- tests-large-designs
runs-on: ubuntu-22.04
if: ${{github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')}}
steps:
- uses: actions/checkout@v2
with:
# Download complete repository + tags
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: binaries-package
# See https://github.com/actions/upload-artifact/issues/38
- name: Extract
run: |
tar -xf binaries-package.tar
- name: Prepare tarball
run: |
mkdir synlig
cp out/bin/synlig synlig/
cp -r out/share/synlig synlig/share
tar -zcvf release.tar.gz synlig
- name: Name tarball and apply TAG
run: |
GIT_VERSION=${GIT_VERSION:-$(git rev-parse --short "$GITHUB_SHA")}
DATE=$(git show -s --date=short --format=%cd)
FULL_TARBALL=synlig-$GIT_VERSION-$DATE.tar.gz
# Create a tag of form 2021-12-06-ad2466e
TAG="${TAG:-$(git show -s --date=short --format=%cd-%h)}"
git tag "$TAG" || true
echo "TAG=$TAG" >> $GITHUB_ENV
mv release.tar.gz $FULL_TARBALL
tar -tvf $FULL_TARBALL
- name: Get PR data
uses: 8BitJonny/[email protected]
with:
sha: ${{ github.event.pull_request.head.sha }}
id: release_pr
- name: Deploy release
env:
RELEASE_NAME: >
${{ steps.release_pr.outputs.pr_found == 'true'
&&
format('{0}: #{1}: {2}',
env.TAG,
steps.release_pr.outputs.number,
steps.release_pr.outputs.pr_title)
||
env.TAG }}
RELEASE_BODY: >
${{ steps.release_pr.outputs.pr_found == 'true'
&&
steps.release_pr.outputs.pr_body
||
'' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: synlig-*.tar.gz
tag: ${{ env.TAG }}
release_name: ${{ env.RELEASE_NAME }}
body: ${{ env.RELEASE_BODY }}
overwrite: true
file_glob: true
verify-README:
name: Verify README Correctness (Installation From Sources)
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
container: debian:bookworm
env:
DEBIAN_FRONTEND: noninteractive
PIPX_BIN_DIR: /usr/local/bin
steps:
- name: Prepare Repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Install Prerequisites
run: |
apt update -qq
apt install -y --no-install-recommends pipx git wget
pipx install git+https://github.com/antmicro/tuttest#egg=tuttest
- name: Install Dependencies
run: |
set -o pipefail
tuttest README.md install-dependencies | bash -eo pipefail -
- name: Test Synlig Installation
run: |
set -o pipefail
tuttest README.md make-install | bash -eo pipefail -
- name: Test Tools Installation
run: |
set -o pipefail
tuttest README.md get-haskell | bash -eo pipefail -
tuttest README.md install-tools | bash -eo pipefail -
- name: Test counter.sv Synthesis
run: |
set -o pipefail
tuttest README.md counter.sv > counter.sv
tuttest README.md synthesis-example | grep ">" | cut -d ">" -f 2 | synlig
- name: Test Parsing Multiple Files
run: |
set -o pipefail
tuttest README.md example-multiple-files | synlig
- name: Test Testing Scripts Commands
run: |
set -o pipefail
tuttest README.md formal-verification-help | bash -eo pipefail -
tuttest README.md large-designs-help | bash -eo pipefail -
tuttest README.md parsing-tests-help | bash -eo pipefail -
test-package:
name: Verify README Correctness (Download And Run Release)
needs: release
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
container: debian:bookworm
env:
DEBIAN_FRONTEND: noninteractive
PIPX_BIN_DIR: /usr/local/bin
steps:
- name: Prepare Repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Install Prerequisites
run: |
apt update -qq
apt install -y --no-install-recommends pipx git wget
pipx install git+https://github.com/antmicro/tuttest#egg=tuttest
- name: Install Dependencies
run: |
set -o pipefail
tuttest README.md install-dependencies-package | bash -eo pipefail -
- name: Download Release, Set PATH and Test counter.sv Synthesis
run: |
set -o pipefail
tuttest README.md download-release | bash -eo pipefail -
eval $(tuttest README.md path-setup)
tuttest README.md counter.sv > counter.sv
tuttest README.md synthesis-example | grep ">" | cut -d ">" -f 2 | synlig