mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-19 21:02:41 +00:00
Merge pull request #19 from Valorith/copilot/sub-pr-17-again
Add validation to release workflow packaging steps
This commit is contained in:
commit
f0117b2d65
85
.github/workflows/release.yaml
vendored
85
.github/workflows/release.yaml
vendored
@ -44,15 +44,50 @@ jobs:
|
|||||||
- name: Package binaries
|
- name: Package binaries
|
||||||
run: |
|
run: |
|
||||||
cd build/bin
|
cd build/bin
|
||||||
|
|
||||||
|
# Verify that critical binaries exist
|
||||||
|
REQUIRED_BINARIES=(world zone ucs queryserv eqlaunch shared_memory loginserver import_client_files export_client_files)
|
||||||
|
MISSING_BINARIES=()
|
||||||
|
|
||||||
|
for binary in "${REQUIRED_BINARIES[@]}"; do
|
||||||
|
if [ ! -f "$binary" ]; then
|
||||||
|
MISSING_BINARIES+=("$binary")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${#MISSING_BINARIES[@]} -ne 0 ]; then
|
||||||
|
echo "Error: Required binaries not found: ${MISSING_BINARIES[*]}"
|
||||||
|
echo "Build may have failed. Refusing to create incomplete package."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create zip with core binaries
|
||||||
zip -j eqemu-server-linux-x64.zip \
|
zip -j eqemu-server-linux-x64.zip \
|
||||||
world zone ucs queryserv eqlaunch shared_memory \
|
world zone ucs queryserv eqlaunch shared_memory \
|
||||||
loginserver import_client_files export_client_files
|
loginserver import_client_files export_client_files
|
||||||
|
|
||||||
# Include any additional binaries that exist
|
# Include any additional binaries that exist
|
||||||
for f in *; do
|
for f in *; do
|
||||||
if [ -f "$f" ] && [ -x "$f" ] && [ "$f" != "tests" ]; then
|
if [ -f "$f" ] && [ -x "$f" ] && [ "$f" != "tests" ]; then
|
||||||
zip -u eqemu-server-linux-x64.zip "$f"
|
zip -u eqemu-server-linux-x64.zip "$f"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Verify zip file was created and contains files
|
||||||
|
if [ ! -f eqemu-server-linux-x64.zip ]; then
|
||||||
|
echo "Error: Failed to create zip file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
FILE_COUNT=$(unzip -Z1 eqemu-server-linux-x64.zip | wc -l)
|
||||||
|
EXPECTED_MIN_FILES=${#REQUIRED_BINARIES[@]}
|
||||||
|
if [ "$FILE_COUNT" -lt "$EXPECTED_MIN_FILES" ]; then
|
||||||
|
echo "Error: Zip file contains fewer than expected files ($FILE_COUNT, expected at least $EXPECTED_MIN_FILES)"
|
||||||
|
unzip -l eqemu-server-linux-x64.zip
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Successfully packaged $FILE_COUNT files"
|
||||||
ls -la eqemu-server-linux-x64.zip
|
ls -la eqemu-server-linux-x64.zip
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
@ -99,6 +134,25 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
$binDir = "build/bin/RelWithDebInfo"
|
$binDir = "build/bin/RelWithDebInfo"
|
||||||
$outZip = "eqemu-server-windows-x64.zip"
|
$outZip = "eqemu-server-windows-x64.zip"
|
||||||
|
# Minimum expected zip size (core binaries should be at least this size)
|
||||||
|
$minZipSize = 100KB
|
||||||
|
|
||||||
|
# Verify that critical binaries exist
|
||||||
|
$requiredBinaries = @("world.exe", "zone.exe", "ucs.exe", "queryserv.exe", "eqlaunch.exe", "shared_memory.exe")
|
||||||
|
$missingBinaries = @()
|
||||||
|
|
||||||
|
foreach ($binary in $requiredBinaries) {
|
||||||
|
$path = Join-Path $binDir $binary
|
||||||
|
if (-not (Test-Path $path)) {
|
||||||
|
$missingBinaries += $binary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($missingBinaries.Count -gt 0) {
|
||||||
|
Write-Host "Error: Required binaries not found: $($missingBinaries -join ', ')"
|
||||||
|
Write-Host "Build may have failed. Refusing to create incomplete package."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# Collect all exe and dll files
|
# Collect all exe and dll files
|
||||||
$files = @()
|
$files = @()
|
||||||
@ -121,12 +175,41 @@ jobs:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Verify we have files to package
|
||||||
|
if ($files.Count -eq 0) {
|
||||||
|
Write-Host "Error: No files found to package"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# Create zip
|
# Create zip
|
||||||
Compress-Archive -Path $files -DestinationPath $outZip -Force
|
Compress-Archive -Path $files -DestinationPath $outZip -Force
|
||||||
|
|
||||||
|
# Verify zip was created successfully
|
||||||
|
if (-not (Test-Path $outZip)) {
|
||||||
|
Write-Host "Error: Failed to create zip file"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Verify zip contains files (should contain at least the core binaries)
|
||||||
|
$zipInfo = Get-Item $outZip
|
||||||
|
if ($zipInfo.Length -lt $minZipSize) {
|
||||||
|
Write-Host "Error: Zip file is suspiciously small ($($zipInfo.Length) bytes, expected at least $minZipSize)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# Show contents
|
# Show contents
|
||||||
|
Write-Host "Successfully packaged $($files.Count) files"
|
||||||
Write-Host "Package contents:"
|
Write-Host "Package contents:"
|
||||||
Get-ChildItem $outZip | Format-List
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||||
|
$zip = [System.IO.Compression.ZipFile]::OpenRead($outZip)
|
||||||
|
try {
|
||||||
|
foreach ($entry in $zip.Entries) {
|
||||||
|
Write-Host (" - {0} ({1} bytes)" -f $entry.FullName, $entry.Length)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
$zip.Dispose()
|
||||||
|
}
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user