Skip to content

add(shaders): adding placeholder for the base directory of shaders #27

add(shaders): adding placeholder for the base directory of shaders

add(shaders): adding placeholder for the base directory of shaders #27

Workflow file for this run

name: CI Build
on:
push:
branches: [ main ]
paths:
- 'source/**'
- 'thirdparty/**'
- 'toolchain/**'
- 'cmake/**'
- 'CMakeLists.txt'
pull_request:
branches: [ main ]
paths:
- 'source/**'
- 'thirdparty/**'
- 'toolchain/**'
- 'cmake/**'
- 'CMakeLists.txt'
workflow_call:
inputs:
package-artifacts:
description: 'Whether to package and upload the compiled binaries'
type: boolean
required: false
default: false
target-os:
description: 'Comma-separated list of OS to build (e.g., linux,windows). Leave empty for all.'
type: string
required: false
default: ''
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
setup-matrix:
name: Determine Build Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
should_run: ${{ steps.set-matrix.outputs.should_run }}
steps:
- name: Parse Tags and Inputs
id: set-matrix
uses: actions/github-script@v8
env:
EVENT_NAME: ${{ github.event_name }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
INPUT_TARGET_OS: ${{ inputs.target-os }}
with:
script: |
const eventName = process.env.EVENT_NAME;
const commitMsg = (process.env.COMMIT_MESSAGE || '').toLowerCase();
const inputOs = (process.env.INPUT_TARGET_OS || '').toLowerCase();
const allOs = ['ubuntu-latest', 'windows-latest', 'macos-latest'];
const osMap = {
'linux': 'ubuntu-latest',
'ubuntu': 'ubuntu-latest',
'windows': 'windows-latest',
'macos': 'macos-latest'
};
let selectedOs = new Set(allOs);
if (eventName === 'push') {
// Note: GitHub actions natively skips runs with [skip ci],
// but we handle it here just in case native skip is bypassed.
if (commitMsg.includes('[skip ci]')) {
selectedOs.clear();
} else {
const runMatch = commitMsg.match(/\[run\s+([^\]]+)\]/);
const skipMatch = commitMsg.match(/\[skip\s+([^\]]+)\]/);
if (runMatch) {
selectedOs.clear();
runMatch[1].split(',').forEach(t => {
const key = t.trim();
if (osMap[key]) selectedOs.add(osMap[key]);
});
} else if (skipMatch) {
skipMatch[1].split(',').forEach(t => {
const key = t.trim();
if (osMap[key]) selectedOs.delete(osMap[key]);
});
}
}
} else if (eventName === 'workflow_call') {
if (inputOs) {
selectedOs.clear();
inputOs.split(',').forEach(t => {
const key = t.trim();
if (osMap[key]) selectedOs.add(osMap[key]);
else if (allOs.includes(key)) selectedOs.add(key); // Fallback if they type exact runner name
});
}
}
// For 'pull_request', it bypasses the above blocks and defaults to allOs.
const finalOs = Array.from(selectedOs);
core.setOutput('matrix', finalOs);
core.setOutput('should_run', finalOs.length > 0);
build:
name: Build on ${{ matrix.os }}
needs: setup-matrix
if: needs.setup-matrix.outputs.should_run == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
build-type: [Release]
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up MSVC Dev Cmd
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Setup Dependencies
uses: ./.github/actions/setup-deps
with:
os: ${{ matrix.os }}
build-dir: build
- name: Setup Ccache
uses: hendrikmuhs/ccache-action@v1.2.23
with:
key: ${{ matrix.os }}-${{ matrix.build-type }}
- name: Cache CMake FetchContent
uses: actions/cache@v5
with:
path: ~/.cache/cmake_deps
key: ${{ runner.os }}-cmake-deps-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
restore-keys: |
${{ runner.os }}-cmake-deps-
- name: Configure CMake
shell: bash
run: |
cmake -S . -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DFETCHCONTENT_BASE_DIR="$HOME/.cache/cmake_deps"
- name: Build
run: cmake --build build --config ${{ matrix.build-type }} --parallel --verbose
- name: Upload Build Tree
uses: actions/upload-artifact@v4
with:
name: build-tree-${{ matrix.os }}
path: build/
retention-days: 1
test:
name: Test (${{ matrix.os }})
needs: [setup-matrix, build]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
build-type: [Release]
steps:
- uses: actions/checkout@v5
- name: Download Build Tree
uses: actions/download-artifact@v4
with:
name: build-tree-${{ matrix.os }}
path: build/
- name: Run Tests
shell: bash
run: |
cd build
ctest --output-on-failure -C ${{ matrix.build-type }}
package:
name: Package (${{ matrix.os }})
needs: [setup-matrix, build, test]
if: inputs.package-artifacts == true
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
build-type: [Release]
steps:
- uses: actions/checkout@v5
- name: Download Build Tree
uses: actions/download-artifact@v4
with:
name: build-tree-${{ matrix.os }}
path: build/
- name: Install & Versioning
shell: bash
run: |
cmake --install build --prefix install_staging
GP_VERSION=$(head -n 1 VERSION | tr -d '\r\n ')
echo "VERSION=$GP_VERSION" >> $GITHUB_ENV
- name: Archive (Unix)
if: runner.os != 'Windows'
run: tar -czvf gp-engine-${{ matrix.os }}-${{ env.VERSION }}.tar.gz -C install_staging .
- name: Archive (Windows)
if: runner.os == 'Windows'
run: powershell Compress-Archive -Path install_staging\* -DestinationPath gp-engine-${{ matrix.os }}-${{ env.VERSION }}.zip
- name: Upload Release Artifacts
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.os }}
path: gp-engine-${{ matrix.os }}-${{ env.VERSION }}.*
retention-days: 14