-
Notifications
You must be signed in to change notification settings - Fork 217
614 lines (501 loc) · 17.1 KB
/
verible-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
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
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
name: ci
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
workflow_dispatch:
env:
BOT_USER: "Deployment Bot"
BOT_EMAIL: "[email protected]"
GHA_MACHINE_TYPE: "n2-standard-8"
DEBIAN_FRONTEND: "noninteractive"
VERIBLE_BINDIR: "/tmp/verible-bin"
jobs:
VerifyFormatting:
container: ubuntu:jammy
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
steps:
- name: Cancel previous
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
run: |
apt -qqy update
apt -qq -y install clang-format git
clang-format --version
- name: Run formatting style check
run: |
./.github/bin/run-clang-format.sh
./.github/bin/check-potential-problems.sh
- name: 📤 Upload performance graphs
uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: "diag"
path: "**/plot_*.svg"
ClangTidy:
container: ubuntu:jammy
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
env:
GHA_MACHINE_TYPE: "n2-standard-4"
steps:
- name: Cancel previous
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
run: |
apt -qqy update
apt -qq -y install clang-tidy-11 clang-tidy-14 build-essential git wget
source ./.github/settings.sh
./.github/bin/install-bazel.sh
- name: Create Cache Timestamp
id: cache_timestamp
uses: nanzm/[email protected]
with:
format: 'YYYY-MM-DD-HH-mm-ss'
- name: Retrieve cached results
uses: actions/cache@v3
with:
path: |
/root/.cache/clang-tidy
/root/.cache/bazel
key: clang-tidy-${{ steps.cache_timestamp.outputs.time }}
restore-keys: clang-tidy-
- name: Run clang tidy
run: |
echo "::group::Make Compilation DB"
.github/bin/make-compilation-db.sh
wc -l compile_commands.json
echo "::endgroup::"
# For runtime references, use clang-tidy 11, everything else: latest.
CLANG_TIDY=clang-tidy-11 ./.github/bin/run-clang-tidy-cached.cc --checks="-*,google-runtime-references" \
|| ( cat verible_clang-tidy.out ; exit 1)
CLANG_TIDY=clang-tidy-14 ./.github/bin/run-clang-tidy-cached.cc \
|| ( cat verible_clang-tidy.out ; exit 1)
- name: 📤 Upload performance graphs
uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: "diag"
path: "**/plot_*.svg"
Check:
container: ubuntu:jammy
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
strategy:
fail-fast: false
matrix:
mode:
- test
- test-nortti
- test-c++20
- test-c++23
- smoke-test
- smoke-test-analyzer
- asan
- asan-clang
- compile
- compile-clang
- compile-static
- compile-static-clang
- coverage
- clean
arch:
- x86_64
- arm64
exclude:
- mode: test-nortti
arch: arm64
- mode: test-c++20
arch: arm64
- mode: test-c++23
arch: arm64
- mode: asan
arch: arm64
- mode: asan-clang
arch: arm64
- mode: coverage
arch: arm64
env:
MODE: ${{ matrix.mode }}
ARCH: ${{ matrix.arch }}
GHA_MACHINE_TYPE: "${{ matrix.arch == 'arm64' && 't2a-standard-8' || 'n2-standard-8' }}"
name: ${{ matrix.arch }} ${{ matrix.mode }}
steps:
- name: Cancel previous
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout code
uses: actions/checkout@v3
with:
# Download complete repository + tags
fetch-depth: 0
- name: Create Cache Timestamp
id: cache_timestamp
uses: nanzm/[email protected]
with:
format: 'YYYY-MM-DD-HH-mm-ss'
- name: Mount bazel cache
uses: actions/cache@v3
if: matrix.mode != 'clean' && matrix.mode != 'coverage'
with:
path: "/root/.cache/bazel"
key: bazelcache3_${{ matrix.arch }}_${{ matrix.mode }}_${{ steps.cache_timestamp.outputs.time }}
restore-keys: bazelcache3_${{ matrix.arch }}_${{ matrix.mode }}_
- name: Install Dependencies
run: |
set -x
apt -qqy update
apt -qq -y install build-essential wget git python3 python-is-python3 default-jdk cmake python3-pip ripgrep
apt -qq -y install gcc-10 g++-10
apt -qq -y install gcc-12 g++-12
apt -qq -y install clang-12 # clang always a particular version.
source ./.github/settings.sh
# Use newer compiler for c++2x compilation. Also slang needs c++20
./.github/bin/set-compiler.sh $([[ "$MODE" == test-c++2* || "$MODE" == "smoke-test-analyzer" ]] && echo 12 || echo 10)
ARCH="$ARCH" ./.github/bin/install-bazel.sh
- name: Build Slang
if: matrix.mode == 'smoke-test-analyzer'
run: |
pushd .
git clone https://github.com/MikePopoloski/slang.git /tmp/slang
cd /tmp/slang
git checkout v3.0 # Pin version; current head cmake files in flux
cmake -B build
cmake --build build -j $(nproc)
cmake --install build --strip
popd
- name: Install Python dependencies
if: matrix.mode == 'smoke-test-analyzer'
run: |
pip3 install mdutils
- name: ${{ matrix.mode }} Verible
run: ./.github/bin/build-and-test.sh
- name: Upload coverage
# will show up under https://app.codecov.io/gh/chipsalliance/verible
if: matrix.mode == 'coverage'
uses: codecov/codecov-action@v2
with:
files: bazel-out/_coverage/_coverage_report.dat
verbose: true
continue-on-error: true
- name: Gather and pack binaries
if: matrix.mode == 'compile' && matrix.arch == 'x86_64'
run: bazel run :install -c fastbuild -- $VERIBLE_BINDIR && tar cfv verible-bin.tar -C $VERIBLE_BINDIR .
- name: Upload bazel-bin
if: matrix.mode == 'compile' && matrix.arch == 'x86_64'
uses: actions/upload-artifact@v2
with:
name: verible-bin
path: verible-bin.tar
- name: 📤 Upload performance graphs
uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: "diag"
path: "**/plot_*.svg"
KytheVerification:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# Download complete repository + tags
fetch-depth: 0
- name: Install Dependencies
run: |
source ./.github/settings.sh
./.github/bin/set-compiler.sh 10
./.github/bin/install-bazel.sh
./.github/bin/install-kythe-tools.sh
- name: Run Kythe Verification tests
run: |
source ./.github/settings.sh
./.github/bin/verify-kythe-extraction.sh
KytheXrefs:
runs-on: ubuntu-20.04
if: false # Currently disabled, need to investigate failure.
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# Download complete repository + tags
fetch-depth: 0
- name: Install Dependencies
run: |
source ./.github/settings.sh
./.github/bin/set-compiler.sh 10
./.github/bin/install-bazel.sh
./.github/bin/install-kythe.sh
- name: Extract Verible Kythe xRefs
run: |
source ./.github/settings.sh
./.github/bin/run-kythe.sh
- name: 📤 Upload Kythe xRefs to the action artifacts
uses: actions/upload-artifact@v2
with:
path: kythe_output/*.kzip
Matrix:
runs-on: ubuntu-latest
name: Generate Build matrix
outputs:
matrix: ${{ steps.generate.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- id: generate
run: ./.github/bin/generate-matrix.py
Build:
needs: Matrix
container: ubuntu:jammy
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
# Github actions resources are limited; don't build artifacts for all
# platforms on every pull request, only on push.
if: ${{github.event_name == 'push'}}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.Matrix.outputs.matrix) }}
env:
MATRIX_OS: '${{ matrix.os }}:${{ matrix.ver }}'
LINK_TYPE: '${{ matrix.link }}'
ARCH: '${{ matrix.arch }}'
DOCKER_DATA_ROOT: "/root/.docker"
GHA_MACHINE_TYPE: "${{ matrix.arch == 'arm64' && 't2a-standard-8' || 'n2-highcpu-8' }}"
name: "Build ·${{ matrix.arch }}:${{ matrix.os }}:${{ matrix.ver }}${{ matrix.link == 'static' && ':static' || '' }}"
steps:
- uses: actions/checkout@v3
with:
# Download complete repository + tags
fetch-depth: 0
- name: Install and setup Docker
run: "apt -qqy update && apt -qqy --no-install-recommends install docker.io cgroupfs-mount crun fuse-overlayfs pigz ca-certificates git && cgroupfs-mount"
- name: Main script
run: |
set -x
mkdir -p "$DOCKER_DATA_ROOT"
dockerd \
-s fuse-overlayfs \
--add-runtime=crun=/usr/bin/crun \
--default-runtime=crun \
--config-file="" \
--data-root=$DOCKER_DATA_ROOT > /dev/null 2>&1 &
while ! test -S /var/run/docker.sock; do echo "Waiting for Docker..." && sleep 1; done; docker info
trap "kill $(cat /var/run/docker.pid)" EXIT
docker pull $MATRIX_OS
source ./.github/settings.sh
ARCH="$ARCH" LINK_TYPE="$LINK_TYPE" ./releasing/docker-run.sh $MATRIX_OS
- name: 📤 Upload artifact
uses: actions/upload-artifact@v2
with:
path: releasing/out/verible-*.tar.gz
- name: 📤 Upload performance graphs
uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: "diag"
path: "**/plot_*.svg"
MacOsBuildDevTools:
runs-on: macos-latest
steps:
- name: Cancel previous
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Install Dependencies
run: |
brew install llvm
echo "CLANG_TIDY=$(brew --prefix llvm)/bin/clang-tidy" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Cache Timestamp
id: cache_timestamp
uses: nanzm/[email protected]
with:
format: 'YYYY-MM-DD-HH-mm-ss'
- name: Mount bazel cache
uses: actions/cache@v3
with:
path: |
/private/var/tmp/_bazel_runner
/Users/runner/.cache/clang-tidy
key: clangtidy_macos_${{ steps.cache_timestamp.outputs.time }}
restore-keys: clangtidy_macos_
- name: Test Developer tooling scripts
run: |
# Just a smoke test to make sure developer scripts run on Mac
echo "::group::Make Compilation DB"
.github/bin/make-compilation-db.sh
echo "::endgroup::"
# Quick with no checks to be fast (full tidy run in ClangTidy action)
.github/bin/run-clang-tidy-cached.cc --checks="-*"
MacOsBuild:
runs-on: macos-latest
steps:
- name: Cancel previous
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Cache Timestamp
id: cache_timestamp
uses: nanzm/[email protected]
with:
format: 'YYYY-MM-DD-HH-mm-ss'
- name: Mount bazel cache
uses: actions/cache@v3
with:
path: |
/private/var/tmp/_bazel_runner
key: bazelcache_macos_${{ steps.cache_timestamp.outputs.time }}
restore-keys: bazelcache_macos_
- name: Tests
run: bazel test -c opt --noshow_progress --test_output=errors --cxxopt=-Wno-range-loop-analysis //...
- name: Build
run: bazel build -c opt --noshow_progress --test_output=errors --cxxopt=-Wno-range-loop-analysis :install-binaries
- name: Pack up
run: |
VERSION=$(git describe --match=v*)
.github/bin/simple-install.sh verible-${VERSION}-macOS/bin
tar cvzf verible-${VERSION}-macOS.tar.gz verible-${VERSION}-macOS
- name: 📤 Upload artifact
uses: actions/upload-artifact@v2
with:
path: verible-*.tar.gz
PrepareVSPlugin:
container: ubuntu:jammy
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
run: |
apt -qqy update
apt -qq -y install npm nodejs
WindowsBuild:
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Cache Timestamp
id: cache_timestamp
uses: nanzm/[email protected]
with:
format: 'YYYY-MM-DD-HH-mm-ss'
- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "c:/users/runneradmin/_bazel_runneradmin"
key: bazelcache_windows2_${{ steps.cache_timestamp.outputs.time }}
restore-keys: bazelcache_windows2_
- name: Install dependencies
# Bazel breaks on Windows with LLVM 16. Will be fixed in bazel 6.4
run: choco install llvm --force --version=15.0.7
- name: Debug bazel directory settings
run: bazel info
- name: Run Tests
run: bazel test --keep_going --noshow_progress --test_output=errors //...
- name: Build Verible Binaries
run: bazel build --keep_going --noshow_progress -c opt :install-binaries
- name: Prepare release
run: |
$VERSION = git describe --match=v*
bazel run -c opt :install -- "c:/verible-${VERSION}-win64"
7z a "verible-${VERSION}-win64.zip" "c:/verible-${VERSION}-win64"
- name: 📤 Upload artifact
uses: actions/upload-artifact@v2
with:
path: verible-*.zip
# We need to shut down bazel to let go of the filedescriptors in the
# cache directory. Because of strange filesystem semantics on Windows, this
# prevents packaging up the cache.
- name: Stop Bazel
run: |
bazel shutdown
# The cache pack/restore has issues with these symbolic links
rm c:/users/runneradmin/_bazel_runneradmin/*/install
rm c:/users/runneradmin/_bazel_runneradmin/*/java.log
Release:
needs: [ Check, Build, MacOsBuild, WindowsBuild, PrepareVSPlugin ]
runs-on: ubuntu-20.04
name: 📦 Release
if: ${{github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')}}
steps:
- uses: actions/checkout@v3
with:
# Download complete repository + tags
fetch-depth: 0
- name: 📥 Download artifacts
uses: actions/download-artifact@v3
- name: Generate and apply TAG
run: |
git config --local user.name "$BOT_USER"
git config --local user.email "$BOT_EMAIL"
# Create a tag of form v0.0-183-gdf2b162-20191112132344
TAG="${TAG:-$(git describe --match=v*)}"
git tag "$TAG" || true
echo "TAG=$TAG" >> $GITHUB_ENV
ls -lah artifact
- name: Deploy release and assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifact/verible*.{tar.gz,zip}
tag: ${{ env.TAG }}
overwrite: true
file_glob: true
- name: Publish VSCode extension
env:
VSC_MARKETPLACE_TOKEN: ${{ secrets.VSC_MARKETPLACE_TOKEN }}
run: |
cd verilog/tools/ls/vscode
npm install
# install vsce globally
npm install -g @vscode/vsce
# Patch the JSON file to contain our current git tag+commit
VERSION=$(git describe | sed 's|v\([^-]\+\)-\([[:digit:]]\+\).*|\1.\2|')
sed -i 's|\(.*version.*\): "\([^"]\+\)"|\1: "'${VERSION}'"|g' package.json
sed -i 's|\(.*tag.*\): "\([^"]\+\)"|\1: "'${TAG}'"|g' package.json
vsce publish -p ${VSC_MARKETPLACE_TOKEN}
GhPages:
name: Build and deploy GitHub pages
needs: [Check]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: verible-bin
- name: Extract Verible binaries
run: mkdir -p $VERIBLE_BINDIR && tar xvf verible-bin.tar -C $VERIBLE_BINDIR
- name: Set up things for GitHub Pages deployment
run: ./.github/bin/github-pages-setup.sh $VERIBLE_BINDIR
- name: Deployment
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: /tmp/pages
CLEAN: true