Skip to content

fix github actions #103

fix github actions

fix github actions #103

Workflow file for this run

name: Build & Latest Release (Linux + Windows)
#######################################################################
# 1) Triggers
#######################################################################
on:
pull_request:
branches: [ master ]
push:
branches: [ master ]
workflow_dispatch:
#######################################################################
# 2) Permission – allow the workflow to create / overwrite a release
#######################################################################
permissions:
contents: write
#######################################################################
# 3) Build & test matrix
#######################################################################
jobs:
# ───────────────────────────────────────────────────────── build ──
build:
env:
SHORT_SHA: ${{ github.sha }} # for easy naming later
strategy:
matrix:
include:
# Linux
- os: ubuntu-22.04
cfg: linux-release
build: linux-build
isLinux: true
# Windows
- os: windows-2022
cfg: windows-release
build: windows-build
isLinux: false
runs-on: ${{ matrix.os }}
steps:
# 3-1) Checkout sources
- uses: actions/checkout@v4
# 3-2) Linux-only packages
- name: Install packages (apt)
if: matrix.isLinux
run: |
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends \
clang ninja-build cmake build-essential \
libxmu-dev libxi-dev libxinerama-dev libxrandr-dev \
libxcursor-dev libudev-dev libopenal-dev unixodbc-dev \
libgl1-mesa-dev libxxf86vm-dev zlib1g-dev
# 3-3) MSVC environment (Windows)
- name: Set up MSVC env
if: matrix.os == 'windows-2022'
uses: ilammy/msvc-dev-cmd@v1
with: { arch: x64 }
- name: Verify Ninja on PATH
run: ninja --version
# 3-4) ── UNZIP ENGINE FILES *before* CMake ──────────────────────
- name: Unzip Engine files (Linux)
if: matrix.isLinux
run: |
unzip -q assets/Engine.zip -d assets
unzip -q third_party/EE/Engine.zip -d third_party/EE
- name: Unzip Engine files (Windows)
if: matrix.os == 'windows-2022'
shell: pwsh
run: |
Expand-Archive assets/Engine.zip -DestinationPath assets -Force
Get-ChildItem third_party/EE -Filter '*.zip' |
ForEach-Object { Expand-Archive $_.FullName -DestinationPath third_party/EE -Force }
# 3-5) Configure → Build → Test
- name: Configure
run: cmake --preset ${{ matrix.cfg }}
- name: Build
run: cmake --build --preset ${{ matrix.build }}
- name: Run unit tests
run: ctest --test-dir out/build/${{ matrix.cfg }} --output-on-failure
# 3-6) Package runtime files and create per-platform archive
- name: Package & archive (Linux)
if: matrix.isLinux
run: |
set -euo pipefail
STAGE=out/dist
mkdir -p "$STAGE/Bin"
cp "out/build/${{ matrix.cfg }}/apps/client/client" "$STAGE/client"
cp "out/build/${{ matrix.cfg }}/apps/server/server" "$STAGE/server"
cp assets/Engine.pak "$STAGE/Bin/Engine.pak"
cp assets/Project.pak "$STAGE/Bin/Project.pak"
tar -czf "linux_binaries_${SHORT_SHA:0:8}.tar.gz" -C "$STAGE" .
- name: Package & archive (Windows)
if: matrix.os == 'windows-2022'
shell: pwsh
run: |
$Stage = "out/dist"
New-Item "$Stage/Bin" -ItemType Directory -Force | Out-Null
Copy-Item "out/build/${{ matrix.cfg }}/apps/client/client.exe" "$Stage/client.exe"
Copy-Item "out/build/${{ matrix.cfg }}/apps/server/server.exe" "$Stage/server.exe"
Copy-Item "assets/Engine.pak" "$Stage/Bin/Engine.pak"
Copy-Item "assets/Project.pak" "$Stage/Bin/Project.pak"
$sha = $env:SHORT_SHA.Substring(0,8)
Compress-Archive -Path "$Stage/*" -DestinationPath "windows_binaries_${sha}.zip"
# 3-7) Upload the archive as the build artifact
- name: Upload platform archive
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.os }}
path: |
linux_binaries_*.tar.gz
windows_binaries_*.zip
retention-days: 2
# ───────────────────────────────────────────────────── release ──
release:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download platform archives
uses: actions/download-artifact@v4
with:
pattern: binaries-*
merge-multiple: true
path: release # → release/linux_binaries_*.tar.gz …
- name: Build release metadata
id: vars
run: |
echo "timestamp=$(date -u +'%Y-%m-%d %H:%M UTC')" >> $GITHUB_OUTPUT
echo "short_sha=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
- name: Publish Latest release
uses: softprops/action-gh-release@v2
with:
tag_name: latest
make_latest: true
name: Latest build – ${{ steps.vars.outputs.timestamp }}
body: |
Automatic build from commit \
[`${{ steps.vars.outputs.short_sha }}`]\
(${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}).
files: release/**