Skip to content

Fix primitive serialization, hemisphere geometry, material override p… #24

Fix primitive serialization, hemisphere geometry, material override p…

Fix primitive serialization, hemisphere geometry, material override p… #24

Workflow file for this run

name: Deploy SDK
on:
push:
tags:
- 'release/*'
branches:
- main
- opengl
- develop
workflow_dispatch:
concurrency:
group: deploy-sdk-${{ github.ref }}
cancel-in-progress: true
env:
CI: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
NODE_OPTIONS: "--no-deprecation"
jobs:
build:
name: Build SDK (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux
preset: linux-clang
config: Release
- os: windows-latest
platform: windows
preset: windows-clang
config: Release
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: false
fetch-depth: 1
- name: Write submodule SHA manifest
run: git submodule status | tee submodule-shas.txt
- name: Cache submodules
uses: actions/cache@v4
with:
path: |
.git/modules
thirdparty
key: submodules-${{ runner.os }}-${{ hashFiles('submodule-shas.txt') }}
restore-keys: |
submodules-${{ runner.os }}-
- name: Init submodules
run: git submodule update --init --recursive --depth 1
- name: Setup MSYS2 (Windows)
if: matrix.os == 'windows-latest'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
path-type: inherit
install: mingw-w64-x86_64-clang lld mingw-w64-x86_64-lld mingw-w64-x86_64-gcc mingw-w64-x86_64-make
- name: Prefer MSYS2 toolchain over preinstalled MinGW
if: matrix.os == 'windows-latest'
shell: msys2 {0}
run: |
cygpath -w /mingw64/bin >> "$GITHUB_PATH"
- name: Setup Mold Linker (Linux)
if: matrix.os == 'ubuntu-latest'
uses: rui314/setup-mold@v1
- name: Install Linux Dependencies
if: matrix.os == 'ubuntu-latest'
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
xorg-dev \
libgl1-mesa-dev libglu1-mesa-dev \
libasound2-dev \
pkg-config libgtk-3-dev libdrm-dev libgbm-dev \
xvfb libxkbcommon-x11-0 libgl1-mesa-dri mesa-utils \
clang-18 clang++-18 libc++-18-dev libc++abi-18-dev lld-18 llvm-18
echo "CC=clang-18" >> $GITHUB_ENV
echo "CXX=clang++-18" >> $GITHUB_ENV
echo "LDFLAGS=-fuse-ld=mold" >> $GITHUB_ENV
- name: Get CMake and Ninja
uses: lukka/get-cmake@latest
- name: Setup Compiler Cache
uses: hendrikmuhs/ccache-action@v1.2
with:
variant: ${{ matrix.os == 'windows-latest' && 'sccache' || 'ccache' }}
key: SDK-${{ matrix.preset }}-${{ matrix.config }}
max-size: 5G
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install jinja2
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
10.0.x
- name: Get current version/date
id: info
shell: bash
run: |
echo "date=$(date +'%d.%m.%y')" >> $GITHUB_OUTPUT
if [[ "${GITHUB_REF}" == refs/tags/release/* ]]; then
TAG_VERSION="${GITHUB_REF#refs/tags/release/}"
elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
TAG_VERSION="${GITHUB_REF#refs/tags/}"
else
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
CLEAN_BRANCH="${BRANCH_NAME//\//-}"
SHORT_SHA="${GITHUB_SHA:0:7}"
TAG_VERSION="${CLEAN_BRANCH}-${SHORT_SHA}"
fi
echo "version=${TAG_VERSION}" >> $GITHUB_OUTPUT
- name: Configure CMake
run: |
set -euo pipefail
PYTHON_EXE=$(python3 -c "import sys; print(sys.executable)" 2>/dev/null || python -c "import sys; print(sys.executable)")
launcher="sccache"
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
launcher="ccache"
fi
mkdir -p "build/${{ matrix.preset }}"
cmake --preset ${{ matrix.preset }} \
-DCMAKE_C_COMPILER_LAUNCHER=$launcher \
-DCMAKE_CXX_COMPILER_LAUNCHER=$launcher \
-DPython_EXECUTABLE="${PYTHON_EXE}" \
-DPython3_EXECUTABLE="${PYTHON_EXE}" \
-DCH_CI=ON \
-DENABLE_UNITY_BUILD=OFF \
-DENABLE_PCH=OFF \
-DBUILD_TESTS=OFF \
2>&1 | tee "build/${{ matrix.preset }}/configure.log"
- name: Build binaries
run: |
set -euo pipefail
cmake --build "build/${{ matrix.preset }}" --config ${{ matrix.config }} --parallel \
2>&1 | tee "build/${{ matrix.preset }}/build_${{ matrix.config }}.log"
- name: Sync resources
run: |
set -euo pipefail
python tools/sync_resources.py --root . --bin "build/${{ matrix.preset }}/bin" --config ${{ matrix.config }}
- name: Package all archives
id: package
shell: bash
run: |
set -euo pipefail
VERSION="${{ steps.info.outputs.version }}"
DATE="${{ steps.info.outputs.date }}"
PLATFORM="${{ matrix.platform }}"
IS_WINDOWS="${{ matrix.os == 'windows-latest' }}"
BIN_DIR="${{ github.workspace }}/build/${{ matrix.preset }}/bin/${{ matrix.config }}"
if [[ ! -d "$BIN_DIR" ]]; then
BIN_DIR="${{ github.workspace }}/build/${{ matrix.preset }}/bin"
fi
make_archive() {
local NAME="$1"
local SRC_DIR="$2"
local ARCHIVE_NAME="${NAME}-${VERSION}-${DATE}-${PLATFORM}"
local DEST="${{ github.workspace }}/${ARCHIVE_NAME}"
cd "$SRC_DIR"
if [[ "$IS_WINDOWS" == "true" ]]; then
powershell -Command "Compress-Archive -Path * -DestinationPath '${DEST}.zip' -Force"
echo "${ARCHIVE_NAME}.zip"
else
tar -czf "${DEST}.tar.gz" .
echo "${ARCHIVE_NAME}.tar.gz"
fi
}
# --- SDK (editor + game + assets + resources) ---
SDK_DIR="${{ github.workspace }}/package-sdk"
mkdir -p "$SDK_DIR"
cp -r "$BIN_DIR"/* "$SDK_DIR/"
if [[ -d "${{ github.workspace }}/assets" ]]; then
cp -r "${{ github.workspace }}/assets" "$SDK_DIR/"
fi
SDK_ARCHIVE=$(make_archive "ChainedEngine-SDK" "$SDK_DIR")
echo "sdk_archive=$SDK_ARCHIVE" >> $GITHUB_OUTPUT
# --- Game (ChainedDecos + assets + resources) ---
GAME_DIR="${{ github.workspace }}/package-game"
mkdir -p "$GAME_DIR"
cp "$BIN_DIR/ChainedDecos" "$GAME_DIR/" 2>/dev/null || true
cp "$BIN_DIR/ChainedDecos.exe" "$GAME_DIR/" 2>/dev/null || true
if [[ -d "${{ github.workspace }}/assets" ]]; then
cp -r "${{ github.workspace }}/assets" "$GAME_DIR/"
fi
GAME_ARCHIVE=$(make_archive "ChainedDecos-Game" "$GAME_DIR")
echo "game_archive=$GAME_ARCHIVE" >> $GITHUB_OUTPUT
# --- Editor (ChainedEditor only) ---
EDITOR_DIR="${{ github.workspace }}/package-editor"
mkdir -p "$EDITOR_DIR"
cp "$BIN_DIR/ChainedEditor" "$EDITOR_DIR/" 2>/dev/null || true
cp "$BIN_DIR/ChainedEditor.exe" "$EDITOR_DIR/" 2>/dev/null || true
EDITOR_ARCHIVE=$(make_archive "ChainedEditor" "$EDITOR_DIR")
echo "editor_archive=$EDITOR_ARCHIVE" >> $GITHUB_OUTPUT
- name: Upload SDK artifact
uses: actions/upload-artifact@v4
with:
name: SDK-${{ matrix.platform }}
path: ${{ github.workspace }}/${{ steps.package.outputs.sdk_archive }}
retention-days: 30
- name: Upload Game artifact
uses: actions/upload-artifact@v4
with:
name: Game-${{ matrix.platform }}
path: ${{ github.workspace }}/${{ steps.package.outputs.game_archive }}
retention-days: 30
- name: Upload Editor artifact
uses: actions/upload-artifact@v4
with:
name: Editor-${{ matrix.platform }}
path: ${{ github.workspace }}/${{ steps.package.outputs.editor_archive }}
retention-days: 30
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release/')
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get release info
id: info
run: |
echo "date=$(date +'%d.%m.%y')" >> $GITHUB_OUTPUT
TAG_VERSION=${GITHUB_REF#refs/tags/release/}
echo "version=${TAG_VERSION}" >> $GITHUB_OUTPUT
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
pattern: "{SDK,Game,Editor}-*"
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: "Chained Engine v${{ steps.info.outputs.version }}"
tag_name: "release/${{ steps.info.outputs.version }}"
files: release-assets/*
body: |
### Chained Engine v${{ steps.info.outputs.version }}
- **Build Date**: ${{ steps.info.outputs.date }}
- **Platforms**: Linux (clang), Windows (clang)
#### Assets
- **ChainedEngine-SDK** — full SDK (editor + game + engine)
- **ChainedDecos-Game** — game only
- **ChainedEditor** — editor only
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}