mirror of
https://github.com/acidicoala/SmokeAPI.git
synced 2025-12-05 21:15:39 -05:00
124 lines
3.2 KiB
YAML
124 lines
3.2 KiB
YAML
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:
|
|
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:b389a8f522ce3d38f2e50570fb772beebbf0211b2d748210628091d42ee0bce5
|
|
|
|
env:
|
|
BUILD_DIR: ${{ github.workspace }}/build
|
|
|
|
steps:
|
|
- 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 }}
|