-
Notifications
You must be signed in to change notification settings - Fork 0
497 lines (431 loc) · 15.1 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
495
496
497
name: Build cosmotop
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
workflow_call:
inputs:
version:
required: true
type: string
env:
zig_version: 0.13.0
jobs:
build:
name: Build cosmotop.com
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Load cosmocc version
run: |
version=$(cat .github/cosmocc_version.txt)
echo "cosmocc_version=${version}" >> "$GITHUB_ENV"
- name: Setup cosmocc
uses: bjia56/[email protected]
with:
version: ${{ env.cosmocc_version }}
- name: Build cosmotop.com
run: |
export CC=cosmocc
export CXX=cosmoc++
cmake -B build -DTARGET=host ${{ inputs.version && '-DRELEASE=1' || '' }}
cmake --build build --parallel 4
- name: Upload cosmotop.com
uses: actions/upload-artifact@v4
with:
name: cosmotop.com
path: ./build/cosmotop.com
- name: Upload debug artifacts
uses: actions/upload-artifact@v4
with:
name: cosmotop.debug
path: |
./build/cosmotop.com.dbg
./build/cosmotop.aarch64.elf
build_linux_plugin:
name: Build plugin Linux ${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up zig
uses: mlugg/setup-zig@v1
with:
version: ${{ env.zig_version }}
- name: Build plugin
shell: bash
run: |
export CC="${{ github.workspace }}/zigshim/zig cc -target ${{ matrix.arch }}-linux-musl"
export CXX="${{ github.workspace }}/zigshim/zig c++ -target ${{ matrix.arch }}-linux-musl"
cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }} ${{ matrix.arch == 'x86_64' && '-DRSMI_STATIC=ON' || '' }}
cmake --build build --parallel 4
cp build/cosmotop-plugin.exe ./cosmotop-linux-${{ matrix.arch }}.exe
- name: Upload plugin
uses: actions/upload-artifact@v4
with:
name: plugin-linux-${{ matrix.arch }}
path: ./cosmotop-linux-${{ matrix.arch }}.exe
build_macos_plugin:
name: Build plugin MacOS ${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- runner: macos-13
arch: x86_64
- runner: macos-14
arch: aarch64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build plugin
shell: bash
run: |
if [[ ${{ matrix.arch }} == "x86_64" ]]; then
cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }}
cmake --build build --parallel 4
cp build/cosmotop-plugin.exe ./cosmotop-macos-${{ matrix.arch }}.exe
else
cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }}
cmake --build build --parallel 4
cp build/libcosmotop-plugin.dylib ./cosmotop-macos-${{ matrix.arch }}.dylib
fi
- name: Upload plugin
uses: actions/upload-artifact@v4
with:
name: plugin-macos-${{ matrix.arch }}
path: ./cosmotop-macos-${{ matrix.arch }}.*
build_windows_plugin:
name: Build plugin Windows ${{ matrix.arch }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
arch: [x86_64]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build plugin
shell: bash
run: |
cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }}
cmake --build build --parallel 4 --config Release
cp build/Release/cosmotop-plugin.dll ./cosmotop-windows-${{ matrix.arch }}.dll
- name: Upload plugin
uses: actions/upload-artifact@v4
with:
name: plugin-windows-${{ matrix.arch }}
path: ./cosmotop-windows-${{ matrix.arch }}.dll
build_freebsd_plugin:
name: Build plugin FreeBSD ${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Start VM
uses: vmactions/freebsd-vm@v1
with:
sync: nfs
arch: ${{ matrix.arch }}
release: "13.3"
prepare: |
pkg install -y cmake
- name: Build plugin
shell: freebsd {0}
run: |
cd ${{ github.workspace }}
cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }}
cmake --build build --parallel 4
cp build/libcosmotop-plugin.so ./cosmotop-freebsd-${{ matrix.arch }}.so
- name: Upload plugin
uses: actions/upload-artifact@v4
with:
name: plugin-freebsd-${{ matrix.arch }}
path: ./cosmotop-freebsd-${{ matrix.arch }}.so
build_netbsd_plugin:
name: Build plugin NetBSD ${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [x86_64]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Start VM
uses: vmactions/netbsd-vm@v1
with:
sync: nfs
arch: ${{ matrix.arch }}
release: "10.0"
prepare: |
/usr/sbin/pkg_add cmake clang
- name: Build plugin
shell: netbsd {0}
run: |
cd ${{ github.workspace }}
CC=clang CXX=clang++ cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }}
cmake --build build --parallel 4
cp build/cosmotop-plugin.exe ./cosmotop-netbsd-${{ matrix.arch }}.exe
- name: Upload plugin
uses: actions/upload-artifact@v4
with:
name: plugin-netbsd-${{ matrix.arch }}
path: ./cosmotop-netbsd-${{ matrix.arch }}.exe
build_openbsd_plugin:
name: Build plugin OpenBSD ${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [x86_64]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Start VM
uses: vmactions/openbsd-vm@v1
with:
sync: nfs
arch: ${{ matrix.arch }}
release: "7.3"
prepare: |
pkg_add cmake
- name: Build plugin
shell: openbsd {0}
run: |
cd ${{ github.workspace }}
cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }}
cmake --build build --parallel 4
cp build/cosmotop-plugin.exe ./cosmotop-openbsd-${{ matrix.arch }}.exe
- name: Upload plugin
uses: actions/upload-artifact@v4
with:
name: plugin-openbsd-${{ matrix.arch }}
path: ./cosmotop-openbsd-${{ matrix.arch }}.exe
bundle:
name: Bundle plugins into cosmotop.exe
runs-on: ubuntu-latest
needs:
- build
- build_linux_plugin
- build_macos_plugin
- build_windows_plugin
- build_freebsd_plugin
- build_netbsd_plugin
- build_openbsd_plugin
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Load cosmocc version
run: |
version=$(cat .github/cosmocc_version.txt)
echo "cosmocc_version=${version}" >> "$GITHUB_ENV"
- name: Setup cosmocc
uses: bjia56/[email protected]
with:
version: ${{ env.cosmocc_version }}
- name: Set up zig
uses: mlugg/setup-zig@v1
with:
version: ${{ env.zig_version }}
- name: Download cosmotop.com
uses: actions/download-artifact@v4
with:
name: cosmotop.com
path: .
- name: Download plugins
uses: actions/download-artifact@v4
with:
pattern: plugin-*
path: /tmp/cosmotop-plugin/
merge-multiple: true
- name: Bundle
run: |
tree /tmp/cosmotop-plugin || true
sudo mkdir -p /zip/
sudo cp -r ${{ github.workspace }}/themes /zip/
sudo cp ${{ github.workspace }}/third_party/catppuccin/themes/* /zip/themes/
sudo cp /tmp/cosmotop-plugin/cosmotop-linux-x86_64.exe /zip/
sudo cp /tmp/cosmotop-plugin/cosmotop-linux-aarch64.exe /zip/
sudo cp /tmp/cosmotop-plugin/cosmotop-macos-x86_64.exe /zip/
sudo cp /tmp/cosmotop-plugin/cosmotop-macos-aarch64.dylib /zip/
sudo cp /tmp/cosmotop-plugin/cosmotop-windows-x86_64.dll /zip/
sudo cp /tmp/cosmotop-plugin/cosmotop-freebsd-x86_64.so /zip/
sudo cp /tmp/cosmotop-plugin/cosmotop-freebsd-aarch64.so /zip/
sudo cp /tmp/cosmotop-plugin/cosmotop-netbsd-x86_64.exe /zip/
sudo cp /tmp/cosmotop-plugin/cosmotop-openbsd-x86_64.exe /zip/
cd ${{ github.workspace }}
mkdir LHM
cd LHM
wget https://github.com/bjia56/LHM-CppExport/releases/download/v0.1.0/LHM-CppExport.zip
unzip LHM-CppExport.zip
sudo mkdir -p /zip/windows/
sudo cp *.dll /zip/windows/
sudo cp *.exe /zip/windows/
cd ${{ github.workspace }}
mkdir licenses
cd licenses
cp ${{ github.workspace }}/LICENSE cosmotop
curl -L -o LibreHardwareMonitor https://raw.githubusercontent.com/bjia56/LHM-CppExport/refs/tags/v0.1.0/LICENSE-LibreHardwareMonitor.txt
curl -L -o LHM-CppExport https://raw.githubusercontent.com/bjia56/LHM-CppExport/refs/tags/v0.1.0/LICENSE.txt
curl -L -o HIDSharp https://raw.githubusercontent.com/IntergatedCircuits/HidSharp/refs/tags/2.1.0/License.txt
cp ${{ github.workspace }}//third_party/catppuccin/LICENSE "Catppuccin themes"
cp ${{ github.workspace }}/third_party/range-v3/LICENSE.txt range-v3
cp ${{ github.workspace }}/third_party/fmt/LICENSE fmt
cp ${{ github.workspace }}/third_party/libcosmo_plugin/LICENSE libcosmo_plugin
cp ${{ github.workspace }}/third_party/libcosmo_plugin/third_party/reflect-cpp/LICENSE reflect-cpp
curl -L -o yyjson https://raw.githubusercontent.com/ibireme/yyjson/refs/tags/0.10.0/LICENSE
curl -L -o compile-time-regular-expressions https://raw.githubusercontent.com/hanickadot/compile-time-regular-expressions/068c6269caa0600021bbe93ca784bb819f3a8273/LICENSE
cp ${{ github.workspace }}/third_party/cpp-httplib/LICENSE cpp-httplib
cp ${{ github.workspace }}/third_party/widecharwidth/LICENSE widecharwidth
cp ${{ github.workspace }}/third_party/rocm_smi_lib/License.txt "ROCm SMI"
cp ${{ github.workspace }}/third_party/rocm_smi_lib/third_party/shared_mutex/LICENSE shared_mutex
curl -L -o igt-gpu-tools https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/raw/0f02dc176959e6296866b1bafd3982e277a5e44b/COPYING
cp $(dirname $(dirname $(which cosmocc)))/LICENSE "Cosmopolitan Libc"
cp $(dirname $(which zig))/LICENSE "Zig Programming Language"
cp $(dirname $(which zig))/lib/libc/musl/COPYRIGHT "musl libc"
cp $(dirname $(which zig))/lib/libcxx/LICENSE.TXT "LLVM Project"
sudo mkdir -p /zip/licenses/
sudo cp * /zip/licenses/
cd /zip
zip -r ${{ github.workspace }}/cosmotop.com *
cd ${{ github.workspace }}
mv cosmotop.com cosmotop.exe
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: cosmotop.exe
path: ./cosmotop.exe
- name: Interactive debugging
uses: fawazahmed0/action-debug-vscode@v3
if: ${{ always() && inputs.debug_link }}
check:
name: Check cosmotop.exe ${{ matrix.os }} ${{ matrix.arch }}
needs: bundle
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- runner: macos-13
arch: x86_64
os: MacOS
- runner: macos-14
arch: arm64
os: MacOS
- runner: ubuntu-latest
arch: x86_64
os: Linux
- runner: ubuntu-24.04-arm
arch: aarch64
os: Linux
- runner: windows-latest
arch: x86_64
os: Windows
- runner: ubuntu-latest
arch: x86_64
os: FreeBSD
- runner: ubuntu-latest
arch: aarch64
os: FreeBSD
- runner: ubuntu-latest
arch: x86_64
os: NetBSD
- runner: ubuntu-latest
arch: x86_64
os: OpenBSD
steps:
- name: Set up cosmocc
if: ${{ matrix.os == 'Linux' }}
uses: bjia56/[email protected]
- name: Checkout
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: cosmotop.exe
path: .
- name: Mark executable
shell: bash
run: |
chmod +x cosmotop.exe
- name: Configure Windows
if: ${{ matrix.os == 'Windows' }}
shell: powershell
run: |
Remove-MpPreference -ExclusionPath (Get-MpPreference).ExclusionPath
Set-Service -Name wuauserv -StartupType Manual -Status Running
- name: Scan with Windows Defender
if: ${{ matrix.os == 'Windows' }}
shell: cmd
run: |
copy cosmotop.exe C:
"C:\Program Files\Windows Defender\MpCmdRun.exe" -SignatureUpdate
"C:\Program Files\Windows Defender\MpCmdRun.exe" -Scan -ScanType 3 -File C:\cosmotop.exe
- name: Check cosmotop.exe
if: ${{ !contains(matrix.os, 'BSD') }}
shell: bash
run: |
./cosmotop.exe --version
- name: Start VM
if: ${{ matrix.os == 'FreeBSD' }}
uses: vmactions/freebsd-vm@v1
with:
sync: nfs
arch: ${{ matrix.arch }}
- name: Start VM
if: ${{ matrix.os == 'NetBSD' }}
uses: vmactions/netbsd-vm@v1
with:
sync: nfs
- name: Start VM
if: ${{ matrix.os == 'OpenBSD' }}
uses: vmactions/openbsd-vm@v1
with:
sync: nfs
release: 7.3
- name: Check cosmotop.exe
if: ${{ matrix.os == 'FreeBSD' }}
shell: freebsd {0}
run: |
cd ${{ github.workspace }}
./cosmotop.exe --version
- name: Check cosmotop.exe
if: ${{ matrix.os == 'NetBSD' }}
shell: netbsd {0}
run: |
cd ${{ github.workspace }}
./cosmotop.exe --version
- name: Check cosmotop.exe
if: ${{ matrix.os == 'OpenBSD' }}
shell: openbsd {0}
run: |
cd ${{ github.workspace }}
./cosmotop.exe --version