mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 14:25:02 +00:00
307 lines
8.4 KiB
YAML
307 lines
8.4 KiB
YAML
name: C++ Build & Test
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop ]
|
|
paths:
|
|
- 'dbal/production/**'
|
|
- '.github/workflows/cpp-build.yml'
|
|
pull_request:
|
|
branches: [ main, develop ]
|
|
paths:
|
|
- 'dbal/production/**'
|
|
- '.github/workflows/cpp-build.yml'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
check-implementation:
|
|
name: Check C++ Implementation Status
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
outputs:
|
|
has_sources: ${{ steps.check.outputs.has_sources }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Check if C++ sources exist
|
|
id: check
|
|
run: |
|
|
if [ -d "dbal/production/src" ] && [ "$(find dbal/production/src -name '*.cpp' | wc -l)" -gt 0 ]; then
|
|
echo "has_sources=true" >> $GITHUB_OUTPUT
|
|
echo "✓ C++ source files found"
|
|
else
|
|
echo "has_sources=false" >> $GITHUB_OUTPUT
|
|
echo "⚠ C++ implementation not yet available - skipping build"
|
|
fi
|
|
|
|
build-linux:
|
|
name: Build on Linux
|
|
runs-on: ubuntu-latest
|
|
needs: check-implementation
|
|
if: needs.check-implementation.outputs.has_sources == 'true'
|
|
|
|
strategy:
|
|
matrix:
|
|
build_type: [Release, Debug]
|
|
compiler:
|
|
- { cc: gcc, cxx: g++ }
|
|
- { cc: clang, cxx: clang++ }
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y cmake ninja-build ${{ matrix.compiler.cxx }}
|
|
pip install conan
|
|
|
|
- name: Setup Conan profile
|
|
run: conan profile detect --force
|
|
|
|
- name: Check C++ dependencies
|
|
run: npm run cpp:check
|
|
|
|
- name: Initialize Conanfile
|
|
run: npm run cpp:init
|
|
|
|
- name: Install Conan dependencies
|
|
env:
|
|
CMAKE_BUILD_TYPE: ${{ matrix.build_type }}
|
|
CC: ${{ matrix.compiler.cc }}
|
|
CXX: ${{ matrix.compiler.cxx }}
|
|
run: npm run cpp:install
|
|
|
|
- name: Configure CMake
|
|
env:
|
|
CMAKE_BUILD_TYPE: ${{ matrix.build_type }}
|
|
CC: ${{ matrix.compiler.cc }}
|
|
CXX: ${{ matrix.compiler.cxx }}
|
|
run: |
|
|
if [ "${{ matrix.build_type }}" = "Debug" ]; then
|
|
npm run cpp:build -- configure --debug
|
|
else
|
|
npm run cpp:configure
|
|
fi
|
|
|
|
- name: Build C++ project
|
|
env:
|
|
CMAKE_BUILD_TYPE: ${{ matrix.build_type }}
|
|
run: npm run cpp:build
|
|
|
|
- name: Run C++ tests
|
|
run: npm run cpp:test
|
|
|
|
- name: Upload build artifacts
|
|
if: matrix.build_type == 'Release' && matrix.compiler.cxx == 'g++'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dbal-daemon-linux
|
|
path: |
|
|
dbal/production/build/dbal_daemon
|
|
dbal/production/build/*.so
|
|
retention-days: 7
|
|
|
|
build-macos:
|
|
name: Build on macOS
|
|
runs-on: macos-latest
|
|
needs: check-implementation
|
|
if: needs.check-implementation.outputs.has_sources == 'true'
|
|
|
|
strategy:
|
|
matrix:
|
|
build_type: [Release, Debug]
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
brew install cmake ninja conan
|
|
|
|
- name: Setup Conan profile
|
|
run: conan profile detect --force
|
|
|
|
- name: Check C++ dependencies
|
|
run: npm run cpp:check
|
|
|
|
- name: Full C++ build
|
|
env:
|
|
CMAKE_BUILD_TYPE: ${{ matrix.build_type }}
|
|
run: |
|
|
if [ "${{ matrix.build_type }}" = "Debug" ]; then
|
|
echo "skipping dbal/shared/tools cpp build assistant (tools/ removed)"
|
|
else
|
|
npm run cpp:full
|
|
fi
|
|
|
|
- name: Run C++ tests
|
|
run: npm run cpp:test
|
|
|
|
- name: Upload build artifacts
|
|
if: matrix.build_type == 'Release'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dbal-daemon-macos
|
|
path: |
|
|
dbal/production/build/dbal_daemon
|
|
dbal/production/build/*.dylib
|
|
retention-days: 7
|
|
|
|
build-windows:
|
|
name: Build on Windows
|
|
runs-on: windows-latest
|
|
needs: check-implementation
|
|
if: needs.check-implementation.outputs.has_sources == 'true'
|
|
|
|
strategy:
|
|
matrix:
|
|
build_type: [Release, Debug]
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
choco install cmake ninja -y
|
|
pip install conan
|
|
|
|
- name: Setup Conan profile
|
|
run: conan profile detect --force
|
|
|
|
- name: Check C++ dependencies
|
|
run: npm run cpp:check
|
|
|
|
- name: Full C++ build
|
|
env:
|
|
CMAKE_BUILD_TYPE: ${{ matrix.build_type }}
|
|
shell: bash
|
|
run: |
|
|
if [ "${{ matrix.build_type }}" = "Debug" ]; then
|
|
echo "skipping dbal/shared/tools cpp build assistant (tools/ removed)"
|
|
else
|
|
npm run cpp:full
|
|
fi
|
|
|
|
- name: Run C++ tests
|
|
run: npm run cpp:test
|
|
|
|
- name: Upload build artifacts
|
|
if: matrix.build_type == 'Release'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dbal-daemon-windows
|
|
path: |
|
|
dbal/production/build/dbal_daemon.exe
|
|
dbal/production/build/*.dll
|
|
retention-days: 7
|
|
|
|
code-quality:
|
|
name: C++ Code Quality
|
|
runs-on: ubuntu-latest
|
|
needs: check-implementation
|
|
if: needs.check-implementation.outputs.has_sources == 'true'
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y cmake ninja-build cppcheck clang-format
|
|
pip install conan
|
|
|
|
- name: Setup Conan
|
|
run: conan profile detect --force
|
|
|
|
- name: Configure project
|
|
run: npm run cpp:full
|
|
|
|
- name: Run cppcheck
|
|
run: |
|
|
cppcheck --enable=all --inconclusive --error-exitcode=1 \
|
|
--suppress=missingIncludeSystem \
|
|
-I dbal/production/include \
|
|
dbal/production/src/
|
|
continue-on-error: true
|
|
|
|
- name: Check formatting
|
|
run: |
|
|
find dbal/production/src dbal/production/include -name '*.cpp' -o -name '*.hpp' | \
|
|
xargs clang-format --dry-run --Werror
|
|
continue-on-error: true
|
|
|
|
integration:
|
|
name: Integration Test
|
|
runs-on: ubuntu-latest
|
|
needs: [check-implementation, build-linux]
|
|
if: needs.check-implementation.outputs.has_sources == 'true'
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm install --frozen-lockfile
|
|
|
|
- name: Download Linux build
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: dbal-daemon-linux
|
|
path: dbal/production/build/
|
|
|
|
- name: Make daemon executable
|
|
run: chmod +x dbal/production/build/dbal_daemon
|
|
|
|
- name: Run integration tests
|
|
run: |
|
|
# Start C++ daemon
|
|
./dbal/production/build/dbal_daemon &
|
|
DAEMON_PID=$!
|
|
sleep 2
|
|
|
|
# Run TypeScript integration tests
|
|
npm run test:unit
|
|
|
|
# Cleanup
|
|
kill $DAEMON_PID
|
|
continue-on-error: true
|