feat: Enhance Windows build and release workflows with packaging and validation for CUDA runtime libraries
Some checks failed
Build Windows Avalonia / build (push) Failing after 2m26s
Some checks failed
Build Windows Avalonia / build (push) Failing after 2m26s
This commit is contained in:
parent
72864bf602
commit
a883daf068
4 changed files with 107 additions and 20 deletions
|
|
@ -85,16 +85,28 @@ build_windows:
|
|||
}
|
||||
& $dotnetExe restore
|
||||
& $dotnetExe build "imagecatalog\ImageCatalog 2.csproj" -c $env:BUILD_CONFIG -v minimal
|
||||
# Produce a single-file, ready-to-run publish so downstream jobs only need the EXE.
|
||||
# Publish a single-file executable with the CUDA/OpenCV runtime libraries alongside it.
|
||||
try {
|
||||
& $dotnetExe publish "imagecatalog\ImageCatalog 2.csproj" -c $env:BUILD_CONFIG -r win-x64 --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=false -p:PublishReadyToRun=true -o "imagecatalog\bin\$env:BUILD_CONFIG\net10.0-windows\publish" -v minimal
|
||||
$publishDir = "imagecatalog\bin\$env:BUILD_CONFIG\net10.0-windows\publish"
|
||||
$legacyRendererFiles = Get-ChildItem $publishDir -File | Where-Object { $_.Name -in @('Microsoft.Windows.Compatibility.dll', 'System.Private.Windows.GdiPlus.dll') }
|
||||
$archivePath = Join-Path (Split-Path $publishDir -Parent) 'ImageCatalog-avalonia-win-x64.zip'
|
||||
$publishDirAbsolute = [System.IO.Path]::GetFullPath($publishDir)
|
||||
$archivePathAbsolute = [System.IO.Path]::GetFullPath($archivePath)
|
||||
if (Test-Path $publishDirAbsolute) {
|
||||
Remove-Item -LiteralPath $publishDirAbsolute -Recurse -Force
|
||||
}
|
||||
if (Test-Path $archivePathAbsolute) {
|
||||
Remove-Item -LiteralPath $archivePathAbsolute -Force
|
||||
}
|
||||
& $dotnetExe publish "imagecatalog\ImageCatalog 2.csproj" -c $env:BUILD_CONFIG -r win-x64 --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=false -p:PublishReadyToRun=true -o $publishDirAbsolute -v minimal
|
||||
if ($LASTEXITCODE -ne 0) { throw 'dotnet publish failed' }
|
||||
$legacyRendererFiles = Get-ChildItem $publishDirAbsolute -File | Where-Object { $_.Name -in @('Microsoft.Windows.Compatibility.dll', 'System.Private.Windows.GdiPlus.dll') }
|
||||
if ($legacyRendererFiles) {
|
||||
Write-Host 'Legacy GDI compatibility assemblies must not be published:'
|
||||
$legacyRendererFiles | ForEach-Object { Write-Host $_.FullName }
|
||||
exit 1
|
||||
}
|
||||
& $dotnetExe msbuild "imagecatalog\ImageCatalog 2.csproj" -target:PackageWindowsCatalogOutput "-p:PublishDir=$publishDirAbsolute" "-p:PublishArchivePath=$archivePathAbsolute"
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Failed to package the Windows Catalog output' }
|
||||
} catch {
|
||||
Write-Host "dotnet publish failed: $_"
|
||||
throw
|
||||
|
|
@ -102,7 +114,7 @@ build_windows:
|
|||
}
|
||||
artifacts:
|
||||
paths:
|
||||
- "imagecatalog/bin/$BUILD_CONFIG/net10.0-windows/publish/**"
|
||||
- "imagecatalog/bin/$BUILD_CONFIG/net10.0-windows/ImageCatalog-avalonia-win-x64.zip"
|
||||
expire_in: 1 hour
|
||||
|
||||
# Publish and create GitLab Release when building a tag.
|
||||
|
|
@ -128,17 +140,16 @@ publish_release:
|
|||
if [ -z "$version" ]; then echo "minver failed to produce a version"; exit 1; fi
|
||||
echo "Using version: $version"
|
||||
export VERSION="$version"
|
||||
# find the single-file exe from the publish output
|
||||
file=$(find imagecatalog/bin -type f -iname '*.exe' -print | head -n1 || true)
|
||||
if [ -z "$file" ]; then file=$(find imagecatalog -type f -iname '*.exe' -print | head -n1 || true); fi
|
||||
if [ -z "$file" ]; then echo "No artifact EXE found to attach"; exit 1; fi
|
||||
echo "Uploading artifact: $file"
|
||||
uploadResp=$(curl --silent --show-error --header "JOB-TOKEN:$CI_JOB_TOKEN" --form "file=@$file" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/uploads")
|
||||
# Attach the complete distributable ZIP, including native OpenCV/CUDA dependencies.
|
||||
file=$(find imagecatalog/bin -type f -name 'ImageCatalog-avalonia-win-x64.zip' -print | head -n1 || true)
|
||||
if [ -z "$file" ]; then echo "No Windows distributable ZIP found to attach"; exit 1; fi
|
||||
basename="ImageCatalog-avalonia-win-x64-${version}.zip"
|
||||
echo "Uploading artifact: $file as $basename"
|
||||
uploadResp=$(curl --silent --show-error --header "JOB-TOKEN:$CI_JOB_TOKEN" --form "file=@$file;filename=$basename" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/uploads")
|
||||
assetPath=$(echo "$uploadResp" | sed -n 's/.*"url":"\([^\"]*\)".*/\1/p')
|
||||
if [ -z "$assetPath" ]; then echo "Upload failed: $uploadResp"; exit 1; fi
|
||||
assetUrl="$CI_SERVER_URL$assetPath"
|
||||
echo "Uploaded asset url: $assetUrl"
|
||||
basename=$(basename "$file")
|
||||
export RELEASE_ASSET_URL="$assetUrl"
|
||||
export ASSET_BASENAME="$basename"
|
||||
artifacts:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue