-
Notifications
You must be signed in to change notification settings - Fork 6
452 lines (386 loc) · 15.3 KB
/
capi-gen.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
name: Build CAPI
on:
push:
workflow_dispatch:
jobs:
build-linux:
runs-on: ubuntu-18.04
defaults:
run:
shell: bash
steps:
- run: |
sudo chmod 777 /
sudo chmod 777 /usr/bin
# clang
# can't cache individual files
# - name: Cache clang-cl
# id: cache-clang-cl
# uses: actions/[email protected]
# with:
# path: /usr/bin/*clang-cl /usr/bin/*lld-link
# key: clang-cl-1
- name: Install clang-cl & lld-link
# if: steps.cache-clang-cl.outputs.cache-hit != 'true'
run: |
sudo apt install -y clang-tools-9
# llvm-project
- name: Cache LLVM build files
id: cache-llvm
uses: actions/[email protected]
with:
path: llvm-project
key: llvm-project-linux3
- name: Fetch LLVM Project
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: "git clone --depth 1 -j8 https://github.com/llvm/llvm-project.git"
- uses: actions/[email protected]
with:
path: llvm-project/clang-tools-extra/altv-capi
submodules: 'recursive'
- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v3
- name: Setup Node.js environment
uses: actions/[email protected]
# write the cmakelists file
- run: "echo -e 'include(CMakeDependentOption)\nadd_subdirectory(altv-capi)' >> CMakeLists.txt"
if: steps.cache-llvm.outputs.cache-hit != 'true'
working-directory: llvm-project/clang-tools-extra
# Linux
- name: Generate
run: "cmake -G Ninja llvm -B'A-BUILD-NINJA-Release' -DCMAKE_BUILD_TYPE='Release' -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra' -DLLVM_BUILD_TESTS=OFF -DLLVM_ENABLE_CXX1Z=ON -DLLVM_ENABLE_LIBCXX=OFF -DLLVM_STATIC_LINK_CXX_STDLIB=ON -DCMAKE_C_COMPILER='clang-9' -DCMAKE_ASM_COMPILER='clang-9' -DCMAKE_CXX_COMPILER='clang++-9' -DCLANG_DEFAULT_LINKER='ld.lld' -DLLVM_ENABLE_LLD=ON"
working-directory: llvm-project
- name: Build
run: "cmake --build A-BUILD-NINJA-Release --config Release --target altv-capi-gen"
working-directory: llvm-project
- name: Symlink generator
run: cp "./llvm-project/A-BUILD-NINJA-Release/bin/altv-capi-gen" "./llvm-project/clang-tools-extra/altv-capi/tools/altv-capi-gen"
- name: Get CPP-SDK
run: ./tools/get-cppsdk.sh
working-directory: llvm-project/clang-tools-extra/altv-capi
- name: Build server CAPI
run: |
./gen-server.sh
./build.sh
working-directory: llvm-project/clang-tools-extra/altv-capi/capi
- name: Linux altv-capi-gen artifacts
uses: actions/upload-artifact@v2
with:
name: altv-capi-gen-linux
path: llvm-project/A-BUILD-NINJA-Release/bin/altv-capi-gen
- name: Linux altv-capi-server artifacts
uses: actions/upload-artifact@v2
with:
name: altv-capi-server-linux
path: llvm-project/clang-tools-extra/altv-capi/capi/BUILD/altv-capi-server
- name: Linux altv-capi-server-static artifacts
uses: actions/upload-artifact@v2
with:
name: altv-capi-server-static-linux
path: llvm-project/clang-tools-extra/altv-capi/capi/BUILD/altv-capi-server-static
build-win32:
runs-on: windows-latest
defaults:
run:
shell: cmd
steps:
# - uses: rlespinasse/[email protected]
# - name: FIX FOR https://github.com/microsoft/STL/issues/1300
# run: |
# C:\msys64\usr\bin\wget.exe -q "https://github.com/microsoft/STL/files/5453503/GH-1300.diff.txt"
# git apply --unsafe-paths -p6 --directory="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29333\include" "GH-1300.diff.txt"
- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v3
- name: Setup Node.js environment
uses: actions/[email protected]
- name: Cache LLVM chocolatey
id: cache-llvm-choco
uses: actions/[email protected]
with:
path: "C:/Program Files/LLVM"
key: llvm-choco
- run: choco install llvm -y --no-progress
if: steps.cache-llvm-choco.outputs.cache-hit != 'true'
# llvm-project
- name: Cache LLVM Project files
id: cache-llvm
uses: actions/[email protected]
with:
path: llvm-project
key: llvm-project-win32-2
- name: Fetch LLVM Project
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: "git clone --depth 1 -j8 https://github.com/llvm/llvm-project.git"
- uses: actions/[email protected]
with:
path: llvm-project/clang-tools-extra/altv-capi
submodules: 'recursive'
# write the cmakelists file
- run: "echo include(CMakeDependentOption) > CMakeLists.txt && echo add_subdirectory(altv-capi) >> CMakeLists.txt"
if: steps.cache-llvm.outputs.cache-hit != 'true'
working-directory: llvm-project/clang-tools-extra
# Parser
- name: Generate
run: "clang-tools-extra\\altv-capi\\tools\\NINJA-vs2019e-RelWithDebInfo-GEN.bat"
working-directory: llvm-project
- name: Build
run: "clang-tools-extra\\altv-capi\\tools\\NINJA-vs2019e-RelWithDebInfo-BUILD.bat"
working-directory: llvm-project
- name: Symlink generator
run: cp "./llvm-project/A-BUILD-NINJA-VS2019-RelWithDebInfo/bin/altv-capi-gen.exe" "./llvm-project/clang-tools-extra/altv-capi/tools/altv-capi-gen.exe"
shell: bash
- name: Get CPP-SDK
run: "tools/get-cppsdk.bat"
working-directory: llvm-project/clang-tools-extra/altv-capi
- name: Gen server CAPI
run: gen-server.bat
working-directory: llvm-project/clang-tools-extra/altv-capi/capi
- name: Gen client CAPI
run: gen-client.bat
working-directory: llvm-project/clang-tools-extra/altv-capi/capi
- name: Build CAPI
run: build.bat
working-directory: llvm-project/clang-tools-extra/altv-capi/capi
- name: Win32 altv-capi-gen artifacts
uses: actions/upload-artifact@v2
with:
name: altv-capi-gen-win32
path: llvm-project/A-BUILD-NINJA-VS2019-RelWithDebInfo/bin/altv-capi-gen.exe
- name: Win32 altv-capi-client.json artifacts
uses: actions/upload-artifact@v2
with:
name: altv-capi-client.json
path: llvm-project/clang-tools-extra/altv-capi/capi/client/altv-capi.json
- name: Win32 altv-capi-server.json artifacts
uses: actions/upload-artifact@v2
with:
name: altv-capi-server.json
path: llvm-project/clang-tools-extra/altv-capi/capi/server/altv-capi.json
- name: Win32 altv-capi-server artifacts
uses: actions/upload-artifact@v2
with:
name: altv-capi-server-win32
path: llvm-project/clang-tools-extra/altv-capi/capi/BUILD/altv-capi-server
- name: Win32 altv-capi-server-static artifacts
uses: actions/upload-artifact@v2
with:
name: altv-capi-server-static-win32
path: llvm-project/clang-tools-extra/altv-capi/capi/BUILD/altv-capi-server-static
- name: Win32 altv-capi-client artifacts
uses: actions/upload-artifact@v2
with:
name: altv-capi-client-win32
path: llvm-project/clang-tools-extra/altv-capi/capi/BUILD/altv-capi-client
- name: Win32 altv-capi-client-static artifacts
uses: actions/upload-artifact@v2
with:
name: altv-capi-client-static-win32
path: llvm-project/clang-tools-extra/altv-capi/capi/BUILD/altv-capi-client-static
- name: Win32 altv-capi-client-static-mtd artifacts
uses: actions/upload-artifact@v2
with:
name: altv-capi-client-static-mtd-win32
path: llvm-project/clang-tools-extra/altv-capi/capi/BUILD/altv-capi-client-static-mtd
release:
runs-on: ubuntu-18.04
needs: [build-linux, build-win32]
defaults:
run:
shell: bash
steps:
- uses: rlespinasse/[email protected]
- name: Create Release
id: create_release
if: github.ref == 'refs/heads/master'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.GITHUB_REF_SLUG }}-${{ github.run_number }}
release_name: ${{ env.GITHUB_REF_SLUG }}-${{ github.run_number }}
# linux dl
- name: Download altv-capi-gen-linux artifact
uses: actions/download-artifact@v2
with:
name: altv-capi-gen-linux
- name: Download altv-capi-server-linux artifact
uses: actions/download-artifact@v2
with:
name: altv-capi-server-linux
path: altv-capi-server-linux
- name: Download altv-capi-server-static-linux artifact
uses: actions/download-artifact@v2
with:
name: altv-capi-server-static-linux
path: altv-capi-server-static-linux
# win32 dl
- name: Download altv-capi-gen-win32 artifact
uses: actions/download-artifact@v2
with:
name: altv-capi-gen-win32
- name: Download altv-capi-client.json artifact
uses: actions/download-artifact@v2
with:
name: altv-capi-client.json
path: client
- name: Download altv-capi-server.json artifact
uses: actions/download-artifact@v2
with:
name: altv-capi-server.json
path: server
- name: Download altv-capi-server-win32 artifact
uses: actions/download-artifact@v2
with:
name: altv-capi-server-win32
path: altv-capi-server-win32
- name: Download altv-capi-server-static-win32 artifact
uses: actions/download-artifact@v2
with:
name: altv-capi-server-static-win32
path: altv-capi-server-static-win32
- name: Download altv-capi-client-win32 artifact
uses: actions/download-artifact@v2
with:
name: altv-capi-client-win32
path: altv-capi-client-win32
- name: Download altv-capi-client-static-win32 artifact
uses: actions/download-artifact@v2
with:
name: altv-capi-client-static-win32
path: altv-capi-client-static-win32
- name: Download altv-capi-client-static-mtd-win32 artifact
uses: actions/download-artifact@v2
with:
name: altv-capi-client-static-mtd-win32
path: altv-capi-client-static-mtd-win32
# linux zips
- run: zip -r altv-capi-server-linux.zip altv-capi-server-linux
- run: zip -r altv-capi-server-static-linux.zip altv-capi-server-static-linux
# win32 zips
- run: zip -r altv-capi-server-win32.zip altv-capi-server-win32
- run: zip -r altv-capi-server-static-win32.zip altv-capi-server-static-win32
- run: zip -r altv-capi-client-win32.zip altv-capi-client-win32
- run: zip -r altv-capi-client-static-win32.zip altv-capi-client-static-win32
- run: zip -r altv-capi-client-static-mtd-win32.zip altv-capi-client-static-mtd-win32
# linux rel
- name: Upload altv-capi-gen-linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: altv-capi-gen
asset_name: altv-capi-gen
asset_content_type: application/zip
- name: Upload altv-capi-server-linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: altv-capi-server-linux.zip
asset_name: altv-capi-server-linux.zip
asset_content_type: application/zip
- name: Upload altv-capi-server-static-linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: altv-capi-server-static-linux.zip
asset_name: altv-capi-server-static-linux.zip
asset_content_type: application/zip
# win32 rel
- name: Upload windows parser
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: altv-capi-gen.exe
asset_name: altv-capi-gen.exe
asset_content_type: application/zip
- name: Upload altv-capi-server-win32
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: altv-capi-server-win32.zip
asset_name: altv-capi-server-win32.zip
asset_content_type: application/zip
- name: Upload altv-capi-server-static-win32
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: altv-capi-server-static-win32.zip
asset_name: altv-capi-server-static-win32.zip
asset_content_type: application/zip
- name: Upload altv-capi-client-win32
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: altv-capi-client-win32.zip
asset_name: altv-capi-client-win32.zip
asset_content_type: application/zip
- name: Upload altv-capi-client-static-win32
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: altv-capi-client-static-win32.zip
asset_name: altv-capi-client-static-win32.zip
asset_content_type: application/zip
- name: Upload altv-capi-client-static-mtd-win32
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: altv-capi-client-static-mtd-win32.zip
asset_name: altv-capi-client-static-mtd-win32.zip
asset_content_type: application/zip
- name: Upload client json
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: client/altv-capi.json
asset_name: altv-capi-client.json
asset_content_type: application/zip
- name: Upload server json
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: server/altv-capi.json
asset_name: altv-capi-server.json
asset_content_type: application/zip
delete-artifacts:
name: Delete artifacts
runs-on: ubuntu-18.04
needs: [release]
if: ${{ always() }}
steps:
- name: Delete artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: |
altv-capi-gen-linux
altv-capi-server-linux
altv-capi-server-static-linux
altv-capi-gen-win32
altv-capi-client.json
altv-capi-server.json
altv-capi-server-win32
altv-capi-server-static-win32
altv-capi-client-win32
altv-capi-client-static-win32
altv-capi-client-static-mtd-win32