Skip to content

Fix CMake target detection and remove compiler warnings #80

Fix CMake target detection and remove compiler warnings

Fix CMake target detection and remove compiler warnings #80

name: Build-Ubuntu-GCC
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build_linux_gcc:
permissions:
contents: write
runs-on: ubuntu-latest
timeout-minutes: 60
env:
BUILD_TYPE: Debug
steps:
- uses: actions/checkout@v4
with:
persist-credentials: true
clean: true
fetch-depth: 1
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install build tools
run: |
sudo apt update
sudo apt install -y cmake build-essential ninja-build git
- name: Cache FetchContent downloads
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/build/_deps
key: ${{ runner.os }}-gcc-fetchcontent-${{ hashFiles('CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-gcc-fetchcontent-
- name: Prepare build directory
run: |
rm -rf build
mkdir -p build
- name: Build with GCC (FetchContent mode)
run: |
cd build
echo "Building with FetchContent to download all external systems..."
cmake .. \
-G Ninja \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DMESSAGING_USE_FETCHCONTENT=ON \
-DMESSAGING_BUILD_TESTS=ON \
-DMESSAGING_BUILD_EXAMPLES=ON \
-DCMAKE_INSTALL_PREFIX="../target" \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++
cmake --build . --parallel $(nproc)
- name: Run tests
run: |
cd build
ctest --output-on-failure --parallel || echo "Some tests failed"
- name: Upload build artifacts
if: success()
uses: actions/upload-artifact@v4
with:
name: messaging-system-ubuntu-gcc-${{ env.BUILD_TYPE }}
path: |
${{ github.workspace }}/build/bin/
${{ github.workspace }}/target/
if-no-files-found: warn