chore: add Linux build presets and CI configurations
- Introduced new CMake presets for Linux release and AI builds, enhancing cross-platform support. - Updated CI workflows to include Linux build configurations, ensuring consistent build processes across platforms. - Added a new release packaging script to streamline artifact creation for different operating systems. Benefits: - Improves build flexibility and reliability for Linux users. - Simplifies the release process by automating artifact packaging and checksum generation.
This commit is contained in:
110
.github/workflows/ci.yml
vendored
110
.github/workflows/ci.yml
vendored
@@ -54,18 +54,30 @@ jobs:
|
||||
os: ubuntu-22.04
|
||||
cc: gcc-12
|
||||
cxx: g++-12
|
||||
configure_preset: lin-ai
|
||||
build_preset: lin-ai
|
||||
binary_dir: build_ai_linux
|
||||
- name: "macOS 14 (Clang)"
|
||||
os: macos-14
|
||||
cc: clang
|
||||
cxx: clang++
|
||||
configure_preset: mac-ai
|
||||
build_preset: mac-ai
|
||||
binary_dir: build_ai
|
||||
- name: "Windows 2022 (Clang-CL)"
|
||||
os: windows-2022
|
||||
cc: clang-cl
|
||||
cxx: clang-cl
|
||||
configure_preset: win-ai
|
||||
build_preset: win-ai
|
||||
binary_dir: build
|
||||
- name: "Windows 2022 (MSVC)"
|
||||
os: windows-2022
|
||||
cc: cl
|
||||
cxx: cl
|
||||
configure_preset: win-ai
|
||||
build_preset: win-ai
|
||||
binary_dir: build
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -221,9 +233,9 @@ jobs:
|
||||
with:
|
||||
path: |
|
||||
build/_deps
|
||||
key: fetchcontent-${{ runner.os }}-${{ matrix.cc }}-${{ hashFiles('cmake/grpc*.cmake') }}-v3
|
||||
key: fetchcontent-${{ runner.os }}-${{ matrix.cc }}-${{ hashFiles('cmake/grpc*.cmake') }}-v4
|
||||
restore-keys: |
|
||||
fetchcontent-${{ runner.os }}-${{ matrix.cc }}-v3-
|
||||
fetchcontent-${{ runner.os }}-${{ matrix.cc }}-v4-
|
||||
|
||||
- name: Monitor build progress (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
@@ -255,16 +267,7 @@ jobs:
|
||||
run: |
|
||||
if [[ "${{ runner.os }}" == "Linux" ]]; then
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
build-essential ninja-build pkg-config ccache \
|
||||
libglew-dev libxext-dev libwavpack-dev libboost-all-dev \
|
||||
libpng-dev python3-dev libpython3-dev \
|
||||
libasound2-dev libpulse-dev libaudio-dev \
|
||||
libx11-dev libxrandr-dev libxcursor-dev libxinerama-dev libxi-dev \
|
||||
libxss-dev libxxf86vm-dev libxkbcommon-dev libwayland-dev libdecor-0-dev \
|
||||
libgtk-3-dev libdbus-1-dev \
|
||||
${{ matrix.cc }} ${{ matrix.cxx }}
|
||||
# Note: libabsl-dev removed - gRPC uses bundled Abseil via FetchContent when enabled
|
||||
xargs -a .github/workflows/scripts/linux-ci-packages.txt sudo apt-get install -y
|
||||
elif [[ "${{ runner.os }}" == "macOS" ]]; then
|
||||
brew install ninja pkg-config ccache
|
||||
fi
|
||||
@@ -358,27 +361,7 @@ jobs:
|
||||
ccache --zero-stats
|
||||
}
|
||||
|
||||
$toolchain = "${env:CMAKE_TOOLCHAIN_FILE}"
|
||||
if (-not $toolchain -or -not (Test-Path $toolchain)) {
|
||||
Write-Host "::error::CMAKE_TOOLCHAIN_FILE is missing or invalid: '$toolchain'"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$cmakeArgs = @(
|
||||
"-S", ".",
|
||||
"-B", "build",
|
||||
"-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}",
|
||||
"`"-DCMAKE_TOOLCHAIN_FILE=$toolchain`"",
|
||||
"-DVCPKG_TARGET_TRIPLET=x64-windows-static",
|
||||
"-DVCPKG_MANIFEST_MODE=ON",
|
||||
"-DYAZE_BUILD_TESTS=ON",
|
||||
"-DYAZE_BUILD_EMU=ON",
|
||||
"-DYAZE_BUILD_Z3ED=ON",
|
||||
"-DYAZE_BUILD_TOOLS=ON",
|
||||
"-DYAZE_ENABLE_ROM_TESTS=OFF"
|
||||
)
|
||||
|
||||
cmake @cmakeArgs 2>&1 | Tee-Object -FilePath cmake_config.log
|
||||
cmake --preset "${{ matrix.configure_preset }}" 2>&1 | Tee-Object -FilePath cmake_config.log
|
||||
$exit = $LASTEXITCODE
|
||||
Write-Host "::endgroup::"
|
||||
|
||||
@@ -390,6 +373,11 @@ jobs:
|
||||
ccache --show-stats
|
||||
}
|
||||
|
||||
- name: Clean CMake cache
|
||||
shell: bash
|
||||
run: |
|
||||
rm -rf build build_ai cmake_config.log
|
||||
|
||||
- name: Configure (Unix)
|
||||
if: runner.os != 'Windows'
|
||||
id: configure_unix
|
||||
@@ -402,38 +390,11 @@ jobs:
|
||||
export CCACHE_DIR=${HOME}/.ccache
|
||||
ccache --zero-stats
|
||||
fi
|
||||
if [[ "${{ runner.os }}" == "Linux" ]]; then
|
||||
# Linux: Use portal backend for file dialogs (more reliable in CI)
|
||||
cmake -B build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
||||
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
|
||||
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
|
||||
-DYAZE_BUILD_TESTS=ON \
|
||||
-DYAZE_BUILD_EMU=ON \
|
||||
-DYAZE_ENABLE_ROM_TESTS=OFF \
|
||||
-DYAZE_BUILD_Z3ED=ON \
|
||||
-DYAZE_BUILD_TOOLS=ON \
|
||||
-DNFD_PORTAL=ON 2>&1 | tee cmake_config.log
|
||||
else
|
||||
# macOS: Use default GTK backend
|
||||
cmake -B build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
||||
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
|
||||
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
|
||||
-DYAZE_BUILD_TESTS=ON \
|
||||
-DYAZE_BUILD_EMU=ON \
|
||||
-DYAZE_ENABLE_ROM_TESTS=OFF \
|
||||
-DYAZE_BUILD_Z3ED=ON \
|
||||
-DYAZE_BUILD_TOOLS=ON 2>&1 | tee cmake_config.log
|
||||
fi
|
||||
cmake --preset "${{ matrix.configure_preset }}" 2>&1 | tee cmake_config.log
|
||||
echo "::endgroup::"
|
||||
if command -v ccache >/dev/null 2>&1; then
|
||||
ccache --show-stats
|
||||
fi
|
||||
# Note: Full-featured build to match release configuration
|
||||
# Note: YAZE_BUILD_EMU=OFF disables standalone emulator executable
|
||||
# but yaze_emulator library is still built for main app/tests
|
||||
# Note: NFD_PORTAL=ON uses D-Bus portal instead of GTK on Linux (more reliable in CI)
|
||||
|
||||
- name: Report Configure Failure
|
||||
if: always() && (steps.configure_windows.outcome == 'failure' || steps.configure_unix.outcome == 'failure')
|
||||
@@ -441,8 +402,22 @@ jobs:
|
||||
run: |
|
||||
echo "::error::CMake configuration failed. Check cmake_config.log for details."
|
||||
if [ -f cmake_config.log ]; then
|
||||
echo "::group::CMake Configuration Log (last 50 lines)"
|
||||
tail -50 cmake_config.log
|
||||
echo "::group::CMake Configuration Log (last 100 lines)"
|
||||
tail -100 cmake_config.log
|
||||
echo "::endgroup::"
|
||||
if grep -q "_gRPC_CPP_PLUGIN" cmake_config.log; then
|
||||
echo "::group::CMake gRPC entries"
|
||||
grep -n "gRPC" cmake_config.log | tail -20
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
fi
|
||||
BUILD_DIR="${{ matrix.binary_dir }}"
|
||||
if [ -z "$BUILD_DIR" ]; then
|
||||
BUILD_DIR=build
|
||||
fi
|
||||
if [ -f "$BUILD_DIR/CMakeCache.txt" ]; then
|
||||
echo "::group::Relevant CMake Cache Entries"
|
||||
grep -E "gRPC|PROTOBUF" "$BUILD_DIR/CMakeCache.txt" || true
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
if [ -f build/CMakeFiles/CMakeError.log ]; then
|
||||
@@ -457,12 +432,15 @@ jobs:
|
||||
run: |
|
||||
BUILD_TYPE=${BUILD_TYPE:-${{ env.BUILD_TYPE }}}
|
||||
echo "Building with ${BUILD_TYPE} configuration..."
|
||||
BUILD_DIR=${{ matrix.binary_dir }}
|
||||
if [[ -z "$BUILD_DIR" ]]; then
|
||||
BUILD_DIR=build
|
||||
fi
|
||||
if [[ "${{ runner.os }}" == "Windows" ]]; then
|
||||
JOBS=${CMAKE_BUILD_PARALLEL_LEVEL:-4}
|
||||
echo "Using $JOBS parallel jobs"
|
||||
cmake --build build --config "${BUILD_TYPE}" --parallel "${JOBS}" 2>&1 | tee build.log
|
||||
cmake --build "$BUILD_DIR" --config "${BUILD_TYPE}" --parallel "${JOBS}" 2>&1 | tee build.log
|
||||
else
|
||||
# Determine number of parallel jobs based on platform
|
||||
if command -v nproc >/dev/null 2>&1; then
|
||||
CORES=$(nproc)
|
||||
elif command -v sysctl >/dev/null 2>&1; then
|
||||
@@ -471,7 +449,7 @@ jobs:
|
||||
CORES=2
|
||||
fi
|
||||
echo "Using $CORES parallel jobs"
|
||||
cmake --build build --parallel $CORES 2>&1 | tee build.log
|
||||
cmake --build "$BUILD_DIR" --parallel "$CORES" 2>&1 | tee build.log
|
||||
fi
|
||||
if command -v ccache >/dev/null 2>&1; then
|
||||
ccache --show-stats
|
||||
|
||||
393
.github/workflows/release.yml
vendored
393
.github/workflows/release.yml
vendored
@@ -18,16 +18,43 @@ env:
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
build-windows:
|
||||
name: Windows x64
|
||||
runs-on: windows-2022
|
||||
build:
|
||||
name: "${{ matrix.name }}"
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: "Windows x64"
|
||||
os: windows-2022
|
||||
artifact: yaze-windows-x64.zip
|
||||
configure_preset: win-rel
|
||||
build_dir: build
|
||||
- name: "macOS Universal"
|
||||
os: macos-14
|
||||
artifact: yaze-macos-universal.dmg
|
||||
configure_preset: mac-uni
|
||||
build_dir: build
|
||||
- name: "Linux x64"
|
||||
os: ubuntu-22.04
|
||||
artifact: yaze-linux-x64.tar.gz
|
||||
configure_preset: lin-rel
|
||||
build_dir: build_release_linux
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup vcpkg
|
||||
- name: Clean previous build outputs
|
||||
shell: bash
|
||||
run: |
|
||||
rm -rf "${{ matrix.build_dir }}" build/_deps cmake_config.log build.log dist
|
||||
|
||||
- name: Setup vcpkg (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
uses: lukka/run-vcpkg@v11
|
||||
id: vcpkg
|
||||
with:
|
||||
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
|
||||
vcpkgGitCommitId: 'b2c74683ecfd6a8e7d27ffb0df077f66a9339509'
|
||||
@@ -36,253 +63,25 @@ jobs:
|
||||
VCPKG_DEFAULT_TRIPLET: x64-windows-static
|
||||
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
|
||||
|
||||
- name: Install build tools
|
||||
- name: Resolve vcpkg toolchain (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
run: |
|
||||
choco install --no-progress -y nasm
|
||||
"C:\Program Files\NASM" | Out-File -FilePath $env:GITHUB_PATH -Append
|
||||
|
||||
- name: Setup MSVC environment for clang-cl
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64
|
||||
|
||||
- name: Configure clang-cl
|
||||
shell: pwsh
|
||||
run: |
|
||||
Write-Host "Setting up clang-cl compiler"
|
||||
echo "CC=clang-cl" >> $env:GITHUB_ENV
|
||||
echo "CXX=clang-cl" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Setup sccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: windows-x64-release-${{ github.run_id }}
|
||||
restore-keys: |
|
||||
windows-x64-release-
|
||||
max-size: 500M
|
||||
variant: sccache
|
||||
|
||||
- name: Restore vcpkg packages cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
build/vcpkg_installed
|
||||
${{ github.workspace }}/vcpkg/packages
|
||||
key: vcpkg-release-${{ hashFiles('vcpkg.json') }}
|
||||
restore-keys: |
|
||||
vcpkg-release-
|
||||
|
||||
- name: Restore FetchContent dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
build/_deps
|
||||
key: fetchcontent-release-${{ hashFiles('cmake/grpc*.cmake') }}-v3
|
||||
restore-keys: |
|
||||
fetchcontent-release-v3-
|
||||
|
||||
- name: Configure sccache
|
||||
shell: pwsh
|
||||
run: |
|
||||
echo "CC=sccache clang-cl" >> $env:GITHUB_ENV
|
||||
echo "CXX=sccache clang-cl" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Configure
|
||||
id: configure
|
||||
shell: pwsh
|
||||
run: |
|
||||
Write-Host "=== Build Configuration ===" -ForegroundColor Cyan
|
||||
Write-Host "Compiler: clang-cl"
|
||||
Write-Host "Build Type: Release"
|
||||
cmake --version
|
||||
clang-cl --version
|
||||
|
||||
$toolchain = "${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||
cmake -S . -B build `
|
||||
-DCMAKE_BUILD_TYPE=Release `
|
||||
-DCMAKE_C_COMPILER=clang-cl `
|
||||
-DCMAKE_CXX_COMPILER=clang-cl `
|
||||
"-DCMAKE_TOOLCHAIN_FILE=$toolchain" `
|
||||
-DVCPKG_TARGET_TRIPLET=x64-windows-static `
|
||||
-DVCPKG_MANIFEST_MODE=ON `
|
||||
-DYAZE_BUILD_TESTS=OFF `
|
||||
-DYAZE_BUILD_EMU=ON `
|
||||
-DYAZE_BUILD_Z3ED=ON `
|
||||
-DYAZE_BUILD_TOOLS=ON 2>&1 | Tee-Object -FilePath cmake_config.log
|
||||
|
||||
- name: Report Configure Failure
|
||||
if: always() && steps.configure.outcome == 'failure'
|
||||
shell: pwsh
|
||||
run: |
|
||||
Write-Host "::error::CMake configuration failed. Check cmake_config.log for details." -ForegroundColor Red
|
||||
if (Test-Path cmake_config.log) {
|
||||
Write-Host "::group::CMake Configuration Log (last 50 lines)"
|
||||
Get-Content cmake_config.log -Tail 50
|
||||
Write-Host "::endgroup::"
|
||||
$toolchain = Join-Path "${{ github.workspace }}" "vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||
if (-not (Test-Path $toolchain)) {
|
||||
Write-Host "::error::vcpkg toolchain file not found at $toolchain"
|
||||
exit 1
|
||||
}
|
||||
exit 1
|
||||
"CMAKE_TOOLCHAIN_FILE=$toolchain" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
"VCPKG_MANIFEST_MODE=ON" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
"VCPKG_TARGET_TRIPLET=x64-windows-static" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
|
||||
- name: Build
|
||||
id: build
|
||||
shell: pwsh
|
||||
run: cmake --build build --config Release --parallel 4 -- /p:CL_MPcount=4 2>&1 | Tee-Object -FilePath build.log
|
||||
- name: Install dependencies (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: brew install ninja cmake || true
|
||||
|
||||
- name: Report Build Failure
|
||||
if: always() && steps.build.outcome == 'failure'
|
||||
shell: pwsh
|
||||
run: |
|
||||
Write-Host "::error::Build failed. Check build.log for details." -ForegroundColor Red
|
||||
if (Test-Path build.log) {
|
||||
Write-Host "::group::Build Log (last 100 lines)"
|
||||
Get-Content build.log -Tail 100
|
||||
Write-Host "::endgroup::"
|
||||
|
||||
# Check for specific error patterns
|
||||
if (Select-String -Path "build.log" -Pattern "vcpkg" -Quiet) {
|
||||
Write-Host "`n::group::vcpkg-related errors" -ForegroundColor Yellow
|
||||
Select-String -Path "build.log" -Pattern "vcpkg.*error" -CaseSensitive:$false | Select-Object -First 10
|
||||
Write-Host "::endgroup::"
|
||||
}
|
||||
|
||||
if (Select-String -Path "build.log" -Pattern "LNK[0-9]{4}" -Quiet) {
|
||||
Write-Host "`n::group::Linker errors" -ForegroundColor Yellow
|
||||
Select-String -Path "build.log" -Pattern "LNK[0-9]{4}" | Select-Object -First 10
|
||||
Write-Host "::endgroup::"
|
||||
}
|
||||
|
||||
if (Select-String -Path "build.log" -Pattern "fatal error" -Quiet) {
|
||||
Write-Host "`n::group::Fatal errors" -ForegroundColor Yellow
|
||||
Select-String -Path "build.log" -Pattern "fatal error" | Select-Object -First 10
|
||||
Write-Host "::endgroup::"
|
||||
}
|
||||
}
|
||||
|
||||
# List vcpkg installed packages
|
||||
$vcpkgExe = "${{ github.workspace }}/vcpkg/vcpkg.exe"
|
||||
if (Test-Path $vcpkgExe) {
|
||||
Write-Host "`n::group::Installed vcpkg packages"
|
||||
& $vcpkgExe list
|
||||
Write-Host "::endgroup::"
|
||||
}
|
||||
exit 1
|
||||
|
||||
- name: Package
|
||||
shell: pwsh
|
||||
run: |
|
||||
New-Item -ItemType Directory -Path release
|
||||
Copy-Item -Path build/bin/Release/* -Destination release/ -Recurse
|
||||
Copy-Item -Path assets -Destination release/ -Recurse
|
||||
Copy-Item LICENSE, README.md -Destination release/
|
||||
Compress-Archive -Path release/* -DestinationPath yaze-windows-x64.zip
|
||||
|
||||
- name: Upload Build Logs on Failure (Windows)
|
||||
if: always() && (steps.configure.outcome == 'failure' || steps.build.outcome == 'failure')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-logs-windows
|
||||
path: |
|
||||
cmake_config.log
|
||||
build.log
|
||||
if-no-files-found: ignore
|
||||
retention-days: 7
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: steps.build.outcome == 'success'
|
||||
with:
|
||||
name: yaze-windows-x64
|
||||
path: yaze-windows-x64.zip
|
||||
|
||||
build-macos:
|
||||
name: macOS Universal
|
||||
runs-on: macos-14
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install dependencies
|
||||
run: brew install ninja cmake
|
||||
|
||||
- name: Configure arm64
|
||||
id: configure_arm64
|
||||
run: |
|
||||
cmake -S . -B build-arm64 -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
||||
-DYAZE_BUILD_TESTS=OFF \
|
||||
-DYAZE_BUILD_EMU=ON \
|
||||
-DYAZE_BUILD_Z3ED=ON \
|
||||
-DYAZE_BUILD_TOOLS=ON 2>&1 | tee cmake_config_arm64.log
|
||||
|
||||
- name: Build arm64
|
||||
id: build_arm64
|
||||
run: cmake --build build-arm64 --config Release 2>&1 | tee build_arm64.log
|
||||
|
||||
- name: Configure x86_64
|
||||
id: configure_x86_64
|
||||
run: |
|
||||
cmake -S . -B build-x86_64 -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
|
||||
-DYAZE_BUILD_TESTS=OFF \
|
||||
-DYAZE_BUILD_EMU=ON \
|
||||
-DYAZE_BUILD_Z3ED=ON \
|
||||
-DYAZE_BUILD_TOOLS=ON 2>&1 | tee cmake_config_x86_64.log
|
||||
|
||||
- name: Build x86_64
|
||||
id: build_x86_64
|
||||
run: cmake --build build-x86_64 --config Release 2>&1 | tee build_x86_64.log
|
||||
|
||||
- name: Create Universal Binary
|
||||
run: |
|
||||
cp -R build-arm64/bin/yaze.app yaze.app
|
||||
lipo -create \
|
||||
build-arm64/bin/yaze.app/Contents/MacOS/yaze \
|
||||
build-x86_64/bin/yaze.app/Contents/MacOS/yaze \
|
||||
-output yaze.app/Contents/MacOS/yaze
|
||||
lipo -info yaze.app/Contents/MacOS/yaze
|
||||
|
||||
- name: Create DMG
|
||||
run: |
|
||||
hdiutil create -fs HFS+ -srcfolder yaze.app \
|
||||
-volname "yaze" yaze-macos-universal.dmg
|
||||
|
||||
- name: Upload Build Logs on Failure (macOS)
|
||||
if: always() && (steps.configure_arm64.outcome == 'failure' || steps.build_arm64.outcome == 'failure' || steps.configure_x86_64.outcome == 'failure' || steps.build_x86_64.outcome == 'failure')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-logs-macos
|
||||
path: |
|
||||
cmake_config_arm64.log
|
||||
build_arm64.log
|
||||
cmake_config_x86_64.log
|
||||
build_x86_64.log
|
||||
if-no-files-found: ignore
|
||||
retention-days: 7
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: steps.build_arm64.outcome == 'success' && steps.build_x86_64.outcome == 'success'
|
||||
with:
|
||||
name: yaze-macos-universal
|
||||
path: yaze-macos-universal.dmg
|
||||
|
||||
build-linux:
|
||||
name: Linux x64
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Free disk space
|
||||
run: |
|
||||
sudo rm -rf /usr/share/dotnet
|
||||
sudo rm -rf /usr/local/lib/android
|
||||
sudo rm -rf /opt/ghc
|
||||
sudo apt-get clean
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Install dependencies (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
@@ -294,51 +93,97 @@ jobs:
|
||||
libxss-dev libxxf86vm-dev libxkbcommon-dev libwayland-dev libdecor-0-dev \
|
||||
libgtk-3-dev libdbus-1-dev
|
||||
|
||||
- name: Configure
|
||||
id: configure
|
||||
- name: Configure (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
id: configure_windows
|
||||
shell: pwsh
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DYAZE_BUILD_TESTS=OFF \
|
||||
-DYAZE_BUILD_EMU=ON \
|
||||
-DYAZE_BUILD_Z3ED=ON \
|
||||
-DYAZE_BUILD_TOOLS=ON \
|
||||
-DNFD_PORTAL=ON 2>&1 | tee cmake_config.log
|
||||
cmake --preset "${{ matrix.configure_preset }}" 2>&1 | Tee-Object -FilePath cmake_config.log
|
||||
|
||||
- name: Build
|
||||
id: build
|
||||
run: cmake --build build --config Release 2>&1 | tee build.log
|
||||
- name: Configure (Unix)
|
||||
if: runner.os != 'Windows'
|
||||
id: configure_unix
|
||||
shell: bash
|
||||
run: |
|
||||
cmake --preset "${{ matrix.configure_preset }}" 2>&1 | tee cmake_config.log
|
||||
|
||||
- name: Report Configure Failure
|
||||
if: failure() && (steps.configure_windows.outcome == 'failure' || steps.configure_unix.outcome == 'failure')
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::error::CMake configuration failed. Check cmake_config.log for details."
|
||||
if [ -f cmake_config.log ]; then
|
||||
echo "::group::CMake Configuration Log (last 100 lines)"
|
||||
tail -n 100 cmake_config.log
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
if [ -f "${{ matrix.build_dir }}/CMakeFiles/CMakeError.log" ]; then
|
||||
echo "::group::CMake Error Log"
|
||||
cat "${{ matrix.build_dir }}/CMakeFiles/CMakeError.log"
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
|
||||
- name: Build (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
id: build_windows
|
||||
shell: pwsh
|
||||
run: |
|
||||
cmake --build "${{ matrix.build_dir }}" --config Release --parallel 8 2>&1 | Tee-Object -FilePath build.log
|
||||
|
||||
- name: Build (Unix)
|
||||
if: runner.os != 'Windows'
|
||||
id: build_unix
|
||||
shell: bash
|
||||
run: |
|
||||
if command -v nproc >/dev/null 2>&1; then
|
||||
CORES=$(nproc)
|
||||
else
|
||||
CORES=$(sysctl -n hw.ncpu)
|
||||
fi
|
||||
cmake --build "${{ matrix.build_dir }}" --parallel "$CORES" 2>&1 | tee build.log
|
||||
|
||||
- name: Report Build Failure
|
||||
if: failure() && (steps.build_windows.outcome == 'failure' || steps.build_unix.outcome == 'failure')
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::error::Build failed. Check build.log for details."
|
||||
if [ -f build.log ]; then
|
||||
echo "::group::Build Log (last 100 lines)"
|
||||
tail -n 100 build.log
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
|
||||
- name: Package
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p release
|
||||
cp build/bin/yaze release/
|
||||
cp -r assets release/
|
||||
cp LICENSE README.md release/
|
||||
tar -czf yaze-linux-x64.tar.gz -C release .
|
||||
./scripts/package/release.sh "${{ matrix.name }}" "${{ matrix.build_dir }}" "${{ matrix.artifact }}"
|
||||
|
||||
- name: Upload Build Logs on Failure (Linux)
|
||||
if: always() && (steps.configure.outcome == 'failure' || steps.build.outcome == 'failure')
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-logs-linux
|
||||
name: release-${{ matrix.name }}
|
||||
path: |
|
||||
dist/${{ matrix.artifact }}
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload logs on failure
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-logs-${{ matrix.name }}
|
||||
path: |
|
||||
cmake_config.log
|
||||
build.log
|
||||
${{ matrix.build_dir }}/CMakeFiles/CMakeError.log
|
||||
${{ matrix.build_dir }}/CMakeFiles/CMakeOutput.log
|
||||
if-no-files-found: ignore
|
||||
retention-days: 7
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: steps.build.outcome == 'success'
|
||||
with:
|
||||
name: yaze-linux-x64
|
||||
path: yaze-linux-x64.tar.gz
|
||||
|
||||
create-release:
|
||||
name: Create Release
|
||||
needs: [build-windows, build-macos, build-linux]
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
if: always() && (needs.build-windows.result == 'success' || needs.build-macos.result == 'success' || needs.build-linux.result == 'success')
|
||||
if: always() && needs.build.result == 'success'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
||||
@@ -308,6 +308,45 @@
|
||||
"CMAKE_C_COMPILER": "clang"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "lin-rel",
|
||||
"displayName": "Linux Release",
|
||||
"description": "Linux release build with GCC (warnings off)",
|
||||
"inherits": ["_base", "_unix", "_quiet"],
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Linux"
|
||||
},
|
||||
"binaryDir": "${sourceDir}/build_release_linux",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_CXX_COMPILER": "g++",
|
||||
"CMAKE_C_COMPILER": "gcc",
|
||||
"YAZE_BUILD_TESTS": "OFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "lin-ai",
|
||||
"displayName": "Linux AI",
|
||||
"description": "Linux AI agent build (z3ed + gRPC + JSON)",
|
||||
"inherits": "ci",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Linux"
|
||||
},
|
||||
"binaryDir": "${sourceDir}/build_ai_linux",
|
||||
"cacheVariables": {
|
||||
"CMAKE_CXX_COMPILER": "g++",
|
||||
"CMAKE_C_COMPILER": "gcc",
|
||||
"Z3ED_AI": "ON",
|
||||
"YAZE_WITH_JSON": "ON",
|
||||
"YAZE_WITH_GRPC": "ON",
|
||||
"YAZE_BUILD_Z3ED": "ON",
|
||||
"YAZE_BUILD_EMU": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ci",
|
||||
"displayName": "9. CI Build",
|
||||
@@ -468,6 +507,18 @@
|
||||
"displayName": "Linux Clang",
|
||||
"jobs": 12
|
||||
},
|
||||
{
|
||||
"name": "lin-rel",
|
||||
"configurePreset": "lin-rel",
|
||||
"displayName": "Linux Release",
|
||||
"jobs": 12
|
||||
},
|
||||
{
|
||||
"name": "lin-ai",
|
||||
"configurePreset": "lin-ai",
|
||||
"displayName": "Linux AI",
|
||||
"jobs": 12
|
||||
},
|
||||
{
|
||||
"name": "ci",
|
||||
"configurePreset": "ci",
|
||||
@@ -570,6 +621,16 @@
|
||||
"name": "win-arm",
|
||||
"configurePreset": "win-arm-rel",
|
||||
"displayName": "Windows Package (ARM64)"
|
||||
},
|
||||
{
|
||||
"name": "lin",
|
||||
"configurePreset": "lin-rel",
|
||||
"displayName": "Linux Package (x64)"
|
||||
},
|
||||
{
|
||||
"name": "lin-ai",
|
||||
"configurePreset": "lin-ai",
|
||||
"displayName": "Linux Package (AI)"
|
||||
}
|
||||
],
|
||||
"workflowPresets": [
|
||||
|
||||
89
scripts/package/release.sh
Normal file
89
scripts/package/release.sh
Normal file
@@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
TARGET_NAME=${1:-}
|
||||
BUILD_DIR=${2:-}
|
||||
ARTIFACT_NAME=${3:-}
|
||||
|
||||
if [[ -z "$TARGET_NAME" || -z "$BUILD_DIR" || -z "$ARTIFACT_NAME" ]]; then
|
||||
echo "Usage: release.sh <target-name> <build-dir> <artifact-name>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
ROOT_DIR=${GITHUB_WORKSPACE:-$(cd "$SCRIPT_DIR/../.." && pwd)}
|
||||
ARTIFACTS_DIR="$ROOT_DIR/dist"
|
||||
STAGING_DIR=$(mktemp -d)
|
||||
|
||||
mkdir -p "$ARTIFACTS_DIR"
|
||||
|
||||
cleanup() {
|
||||
rm -rf "$STAGING_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
echo "Packaging $TARGET_NAME using build output at $BUILD_DIR"
|
||||
|
||||
case "${RUNNER_OS:-$(uname)}" in
|
||||
Windows*)
|
||||
BIN_DIR="$BUILD_DIR/bin/Release"
|
||||
if [[ ! -d "$BIN_DIR" ]]; then
|
||||
echo "::error::Expected Windows binaries under $BIN_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
cp -R "$BIN_DIR" "$STAGING_DIR/bin"
|
||||
cp -R "$ROOT_DIR/assets" "$STAGING_DIR/assets"
|
||||
cp "$ROOT_DIR"/LICENSE "$ROOT_DIR"/README.md "$STAGING_DIR"/
|
||||
ARTIFACT_PATH="$ARTIFACTS_DIR/$ARTIFACT_NAME"
|
||||
pwsh -NoLogo -NoProfile -Command "Compress-Archive -Path '${STAGING_DIR}\*' -DestinationPath '$ARTIFACT_PATH' -Force"
|
||||
;;
|
||||
Darwin)
|
||||
APP_PATH="$BUILD_DIR/bin/yaze.app"
|
||||
if [[ ! -d "$APP_PATH" ]]; then
|
||||
echo "::error::Expected macOS app bundle at $APP_PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
cp -R "$APP_PATH" "$STAGING_DIR/yaze.app"
|
||||
cp "$ROOT_DIR"/LICENSE "$ROOT_DIR"/README.md "$STAGING_DIR"/
|
||||
ARTIFACT_PATH="$ARTIFACTS_DIR/$ARTIFACT_NAME"
|
||||
hdiutil create -fs HFS+ -srcfolder "$STAGING_DIR/yaze.app" -volname "yaze" "$ARTIFACT_PATH"
|
||||
;;
|
||||
Linux*)
|
||||
BIN_DIR="$BUILD_DIR/bin"
|
||||
if [[ ! -d "$BIN_DIR" ]]; then
|
||||
echo "::error::Expected Linux binaries under $BIN_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
cp "$ROOT_DIR"/LICENSE "$ROOT_DIR"/README.md "$STAGING_DIR"/
|
||||
cp -R "$BIN_DIR" "$STAGING_DIR/bin"
|
||||
cp -R "$ROOT_DIR/assets" "$STAGING_DIR/assets"
|
||||
ARTIFACT_PATH="$ARTIFACTS_DIR/$ARTIFACT_NAME"
|
||||
tar -czf "$ARTIFACT_PATH" -C "$STAGING_DIR" .
|
||||
;;
|
||||
*)
|
||||
echo "::error::Unsupported host: ${RUNNER_OS:-$(uname)}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ ! -f "$ARTIFACT_PATH" ]]; then
|
||||
echo "::error::Packaging did not produce $ARTIFACT_PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if command -v sha256sum >/dev/null 2>&1; then
|
||||
SHA_CMD="sha256sum"
|
||||
elif command -v shasum >/dev/null 2>&1; then
|
||||
SHA_CMD="shasum -a 256"
|
||||
else
|
||||
echo "::warning::No SHA256 utility found; skipping checksum generation" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
CHECKSUM=$($SHA_CMD "$ARTIFACT_PATH" | awk '{print $1}')
|
||||
echo "$CHECKSUM $(basename "$ARTIFACT_PATH")" >> "$ARTIFACTS_DIR/SHA256SUMS.txt"
|
||||
echo "$CHECKSUM" > "$ARTIFACT_PATH.sha256"
|
||||
|
||||
echo "Created artifact $ARTIFACT_PATH"
|
||||
|
||||
Reference in New Issue
Block a user