-
Notifications
You must be signed in to change notification settings - Fork 17
576 lines (546 loc) · 16 KB
/
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
name: CI
on:
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build_asm:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Build
shell: cmd
run: |
cd asm
call "%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
ml64
ml64 hello.asm /link /entry:main kernel32.lib
(
echo LANGUAGE=Assembly
echo COMPILER=Microsoft Macro Assembler Version 14.35.32217.1
)>info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: asm
path: |
asm/hello.exe
asm/info.txt
build_c:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Build
shell: cmd
run: |
cd c
call "%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
# By default the generated binary will depend on VCRuntime140.dll that is
# not part of a clean OS install. Pass /MT
cl
cl /MT /Os hello.c
(
echo LANGUAGE=C
echo COMPILER=Microsoft C/C++ Optimizing Compiler Version 19.35.32217.1 for x64
)>info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: c
path: |
c/hello.exe
c/info.txt
build_cpp:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Build
shell: cmd
run: |
cd cpp
call "%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
# By default the generated binary will depend on VCRuntime140.dll that is
# not part of a clean OS install. Pass /MT
# Generates a warning if /EHsc is not passed. So pass it.
cl
cl /MT /Os /EHsc hello.cpp
(
echo LANGUAGE=C++
echo COMPILER=Microsoft C/C++ Optimizing Compiler Version 19.35.32217.1 for x64
)>info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: cpp
path: |
cpp/hello.exe
cpp/info.txt
build_crystal:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
- name: Build
shell: cmd
run: |
cd crystal
crystal -v
crystal build hello.cr --release
(
echo LANGUAGE=Crystal
echo COMPILER=Crystal 1.9.2 [1908c81] ^(2023-07-19^)
)>info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: crystal
path: |
crystal/hello.exe
crystal/info.txt
build_csharp:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100-preview.6.23330.14'
- name: Build
shell: cmd
run: |
cd csharp
dotnet --info
dotnet publish /p:OptimizationPreference=Size
(
echo LANGUAGE=C#
echo COMPILER=8.0.100-preview.6.23330.14
)>bin\Release\net8.0\win-x64\publish\info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: csharp
path: |
csharp/bin/Release/net8.0/win-x64/publish/hello.exe
csharp/bin/Release/net8.0/win-x64/publish/info.txt
build_d:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: dlang-community/setup-dlang@v1
with:
compiler: dmd-latest
- name: Build
shell: cmd
run: |
cd d
dmd -release -O hello.d
dmd --version
(
echo LANGUAGE=D
echo COMPILER=DMD64 D Compiler v2.104.2-dirty
)>info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: d
path: |
d/hello.exe
d/info.txt
build_dart:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- name: Build
shell: cmd
run: |
cd dart
dart compile exe hello.dart
dart --version
(
echo LANGUAGE=Dart
echo COMPILER=Dart SDK version: 3.0.6 ^(stable^) ^(Tue Jul 11 18:49:07 2023 +0000^) on "windows_x64"
)>info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: dart
path: |
dart/hello.exe
dart/info.txt
build_fortran:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: awvwgk/setup-fortran@5f9d8c3596acd2823e8d39500314a8f0e5568033
with:
compiler: intel
version: '2023.2.0'
- name: Build
shell: pwsh
run: |
cd fortran
gfortran -o hello.exe hello.f90
gfortran --version
$info = @(
"LANGUAGE=Fortran"
"COMPILER=fortran 2023.2.0"
)
$info | Out-File -FilePath info.txt -Encoding ascii
- name: Upload
uses: actions/upload-artifact@v3
with:
name: fortran
path: |
fortran/hello.exe
fortran/info.txt
build_fsharp:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100-preview.6.23330.14'
- name: Build
shell: cmd
run: |
cd fsharp
dotnet --info
dotnet publish -p:PublishAot=true -p:OptimizationPreference=Size
(
echo LANGUAGE=F#
echo COMPILER=8.0.100-preview.6.23330.14
)>bin\Release\net8.0\win-x64\publish\info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: fsharp
path: |
fsharp/bin/Release/net8.0/win-x64/publish/hello.exe
fsharp/bin/Release/net8.0/win-x64/publish/info.txt
build_go:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 'stable'
- name: Build
shell: cmd
run: |
cd go
go build hello.go
go version
(
echo LANGUAGE=Go
echo COMPILER=go version go1.20.6 windows/amd64
)>info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: go
path: |
go/hello.exe
go/info.txt
build_haskell:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: haskell/actions/setup@v2
- name: Build
shell: pwsh
run: |
cd haskell
ghc --version
ghc -O hello.hs
$info = @(
"LANGUAGE=Haskell"
"COMPILER=$(ghc --version)"
)
$info | Out-File -FilePath info.txt -Encoding ascii
- name: Upload
uses: actions/upload-artifact@v3
with:
name: haskell
path: |
haskell/hello.exe
haskell/info.txt
build_java:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
shell: cmd
run: |
cd java
javac Hello.java
# By default the generated binary will depend on VCRuntime140.dll that is
# not part of a clean OS install. Pass --static to show I tried,
# but it doesn't seem to work.
call native-image --static Hello
# for /r "%PROGRAMFILES%\Microsoft Visual Studio" %%a in (*) do if "%%~nxa"=="vcruntime140.dll" echo %%~dpnxa
copy "%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.34.31931\x64\Microsoft.VC143.CRT\vcruntime140.dll" .
call native-image --version
(
echo LANGUAGE=Java
echo COMPILER=native-image 17.0.8 2023-07-18
echo NOTES=Includes vcruntime140.dll
)>info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: java
path: |
java/hello.exe
java/vcruntime140.dll
java/info.txt
build_kotlin:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: fwilhe2/setup-kotlin@main
- uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
shell: cmd
run: |
cd kotlin
call kotlinc hello.kt -include-runtime -d hello.jar
call kotlinc -version
(
echo LANGUAGE=Kotlin
echo COMPILER=kotlinc-jvm 1.8.10
echo NOTES=Includes vcrtuntime140.dll, AOT compiled with GraalVM, same version as the Java benchmark
)>info.txt
# By default the generated binary will depend on VCRuntime140.dll that is
# not part of a clean OS install. Pass --static to show I tried,
# but it doesn't seem to work.
call native-image --static -jar hello.jar --no-fallback
# for /r "%PROGRAMFILES%\Microsoft Visual Studio" %%a in (*) do if "%%~nxa"=="vcruntime140.dll" echo %%~dpnxa
copy "%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.34.31931\x64\Microsoft.VC143.CRT\vcruntime140.dll" .
- name: Upload
uses: actions/upload-artifact@v3
with:
name: kotlin
path: |
kotlin/hello.exe
kotlin/vcruntime140.dll
kotlin/info.txt
build_nim:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: jiro4989/setup-nim-action@v1
- name: Build
shell: cmd
run: |
cd nim
nim c -d:release --opt:size hello.nim
nim --version
(
echo LANGUAGE=Nim
echo COMPILER=Nim Compiler Version 1.6.14 [Windows: amd64]
)>info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: nim
path: |
nim/hello.exe
nim/info.txt
build_rust:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Build
shell: cmd
run: |
cd rust
# By default the generated binary will depend on VCRuntime140.dll that is
# not part of a clean OS install. Pass +crt-static.
rustc -C opt-level=2 -C target-feature=+crt-static hello.rs
rustc --version
(
echo LANGUAGE=Rust
echo COMPILER=rustc 1.71.0 ^(8ede3aae2 2023-07-12^)
)>info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: rust
path: |
rust/hello.exe
rust/info.txt
build_scala:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: olafurpg/setup-scala@v14
with:
java-version: adopt@
- name: Build
shell: cmd
run: |
cd scala
call sbt run
call sbt --version
(
echo LANGUAGE=Scala
echo COMPILER=Scala 3.2.2 Scala-native 0.4.10
)>target\scala-3.2.2\info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: scala
path: |
scala/target/scala-3.2.2/scala-out.exe
scala/target/scala-3.2.2/info.txt
build_swift:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install Swift
shell: cmd
run: |
curl -L -O https://download.swift.org/swift-5.8.1-release/windows10/swift-5.8.1-RELEASE/swift-5.8.1-RELEASE-windows10.exe
start /wait swift-5.8.1-RELEASE-windows10.exe /quiet
- name: Build
shell: cmd
run: |
call refreshenv
cd swift
# Attempt to do a static executable. As of Swift 5.7.3, this doesn't seem to actually work.
swiftc -Osize -static-executable hello.swift
# for /r "%PROGRAMFILES%\Microsoft Visual Studio" %%a in (*) do if "%%~nxa"=="vcruntime140.dll" echo %%~dpnxa
copy "%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.34.31931\x64\Microsoft.VC143.CRT\vcruntime140.dll" .
copy "%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.34.31931\x64\Microsoft.VC143.CRT\vcruntime140_1.dll" .
copy "%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.34.31931\x64\Microsoft.VC143.CRT\msvcp140.dll" .
copy "%PROGRAMFILES%\swift\runtime-development\usr\bin\swiftCore.dll" .
swiftc -version
(
echo LANGUAGE=Swift
echo COMPILER=compnerd.org Swift version 5.8.1 ^(swift-5.8.1-RELEASE^)
echo NOTES=Includes: swiftCore.dll, vcruntime140.dll, vcruntime140_1.dll, msvcp140.dll
)>info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: swift
path: |
swift/hello.exe
swift/vcruntime140.dll
swift/vcruntime140_1.dll
swift/msvcp140.dll
swift/swiftCore.dll
swift/info.txt
build_v:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install V
uses: vlang/setup-v@v1
with:
check-latest: true
- name: Build
shell: pwsh
run: |
cd v
v -prod ./hello.v
v --version
$info = @(
"LANGUAGE=V"
"COMPILER=$(v --version)"
)
$info | Out-File -FilePath info.txt -Encoding ascii
- name: Upload
uses: actions/upload-artifact@v3
with:
name: v
path: |
v/hello.exe
v/info.txt
build_zig:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: goto-bus-stop/setup-zig@v2
- name: Build
shell: cmd
run: |
cd zig
zig build-exe hello.zig -O ReleaseSmall
zig version
(
echo LANGUAGE=Zig
echo COMPILER=0.11.0-dev.4191+1bf16b172
)>info.txt
- name: Upload
uses: actions/upload-artifact@v3
with:
name: zig
path: |
zig/hello.exe
zig/info.txt
summarize:
needs: [build_asm, build_c, build_cpp, build_crystal, build_csharp, build_d, build_dart, build_fortran, build_fsharp, build_go, build_haskell, build_java, build_kotlin, build_nim, build_rust, build_scala, build_swift, build_v, build_zig]
runs-on: windows-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Summarize
shell: cmd
run: |
(
echo Language ^| Size ^(kB^) ^| Compiler ^| Notes
echo -------- ^| ---- ^| -------- ^| -----
)>report.md
FOR /D %%d IN (*) DO (
call :Handle %%d
)
echo *** PLOT DATA ***
type plotdata.txt
echo *** REPORT ***
type report.md
(
echo set term png size 1200, 675
echo set output "report.png"
echo set boxwidth 0.5
echo set style fill solid
echo set title "Size of canonical Hello World"
echo set key off
echo set ylabel "Size ^(kB^)"
echo plot "plotdata.txt" using 2:xtic^(1^) with boxes
)>plotcommands.txt
echo *** COMMANDS ***
type plotcommands.txt
choco install gnuplot
call refreshenv
gnuplot plotcommands.txt
goto :EOF
:Handle
set size=0
for %%f IN (%1\*.exe %1\*.dll) DO (
set /A size=size + %%~zf
)
set /A size=size / 1024
set NOTES=
for /f "delims== tokens=1,2" %%G in (%1\info.txt) do set %%G=%%H
echo %LANGUAGE% %size% >> plotdata.txt
echo %LANGUAGE% ^| %size% ^| %COMPILER% ^| %NOTES% >> report.md
- name: Upload
uses: actions/upload-artifact@v3
with:
name: report
path: |
report.png
report.md