-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
1,264 additions
and
698 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Publish native AOT | ||
|
||
on: | ||
push: | ||
branches: [ native-aot ] | ||
# pull_request: | ||
# # Sequence of patterns matched against refs/heads | ||
# branches: | ||
# - master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
# temp fix frontend build | ||
# Treating warnings as errors because process.env.CI = true. | ||
# Most CI servers set it automatically. | ||
CI: 'false' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
global-json-file: global.json | ||
- uses: actions/setup-node@v4 | ||
with: | ||
# Version Spec of the version to use in SemVer notation. | ||
# It also emits such aliases as lts, latest, nightly and canary builds | ||
# Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node | ||
node-version: 20 | ||
- name: Publish AOT version | ||
shell: pwsh | ||
run: | | ||
./scripts/publish-native-aot.ps1 | ||
- name: 'Upload Artifact' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Heartbeat | ||
path: artifacts/linux-x64/Heartbeat | ||
retention-days: 1 | ||
|
||
# \artifacts\win-x64\Heartbeat.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
$ErrorActionPreference = "Stop" | ||
|
||
function Get-Runtime { | ||
if ($IsWindows) { | ||
return $env:PROCESSOR_ARCHITECTURE -eq 'AMD64' ? 'win-x64' : 'win-arm64' | ||
} | ||
|
||
if ($IsLinux) { | ||
return (uname -m) -eq 'aarch64' ? 'linux-arm64' : 'linux-x64' | ||
} | ||
|
||
if ($IsMacOS) { | ||
return (uname -m) -eq 'arm64' ? 'osx-arm64' : 'osx-x64' | ||
} | ||
} | ||
|
||
function Assert-ExitCode { | ||
if (-not $?) { | ||
throw 'Latest command failed' | ||
} | ||
} | ||
|
||
$Configuration = 'ReleaseAOT' | ||
$RepositoryRoot = Split-Path $PSScriptRoot | ||
$ArtifactsRoot = Join-Path $RepositoryRoot 'artifacts' | ||
|
||
Push-Location | ||
try { | ||
Set-Location $RepositoryRoot | ||
|
||
# [xml]$XmlConfig = Get-Content 'Directory.Build.props' | ||
|
||
# $XmlElement = Select-Xml '/Project/PropertyGroup/VersionPrefix' $XmlConfig | | ||
# Select-Object -ExpandProperty Node | ||
|
||
# $VersionPrefix = $XmlElement.InnerText | ||
# $VersionSuffix = "rc.$(Get-Date -Format 'yyyy-MM-dd-HHmm')" | ||
# $PackageVersion = "$VersionPrefix-$VersionSuffix" | ||
|
||
dotnet clean --configuration $Configuration | ||
|
||
# https://learn.microsoft.com/en-us/dotnet/core/rid-catalog | ||
# $Runtimes = @('win-x64', 'win-arm64', 'linux-x64', 'linux-arm64', 'osx-x64', 'osx-arm64') | ||
$Runtimes = @(Get-Runtime) | ||
# TODO check `uname -m` for linux and macos | ||
# $env:PROCESSOR_ARCHITECTURE | ||
foreach ($Runtime in $Runtimes) { | ||
$OutDir = Join-Path $ArtifactsRoot $Runtime | ||
Write-Host "Publish AOT version for $Runtime to $OutDir" | ||
dotnet publish --configuration $Configuration --runtime $Runtime --output $OutDir | ||
Assert-ExitCode | ||
|
||
Write-Host "Files in $OutDir" | ||
Get-ChildItem $OutDir | ||
} | ||
|
||
# TODO zip? | ||
} | ||
catch { | ||
Write-Host 'Publish AOT - FAILED!' -ForegroundColor Red | ||
throw | ||
} | ||
finally { | ||
Pop-Location | ||
} | ||
|
||
# TODO Cross-OS native compilation | ||
# C:\Users\Ne4to\.nuget\packages\microsoft.dotnet.ilcompiler\8.0.1\build\Microsoft.NETCore.Native.Windows.targets(123,5): error : Platform linker not found. Ensure you have all the required prerequisites documented at https://aka.ms/nativeaot-prerequisites, in particular the Desktop Development for C++ workload in Visual Studio. For ARM64 development also install C++ ARM64 build tools. [C:\Users\Ne4to\projects\github.com\Ne4to\Heartbeat\src\Heartbeat\Heartbeat.csproj] | ||
# C:\Users\Ne4to\.nuget\packages\microsoft.dotnet.ilcompiler\8.0.1\build\Microsoft.NETCore.Native.Publish.targets(60,5): error : Cross-OS native compilation is not supported. [C:\Users\Ne4to\projects\github.com\Ne4to\Heartbeat\src\Heartbeat\Heartbeat.csproj] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.