Skip to content

Merge branch 'main' into opengl #14

Merge branch 'main' into opengl

Merge branch 'main' into opengl #14

Workflow file for this run

name: Deploy SDK
on:
push:
tags:
- 'v*'
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/v* ]]; then
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
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 SDK
id: package
shell: bash
run: |
set -euo pipefail
PACKAGE_NAME="ChainedEngine-SDK-v${{ steps.info.outputs.version }}-${{ steps.info.outputs.date }}-${{ matrix.platform }}"
PACKAGE_DIR="${{ github.workspace }}/package"
mkdir -p "$PACKAGE_DIR"
BIN_DIR="${{ github.workspace }}/build/${{ matrix.preset }}/bin/${{ matrix.config }}"
if [[ ! -d "$BIN_DIR" ]]; then
BIN_DIR="${{ github.workspace }}/build/${{ matrix.preset }}/bin"
fi
cp -r "$BIN_DIR"/* "$PACKAGE_DIR/"
if [[ -d "${{ github.workspace }}/assets" ]]; then
cp -r "${{ github.workspace }}/assets" "$PACKAGE_DIR/"
fi
cd "$PACKAGE_DIR"
DEST_ZIP="${{ github.workspace }}/${PACKAGE_NAME}.zip"
DEST_TAR="${{ github.workspace }}/${PACKAGE_NAME}.tar.gz"
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
powershell -Command "Compress-Archive -Path * -DestinationPath '$DEST_ZIP' -Force"
echo "package_file=$PACKAGE_NAME.zip" >> $GITHUB_OUTPUT
echo "package_path=$DEST_ZIP" >> $GITHUB_OUTPUT
else
tar -czf "$DEST_TAR" .
echo "package_file=$PACKAGE_NAME.tar.gz" >> $GITHUB_OUTPUT
echo "package_path=$DEST_TAR" >> $GITHUB_OUTPUT
fi
- name: Upload SDK artifact
uses: actions/upload-artifact@v4
with:
name: SDK-${{ matrix.platform }}
path: ${{ steps.package.outputs.package_path }}
retention-days: 30
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
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/v}
echo "version=${TAG_VERSION}" >> $GITHUB_OUTPUT
- name: Download all SDK artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
pattern: SDK-*
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: "Chained Engine SDK v${{ steps.info.outputs.version }}"
tag_name: "v${{ steps.info.outputs.version }}"
files: release-assets/*
body: |
### Chained Engine SDK
- **Version**: v${{ steps.info.outputs.version }}
- **Build Date**: ${{ steps.info.outputs.date }}
Automated production binaries generated by CI pipelines. Download the `.zip` or `.tar.gz` bundle for your target platform below.