Files
SmokeAPI/.github/workflows/kb-build.yml
acidicoala 7e744f5492 Updated CI
2025-10-05 19:40:36 +05:00

136 lines
3.6 KiB
YAML

#file: noinspection GithubFunctionSignatureValidation
# The rule above suppresses false warning regarding missing function 'fromJson'
name: 🏗️ Build
on:
workflow_call:
inputs:
module:
description: 'Stringified JSON array of CMake projects to build'
required: true
type: string
os:
description: 'Stringified JSON array of target operating systems. Can be "Windows", "Linux", or both.'
required: true
type: string
bitness:
description: 'Stringified JSON array of target bitness. Can be 32, 64, or both.'
required: true
type: string
jobs:
debug:
runs-on: ubuntu-24.04
steps:
- run: echo "inputs.module = ${{ fromJson(inputs.module) }}"
build:
name: ${{ matrix.module }}-${{ matrix.os }}-${{ matrix.bitness }}
runs-on: ${{ matrix.runner }}
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
module: ${{ fromJson(inputs.module) }}
os: ${{ fromJson(inputs.os) }}
bitness: ${{ fromJson(inputs.bitness) }}
include:
# Runner
- os: Windows
runner: windows-2025
- os: Linux
runner: ubuntu-24.04
# Compiler
- os: Linux
compiler: >
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
# Architecture flags
- os: Windows
bitness: 32
arch: -A Win32
- os: Windows
bitness: 64
arch: -A x64
- os: Linux
bitness: 32
arch: >
-DCMAKE_C_FLAGS=-m32
-DCMAKE_CXX_FLAGS=-m32
-DCMAKE_EXE_LINKER_FLAGS=-m32
- os: Linux
bitness: 64
arch: >
-DCMAKE_C_FLAGS=-m64
-DCMAKE_CXX_FLAGS=-m64
-DCMAKE_EXE_LINKER_FLAGS=-m64
# Output paths
- os: Windows
output: 'Release/*.dll'
- os: Linux
output: '*.so'
# Container
- os: Linux
container: ghcr.io/acidicoala/koalabox:master@sha256:7b2c80f23a1f5e777234a625db2ca1cc472d6fbccbf8e8da42f77052f2dcced1
env:
BUILD_DIR: ${{ github.workspace }}/build
steps:
# Fix dubious ownership errors
- name: '✔️ Mark GitHub workspace as safe'
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: '🛠️ Check compiler versions'
if: ${{ matrix.os == 'Linux' }}
run: |
clang++ --version
g++ --version
- name: '📥 Check out repository code'
uses: actions/checkout@v5
with:
submodules: recursive
- name: '🗃️ Cache CPM dependencies'
uses: actions/cache@v4
with:
key: ${{ matrix.os }}-${{ matrix.bitness }}
path: '${{ env.BUILD_DIR }}/.cache'
- name: '⚙️ Generate build files'
# Note: indenting arguments will lead to parsing errors
run: >
cmake
-B "${{ env.BUILD_DIR }}"
-DCMAKE_BUILD_TYPE=Release
-DMODULE=${{ matrix.module }}
${{ matrix.arch }}
${{ matrix.compiler }}
--debug-output
# - name: Build the project
# run: >
# cmake
# --build ${{ env.BUILD_DIR }}
# --config Release
# --target ${{ matrix.module }}
# - name: Upload binaries
# uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.module }}-${{ matrix.os }}-${{ matrix.arch }}
# path: ${{ env.BUILD_DIR }}/${{ matrix.output }}