Skip to content

Commit

Permalink
Remove .NET 8 + cygwin installation step for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nahkd123 committed Apr 18, 2024
1 parent 3325029 commit 129c0e5
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 10 deletions.
18 changes: 8 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8
dotnet-quality: ga
- uses: egor-tensin/setup-cygwin@v4
with:
packages: make perl-Digest-SHA
- name: Build NativeAOT with GNU Make (Windows x64, Windows arm64)
shell: bash
run: make -j win-x64 win-arm64
# Windows comes with .NET 8 by default
# - uses: actions/setup-dotnet@v4
# with:
# dotnet-version: 8
# dotnet-quality: ga
- name: Build NativeAOT with PowerShell Core/pwsh (Windows x64, Windows arm64)
shell: pwsh
run: .\windows-build.ps1
working-directory: inking-otd
- uses: actions/upload-artifact@v4
with:
Expand Down
60 changes: 60 additions & 0 deletions inking-otd/windows-build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash pwsh
# Write-Output (Get-FileHash LICENSE -Algorithm SHA1).Hash

$SLN = "$PSScriptRoot\Inking.Otd"
$CSPROJ = "$SLN\Inking.Otd.csproj"
$DOTNET_VERSION = "net8.0"
$DOTNET_CONFIGURATION = "Release"
$LIBNAME = "Inking.Otd.dll"

$OUTPUTROOT = "$PSScriptRoot\src\main\resources\natives"

function buildTarget($target) {
Write-Output "Building Inking OTD bridge for $target..."
$sourceFile = "$SLN\bin\$DOTNET_CONFIGURATION\$DOTNET_VERSION\$target\native\Inking.Otd.dll"
$outputFile = "$OUTPUTROOT\$target\Inking.Otd.dll"
$outputHash = "$outputFile.sha1"

Write-Output " Source File = $sourceFile"
Write-Output " Output File = $outputFile"
Write-Output " Hash File = $outputHash"

if (-Not (Test-Path $outputFile -PathType Leaf)) {
Write-Output "Building $outputFile..."
dotnet publish -r $target -c $DOTNET_CONFIGURATION $CSPROJ

if (-Not ($?)) {
Write-Error "Failed to build for $target"
return
}

if (Test-Path $outputFile -PathType Leaf) { Remove-Item -Path $outputFile }
Copy-Item -Path $sourceFile -Destination $outputFile

if (Test-Path $outputHash -PathType Leaf) { Remove-Item -Path $outputHash }
New-Item -Path $outputHash -Value (Get-FileHash $outputFile -Algorithm SHA1).Hash
} else {
Write-Warning "Ignoring $outputFile because it is already exists"
}
}

Write-Output "Solution Root is $SLN"
Write-Output "C# Project File is $CSPROJ"

if ($args.Count -Eq 0) {
Write-Output "No targets."
}

if ($args.Count -Eq 1) {
buildTarget($args[0]);
}

if ($args.Count -Gt 1) {
if ($PSEdition -Eq "Core") { $pwshExe = "$PSHOME\pwsh.exe" }
else { $pwshExe = "$PSHOME\powershell.exe" }
Write-Output "Building in parallel..."

foreach ($target in $args) {
& $pwshExe $MyInvocation.InvocationName $target
}
}

0 comments on commit 129c0e5

Please sign in to comment.