ci: add Linux build workflow

This commit is contained in:
server
2026-04-13 20:32:06 +02:00
parent 21519899ad
commit bf72bd2669
2 changed files with 61 additions and 24 deletions

View File

@@ -4,32 +4,68 @@ on:
push:
branches:
- main
pull_request:
jobs:
bsd:
linux:
runs-on: ubuntu-latest
name: Main build job
strategy:
fail-fast: false
matrix:
include:
- name: linux-release
build_type: Release
cmake_args: -G Ninja -DCMAKE_BUILD_TYPE=Release
- name: linux-asan
build_type: RelWithDebInfo
cmake_args: -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_ASAN=ON
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v4
- name: FreeBSD job
id: test
uses: vmactions/freebsd-vm@v1
with:
usesh: true
sync: sshfs
prepare: |
pkg install -y git cmake gmake
- uses: actions/checkout@v4
- name: Install build dependencies
run: |
mkdir build
cd build
cmake ..
gmake all -j6
- name: Collect outputs
run: |
mkdir _output
cp build/bin/* _output
- name: Upload
uses: actions/upload-artifact@v4
with:
name: output_bsd
path: _output
sudo apt-get update
sudo apt-get install -y ninja-build
- name: Configure
run: cmake -S . -B build ${{ matrix.cmake_args }}
- name: Build
run: cmake --build build --parallel
- name: Upload compile commands
if: matrix.name == 'linux-release'
uses: actions/upload-artifact@v4
with:
name: compile-commands
path: build/compile_commands.json
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-binaries
path: build/bin
freebsd:
runs-on: ubuntu-latest
name: freebsd-release
steps:
- uses: actions/checkout@v4
- name: FreeBSD build
uses: vmactions/freebsd-vm@v1
with:
usesh: true
sync: sshfs
prepare: |
pkg install -y git cmake gmake ninja
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: freebsd-release-binaries
path: build/bin

View File

@@ -4,6 +4,7 @@ project(m2dev-server-src)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# ASan support
option(ENABLE_ASAN "Enable AddressSanitizer" OFF)