-
Notifications
You must be signed in to change notification settings - Fork 1
377 lines (367 loc) · 12.9 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
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: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@b03a6aa289adef5534c84ccb6fbef7c975973574 # v2.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # master
- name: Set up Clang
uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1.4
with:
version: latest
platform: x64
- 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@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: brgen-linux
path: ./artifacts
build-macos:
runs-on: macos-latest
timeout-minutes: 20
steps:
- name: Timeline
uses: Kesin11/actions-timeline@b03a6aa289adef5534c84ccb6fbef7c975973574 # v2.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # master
- name: Install Homebrew Clang
run: |
brew install llvm
- name: Build
run: |
export FUTILS_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++
export FUTILS_C_COMPILER=/usr/local/opt/llvm/bin/clang
. 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@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: brgen-macos
path: ./artifacts
build-windows:
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Timeline
uses: Kesin11/actions-timeline@b03a6aa289adef5534c84ccb6fbef7c975973574 # v2.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # master
- name: Set up Clang
uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1.4
with:
version: latest
platform: x64
- 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@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: brgen-windows
path: ./artifacts
build-vscode-extension:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@b03a6aa289adef5534c84ccb6fbef7c975973574 # v2.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Set up Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
- name: Setup ast2ts
run: |
cd 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@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: brgen-vscode-extension
path: ./artifacts
build-arm-linux:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@b03a6aa289adef5534c84ccb6fbef7c975973574 # v2.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # 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@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: brgen-linux-arm
path: ./artifacts
build-android:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@b03a6aa289adef5534c84ccb6fbef7c975973574 # v2.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # master
- name: Install Android NDK
uses: nttld/setup-ndk@6a7e9c5494a25c4842ca1011f710300132eacd94 # v1.4.2
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@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: brgen-android
path: ./artifacts
collect-licenses:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@b03a6aa289adef5534c84ccb6fbef7c975973574 # v2.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: fetch dependencies
run: |
go mod download
cd 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@70da3bbf44ac06db1b0547ce2acc9380a5270d1e # v1.175.0
with:
ruby-version: ruby
- uses: github/setup-licensed@d6b3a6f7058c2b40c06d205e13e15c2418977566 # v1.1.4
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@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: brgen-licenses
path: ./license_cache
build-pages:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@b03a6aa289adef5534c84ccb6fbef7c975973574 # v2.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Setup Emscripten
uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # master
- name: Set up ast2ts
run: |
cd 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"
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@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: brgen-web
path: "./web/public"
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
release:
needs:
[
build-linux,
build-macos,
build-windows,
build-vscode-extension,
build-arm-linux,
build-android,
build-pages,
collect-licenses,
]
uses: ./.github/workflows/release.yml
permissions:
contents: write
run-test:
needs: build-linux
uses: ./.github/workflows/brgen-test.yaml
deploy:
needs: build-pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: ./.github/workflows/deploy.yml
permissions:
contents: read
pages: write
id-token: write