Enhance GitHub Actions workflow for cross-platform executable testing
- Added separate steps for testing executable functionality on Windows, macOS, and Linux, improving clarity and organization. - Streamlined the executable path determination for Windows and implemented similar logic for macOS and Linux. - Enhanced error handling and output messages for better debugging during the testing process.
This commit is contained in:
101
.github/workflows/release.yml
vendored
101
.github/workflows/release.yml
vendored
@@ -448,8 +448,9 @@ jobs:
|
||||
Write-Host "✓ Visual Studio build validation PASSED" -ForegroundColor Green
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
|
||||
# Test executable functionality (all platforms)
|
||||
- name: Test executable functionality
|
||||
# Test executable functionality (Windows)
|
||||
- name: Test executable functionality (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
@@ -462,14 +463,8 @@ jobs:
|
||||
Write-Host "build directory does not exist" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Determine executable path based on platform
|
||||
if ("${{ runner.os }}" -eq "Windows") {
|
||||
$exePath = "build\bin\${{ env.BUILD_TYPE }}\yaze.exe"
|
||||
} elseif ("${{ runner.os }}" -eq "macOS") {
|
||||
$exePath = "build/bin/yaze.app/Contents/MacOS/yaze"
|
||||
} else {
|
||||
$exePath = "build/bin/yaze"
|
||||
}
|
||||
# Determine executable path for Windows
|
||||
$exePath = "build\bin\${{ env.BUILD_TYPE }}\yaze.exe"
|
||||
|
||||
if (Test-Path $exePath) {
|
||||
Write-Host "✓ Executable found: $exePath" -ForegroundColor Green
|
||||
@@ -494,10 +489,94 @@ jobs:
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Test executable functionality (macOS)
|
||||
- name: Test executable functionality (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
shell: bash
|
||||
run: |
|
||||
set -e
|
||||
|
||||
echo "Build directory contents:"
|
||||
if [ -d "build" ]; then
|
||||
find build -name "*.app" -o -name "yaze" | head -10
|
||||
else
|
||||
echo "build directory does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Determine executable path for macOS
|
||||
exePath="build/bin/yaze.app/Contents/MacOS/yaze"
|
||||
|
||||
if [ -f "$exePath" ]; then
|
||||
echo "✓ Executable found: $exePath"
|
||||
|
||||
# Test that it's not the test main
|
||||
testResult=$($exePath --help 2>&1 || true)
|
||||
exitCode=$?
|
||||
|
||||
if echo "$testResult" | grep -q "Google Test\|gtest"; then
|
||||
echo "ERROR: Executable is running test main instead of app main!"
|
||||
echo "Output: $testResult"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✓ Executable runs correctly (exit code: $exitCode)"
|
||||
|
||||
# Display file info
|
||||
fileSize=$(stat -f%z "$exePath")
|
||||
fileSizeMB=$(echo "scale=2; $fileSize / 1024 / 1024" | bc -l)
|
||||
echo "Executable size: ${fileSizeMB} MB"
|
||||
else
|
||||
echo "ERROR: Executable not found at: $exePath"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test executable functionality (Linux)
|
||||
- name: Test executable functionality (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
set -e
|
||||
|
||||
echo "Build directory contents:"
|
||||
if [ -d "build" ]; then
|
||||
find build -type f -name "yaze" | head -10
|
||||
else
|
||||
echo "build directory does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Determine executable path for Linux
|
||||
exePath="build/bin/yaze"
|
||||
|
||||
if [ -f "$exePath" ]; then
|
||||
echo "✓ Executable found: $exePath"
|
||||
|
||||
# Test that it's not the test main
|
||||
testResult=$($exePath --help 2>&1 || true)
|
||||
exitCode=$?
|
||||
|
||||
if echo "$testResult" | grep -q "Google Test\|gtest"; then
|
||||
echo "ERROR: Executable is running test main instead of app main!"
|
||||
echo "Output: $testResult"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✓ Executable runs correctly (exit code: $exitCode)"
|
||||
|
||||
# Display file info
|
||||
fileSize=$(stat -c%s "$exePath")
|
||||
fileSizeMB=$(echo "scale=2; $fileSize / 1024 / 1024" | bc -l)
|
||||
echo "Executable size: ${fileSizeMB} MB"
|
||||
else
|
||||
echo "ERROR: Executable not found at: $exePath"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Package
|
||||
- name: Package
|
||||
shell: ${{ runner.os == 'Windows' && 'cmd' || 'bash' }}
|
||||
run: ${{ matrix.package_cmd }}
|
||||
shell: bash
|
||||
|
||||
# Create release with artifacts (will create release if it doesn't exist)
|
||||
- name: Upload to Release
|
||||
|
||||
Reference in New Issue
Block a user