-
Notifications
You must be signed in to change notification settings - Fork 1
494 lines (483 loc) · 17 KB
/
build.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
name: brgen-build
run-name: Build
on: push
concurrency:
group: build-${{ github.ref_name }}
cancel-in-progress: true
jobs:
build-linux:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master
- name: Set up Clang
uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1.4
with:
version: latest
platform: x64
- name: Install libc++-dev and libc++abi-dev
run: sudo apt-get install libc++-dev libc++abi-dev -y
- name: Cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
# prevent renovate from updating this
if: (!startsWith(github.ref , 'refs/heads/renovate/')) && (!startsWith(github.ref , 'refs/heads/dependabot/'))
id: cache_linux
env:
cache-name: cache-linux-built
with:
path: |
./built
./utils
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('build.sh') }}
- name: Pull Utils
if: ${{ steps.cache_linux.outputs.cache-hit }}
run: |
cd utils
git pull
. build shared Release futils
cd ..
- name: Build
run: |
. build.sh native Release
./tool/src2json --version
- name: Pack artifacts
run: |
mkdir -p artifacts
cp -a ./tool ./artifacts/tool
cp -a ./script/link_path.sh ./artifacts
cp -a ./example ./artifacts/example
cp -a ./LICENSE ./artifacts
cp -a ./README.md ./artifacts
cp -a ./brgen.json ./artifacts
cp -a ./script/make_cpp_test.sh ./artifacts
cp -a ./script/make_cpp_tests.sh ./artifacts
cp -a ./testkit ./artifacts/testkit
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-linux
path: ./artifacts
build-macos:
runs-on: macos-latest
timeout-minutes: 20
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master
- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ">=1.20"
- name: Install Homebrew Clang
run: |
brew install llvm
- name: Check Code
run: |
PREFIX=$(brew --prefix llvm)
# from https://github.com/llvm/llvm-project/issues/77786
LIBCPP=$PREFIX/lib/c++
ls $LIBCPP
echo "libc++"
nm $LIBCPP/libc++.1.dylib | c++filt
echo "libc++abi"
nm $LIBCPP/libc++abi.1.dylib | c++filt
- name: Cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
# prevent renovate from updating this
if: (!startsWith(github.ref , 'refs/heads/renovate/')) && (!startsWith(github.ref , 'refs/heads/dependabot/'))
id: cache_macos
env:
cache-name: cache-macos-built
with:
path: |
./built
./utils
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('build.sh') }}
- name: Pull Utils
if: ${{ steps.cache_macos.outputs.cache-hit }}
run: |
cd utils
git pull
PREFIX=$(brew --prefix llvm)
export FUTILS_CXX_COMPILER=$PREFIX/bin/clang++
export FUTILS_C_COMPILER=$PREFIX/bin/clang
export LDFLAGS="-L$PREFIX/lib/c++ -Wl,-rpath,$PREFIX/lib/c++"
. build shared Release futils
cd ..
- name: Build
run: |
PREFIX=$(brew --prefix llvm)
export FUTILS_CXX_COMPILER=$PREFIX/bin/clang++
export FUTILS_C_COMPILER=$PREFIX/bin/clang
export LDFLAGS="-L$PREFIX/lib/c++ -Wl,-rpath,$PREFIX/lib/c++"
. build.sh native Release
./tool/src2json --version
- name: Pack artifacts
run: |
mkdir -p artifacts
cp -a ./tool ./artifacts/tool
cp -a ./script/link_path.sh ./artifacts
cp -a ./example ./artifacts/example
cp -a ./LICENSE ./artifacts
cp -a ./README.md ./artifacts
cp -a ./brgen.json ./artifacts
cp -a ./script/make_cpp_test.sh ./artifacts
cp -a ./script/make_cpp_tests.sh ./artifacts
cp -a ./testkit ./artifacts/testkit
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-macos
path: ./artifacts
build-windows:
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master
- name: Set up Clang
uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1.4
with:
version: latest
platform: x64
- name: Cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
id: cache_windows
# prevent renovate from updating this
if: (!startsWith(github.ref , 'refs/heads/renovate/')) && (!startsWith(github.ref , 'refs/heads/dependabot/'))
env:
cache-name: cache-windows-built
with:
path: |
./built
./utils
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('build.bat') }}
- name: Pull Utils
if: ${{ steps.cache_windows.outputs.cache-hit }}
shell: cmd
run: |
cd utils
git pull
build shared Release futils
cd ..
- name: Build
shell: cmd
run: |
call .\build.bat native Release %CD%\utils
.\tool\src2json.exe --version
- name: Pack artifacts
shell: cmd
run: |
mkdir artifacts
xcopy /E /I /Y tool artifacts\tool
xcopy /E /I /Y example artifacts\example
copy /Y LICENSE artifacts
copy /Y README.md artifacts
copy /Y brgen.json artifacts
copy /Y script\make_cpp_test.bat artifacts
copy /Y script\make_cpp_tests.bat artifacts
xcopy /E /I /Y testkit artifacts\testkit
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-windows
path: ./artifacts
build-vscode-extension:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
- name: Setup ast2ts
run: |
cd astlib/ast2ts
npm install
tsc
cd ../..
- name: Install VSCE
run: npm install -g vsce
- name: Build
run: |
cd lsp
npm install
vsce package
- name: Pack artifacts
run: |
mkdir -p artifacts
cp -a ./lsp/LICENSE ./artifacts
cp -a ./lsp/brgen-lsp-*.vsix ./artifacts
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-vscode-extension
path: ./artifacts
build-arm-linux:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master
- name: Install Cross Compiler
run: |
sudo apt-get update && sudo apt-get install -y g++-aarch64-linux-gnu
- name: Build
run: |
go version
export GOARCH=arm64
export FUTILS_CXX_COMPILER=aarch64-linux-gnu-g++
export FUTILS_C_COMPILER=aarch64-linux-gnu-gcc
export CC=$FUTILS_C_COMPILER
. build.sh native Release
- name: Pack artifacts
run: |
mkdir -p artifacts
cp -a ./tool ./artifacts/tool
cp -a ./script/link_path.sh ./artifacts
cp -a ./example ./artifacts/example
cp -a ./LICENSE ./artifacts
cp -a ./README.md ./artifacts
cp -a ./brgen.json ./artifacts
cp -a ./script/make_cpp_test.sh ./artifacts
cp -a ./script/make_cpp_tests.sh ./artifacts
cp -a ./testkit ./artifacts/testkit
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-linux-arm
path: ./artifacts
build-android:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master
- name: Install Android NDK
uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 # v1.5.0
with:
ndk-version: r26b
- name: Build
run: |
BASE_PATH=/opt/hostedtoolcache/ndk/r26b/x64/toolchains/llvm/prebuilt/linux-x86_64
#ls -Ral $BASE_PATH
export GOARCH=arm64
export FUTILS_CXX_COMPILER=$BASE_PATH/bin/aarch64-linux-android21-clang++
export FUTILS_C_COMPILER=$BASE_PATH/bin/aarch64-linux-android21-clang
export CC=$FUTILS_C_COMPILER
. build.sh native Release
LIBCPP_SHARED=$BASE_PATH/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so
cp $LIBCPP_SHARED ./tool
- name: Pack artifacts
run: |
mkdir -p artifacts
cp -a ./tool ./artifacts/tool
cp -a ./script/link_path.sh ./artifacts
cp -a ./example ./artifacts/example
cp -a ./LICENSE ./artifacts
cp -a ./README.md ./artifacts
cp -a ./brgen.json ./artifacts
cp -a ./script/make_cpp_test.sh ./artifacts
cp -a ./script/make_cpp_tests.sh ./artifacts
cp -a ./testkit ./artifacts/testkit
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-android
path: ./artifacts
collect-licenses:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: fetch dependencies
run: |
go mod download
cd astlib/ast2ts
npm install
tsc
cp ../../LICENSE ./out
cd ../../lsp
npm install
cd server
npm install
cd ../client
npm install
cd ../../src/tool/json2rust
mkdir -p ./pkg
cp ../../../LICENSE ./pkg
cd ../../../web/doc
go mod download
cd ../dev
npm install
cd ../..
- name: Install gocredits
run: |
go install github.com/Songmu/gocredits/cmd/gocredits@latest
- name: Set up ruby
uses: ruby/setup-ruby@401c19e14f474b54450cd3905bb8b86e2c8509cf # v1.204.0
with:
ruby-version: ruby
- uses: github/setup-licensed@be11bcbb82e3140b6cf260e647c3efeeca8fcefd # v1.3.1
with:
version: "4.4" # required: supports matching based on string equivalence or node-semver range
- name: Collect licenses
run: |
go mod edit -json
. ./script/collect_licenses.sh
- name: List licenses
run: |
ls -alR ./license_cache
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-licenses
path: ./license_cache
build-pages:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Emscripten
uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14
with:
actions-cache-folder: emsdk
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: "1.23"
- name: Cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
# prevent renovate from updating this
if: (!startsWith(github.ref , 'refs/heads/renovate/')) && (!startsWith(github.ref , 'refs/heads/dependabot/'))
id: cache_web
env:
cache-name: cache-web-built
with:
path: |
./built
./utils
./astlib/ast2ts/node_modules
./web/dev/node_modules
./emsdk
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('build.sh') }}
- name: Pull Utils
if: ${{ steps.cache_web.outputs.cache-hit }}
run: |
cd utils
git pull
. build wasm-em Release futils
cd ..
- name: Set up ast2ts
run: |
cd astlib/ast2ts
npm install
tsc
cd ../..
- name: Set up wasm-pack
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build Wasm
run: |
GOROOT=`go env GOROOT`
echo "GOROOT=$GOROOT"
export WASMEXEC_FILE="$GOROOT/misc/wasm/wasm_exec.js"
if [ ! -e "$WASMEXEC_FILE" ]; then
echo "$WASMEXEC_FILE not found"
exit 1
fi
export WEB_PRODUCTION="production"
. build.sh wasm-em Release
- name: Setup Hugo
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0
with:
hugo-version: "latest"
extended: true
- name: Build Hugo
run: |
cd web/doc
hugo --minify
cd ../..
- name: Upload artifact
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-web
path: "./web/public"
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
run-test:
needs: build-linux
uses: ./.github/workflows/brgen-test.yaml
puppeteer-test:
needs: build-pages
uses: ./.github/workflows/puppeteer-test.yml
release:
needs:
[
build-linux,
build-macos,
build-windows,
build-vscode-extension,
build-arm-linux,
build-android,
build-pages,
collect-licenses,
run-test,
puppeteer-test,
]
uses: ./.github/workflows/release.yml
permissions:
contents: write
deploy:
needs: puppeteer-test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: ./.github/workflows/deploy.yml
permissions:
contents: read
pages: write
id-token: write