Skip to content

feat: fortran

feat: fortran #60

Workflow file for this run

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