From 03d0bd083443bd5ba7bdaed4315b9be12e1d9987 Mon Sep 17 00:00:00 2001 From: DownerCase Date: Tue, 12 Nov 2024 10:32:25 +0000 Subject: [PATCH] Add CMake build to CI checks --- .devcontainer/Dockerfile | 25 ++++++++++++++++++++++--- .github/workflows/ci.yml | 14 ++++++++++++++ CMakeLists.txt | 8 ++++---- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index aeb16af..3acf353 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -54,15 +54,14 @@ RUN cmake --install ./out/core/build --strip --component configuration \ && cmake --install ./out/core/build --strip --component sdk ### -# Dev build-stage, for consuming eCAL and building/testing the Go code +# Dev base build-stage, for consuming eCAL ### -FROM ${BASE_IMAGE} AS dev +FROM ${BASE_IMAGE} AS dev-base LABEL org.opencontainers.image.source https://github.com/downercase/ecal-go RUN apt-get update && apt-get install --no-install-recommends -y\ g++ \ - golang \ libyaml-cpp0.8 \ && rm -rf /var/lib/apt/lists/* @@ -70,3 +69,23 @@ COPY --from=builder /ecal/staging /usr/local # Update dynamic linker so it knows about our new libraries RUN ldconfig + +### +# Dev build-stage, for consuming eCAL and building/testing the C interface library +### +FROM dev-base AS dev-cpp + +RUN apt-get update && apt-get install --no-install-recommends -y\ + cmake \ + ninja-build \ + && rm -rf /var/lib/apt/lists/* + +### +# Dev build-stage, for consuming eCAL and building/testing the Go code +### +FROM dev-base AS dev-go + +RUN apt-get update && apt-get install --no-install-recommends -y\ + golang \ + && rm -rf /var/lib/apt/lists/* + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a19105..88d9ef5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,3 +26,17 @@ jobs: - name: Test run: go test -v ./... + + cmake: + container: + image: ghcr.io/downercase/ecal-go-cpp:latest + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - name: Configure + run: cmake -S . -B build -G Ninja -Werror=dev -DCMAKE_COMPILE_WARNING_AS_ERROR=ON + + - name: Build + run: cmake --build ./build + diff --git a/CMakeLists.txt b/CMakeLists.txt index b21b71b..086d1ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,15 +5,15 @@ find_package(eCAL CONFIG REQUIRED) add_library(ecal_go_core) target_sources(ecal_go_core PRIVATE - ./ecal/ecal_go_core.h - ./ecal/ecal_go_core.cpp + ./ecal/core.h + ./ecal/core.cpp ) target_link_libraries(ecal_go_core PRIVATE eCAL::core) add_library(ecal_go_publisher) target_sources(ecal_go_publisher PRIVATE - ./ecal/publisher/ecal_go_publisher.h - ./ecal/publisher/ecal_go_publisher.cpp + ./ecal/publisher/publisher.h + ./ecal/publisher/publisher.cpp ) target_link_libraries(ecal_go_publisher PRIVATE eCAL::core)