From 8b5167b3192bfb7b01206f441a1b8e62062df2ec Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Sun, 22 Sep 2024 18:13:22 +0200 Subject: [PATCH 01/13] fix tests for new cliff packets, add string to packet.h --- include/create/packet.h | 1 + tests/test_data.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/create/packet.h b/include/create/packet.h index d1e7928..60ff0f2 100644 --- a/include/create/packet.h +++ b/include/create/packet.h @@ -32,6 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. #define CREATE_PACKET_H #include +#include namespace create { class Packet { diff --git a/tests/test_data.cpp b/tests/test_data.cpp index e9752a0..e347fb1 100644 --- a/tests/test_data.cpp +++ b/tests/test_data.cpp @@ -65,11 +65,11 @@ TEST(DataTest, GetNumPackets) create::Data data_v_3(create::V_3); // Number exclusive to V_3 = 13 - // 17 + 13 = 30 - EXPECT_EQ(static_cast(data_v_3.getNumPackets()), 30); + // 17 + 17 = 34 + EXPECT_EQ(static_cast(data_v_3.getNumPackets()), 34); create::Data data_v_all(create::V_ALL); - EXPECT_EQ(static_cast(data_v_all.getNumPackets()), 33); + EXPECT_EQ(static_cast(data_v_all.getNumPackets()), 37); } TEST(DataTest, GetPacket) @@ -108,7 +108,7 @@ TEST(DataTest, GetPacketIDs) create::Data data_v_3(create::V_3); const std::vector packet_ids = data_v_3.getPacketIDs(); // Vector should have same length as reported by getNumPackets() - ASSERT_EQ(static_cast(packet_ids.size()), 30); + ASSERT_EQ(static_cast(packet_ids.size()), 34); // Vector should contain ID_LEFT_ENC bool found = false; @@ -133,9 +133,9 @@ TEST(DataTest, GetTotalDataBytes) create::Data data_v_2(create::V_2); EXPECT_EQ(static_cast(data_v_2.getTotalDataBytes()), 26); - // V_3 has an additional 21 bytes + // V_3 has an additional 29 bytes create::Data data_v_3(create::V_3); - EXPECT_EQ(static_cast(data_v_3.getTotalDataBytes()), 42); + EXPECT_EQ(static_cast(data_v_3.getTotalDataBytes()), 50); } TEST(DataTest, IsValidPacketID) From 7ae7155f25c484d9c328115a60cd992887b99ab6 Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Sun, 22 Sep 2024 18:29:51 +0200 Subject: [PATCH 02/13] ci: add Packing cmake and dockerfile to run packing --- .dockerignore | 2 ++ CMakeLists.txt | 9 +++++++- ci/Dockerfile | 17 +++++++++++++++ cmake/Packing.cmake | 50 +++++++++++++++++++++++++++++++++++++++++++++ package.sh | 0 5 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 ci/Dockerfile create mode 100644 cmake/Packing.cmake create mode 100755 package.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7846b39 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.github +ci \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index ce7beb2..2d37b18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ # target_link_libraries(... ${libcreate_LIBRARIES}) # -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.28) project(libcreate) add_compile_options(-Wall -Wextra -Wpedantic) @@ -203,3 +203,10 @@ if(LIBCREATE_BUILD_TESTS AND ${GTEST_FOUND}) else() message("No GTest installation found. Skipping tests.") endif() + +############# +# Packaging # +############# + +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +include(Packing) \ No newline at end of file diff --git a/ci/Dockerfile b/ci/Dockerfile new file mode 100644 index 0000000..c303ca9 --- /dev/null +++ b/ci/Dockerfile @@ -0,0 +1,17 @@ +FROM ubuntu:24.04 + +RUN apt update && \ + apt install -y \ + build-essential cmake file \ + libboost-system-dev libboost-thread-dev \ + libgtest-dev googletest && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /libcreate +COPY . . + +WORKDIR /libcreate/build +RUN cmake -B /libcreate/build -S /libcreate -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Werror" && \ + cmake --build /libcreate/build --config Release && \ + ctest -C Release --output-on-failure && \ + cpack --build /libcreate/build -G DEB diff --git a/cmake/Packing.cmake b/cmake/Packing.cmake new file mode 100644 index 0000000..93b1feb --- /dev/null +++ b/cmake/Packing.cmake @@ -0,0 +1,50 @@ +# these are cache variables, so they could be overwritten with -D, +set(CPACK_PACKAGE_NAME ${PROJECT_NAME} + CACHE STRING "The resulting package name" +) +# which is useful in case of packing only selected components instead of the whole thing +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C++ library for interfacing with iRobot's Create 1 and 2" + CACHE STRING "Package description for the package metadata" +) +set(CPACK_PACKAGE_VENDOR "Verein zur Förderung von Jugendlichen durch Robotikwettbewerbe") + +set(CPACK_VERBATIM_VARIABLES YES) + +set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) +SET(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_SOURCE_DIR}/_packages") + +# https://unix.stackexchange.com/a/11552/254512 +set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/some")#/${CMAKE_PROJECT_VERSION}") + +set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) + +set(CPACK_PACKAGE_CONTACT "kontakt@comp-air.at") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "comp-air dev team") + +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") + +# Discover and set dependencies correcly +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES) + +# The installation path directory should have 0755 permissions +set( + CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE +) + +# package name for deb. If set, then instead of some-application-0.9.2-Linux.deb +# you'll get some-application_0.9.2_amd64.deb (note the underscores too) +set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) +# that is if you want every group to have its own package, +# although the same will happen if this is not set (so it defaults to ONE_PER_GROUP) +# and CPACK_DEB_COMPONENT_INSTALL is set to YES +set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)#ONE_PER_GROUP) +# without this you won't be able to pack only specified component +set(CPACK_DEB_COMPONENT_INSTALL YES) + +include(CPack) \ No newline at end of file diff --git a/package.sh b/package.sh new file mode 100755 index 0000000..e69de29 From 1791063fa8644434c001b50b8543bad698ae713c Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Mon, 23 Sep 2024 13:34:10 +0200 Subject: [PATCH 03/13] cmake: add versioning module --- CMakeLists.txt | 20 +++++++++++++++++--- cmake/Versioning.cmake | 26 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 cmake/Versioning.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d37b18..54d6ded 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,15 @@ +######### +# Setup # +######### + +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +include(Versioning) + +######## +# Main # +######## + # After installation this project can be found by 'find_package' command: # # find_package(libcreate REQUIRED) @@ -6,11 +18,14 @@ # cmake_minimum_required(VERSION 3.28) -project(libcreate) +project( + libcreate + VERSION ${TAG_VERSION_MAJOR}.${TAG_VERSION_MINOR}.${TAG_VERSION_PATCH} +) add_compile_options(-Wall -Wextra -Wpedantic) -set(PACKAGE_VERSION 3.0.0) +set(PACKAGE_VERSION ${TAG_VERSION_MAJOR}.${TAG_VERSION_MINOR}.${TAG_VERSION_PATCH}) option(LIBCREATE_BUILD_TESTS "Enable the build of tests." ON) @@ -208,5 +223,4 @@ endif() # Packaging # ############# -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(Packing) \ No newline at end of file diff --git a/cmake/Versioning.cmake b/cmake/Versioning.cmake new file mode 100644 index 0000000..b082127 --- /dev/null +++ b/cmake/Versioning.cmake @@ -0,0 +1,26 @@ +find_package(Git) + +if(GIT_EXECUTABLE) + execute_process( + COMMAND ${GIT_EXECUTABLE} describe --tags + OUTPUT_VARIABLE TAG_VERSION + RESULT_VARIABLE ERROR_CODE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + if(TAG_VERSION STREQUAL "") + set(TAG_VERSION 0.0.0) + message(WARNING "Failed to determine version from Git tags. Using default version \"${TAG_VERSION}\".") + endif() + + message(STATUS "Project version: ${TAG_VERSION}") + + # Split into major, minor, patch + string( + REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" + TAG_VERSION_MATCH ${TAG_VERSION} + ) + set(TAG_VERSION_MAJOR ${CMAKE_MATCH_1}) + set(TAG_VERSION_MINOR ${CMAKE_MATCH_2}) + set(TAG_VERSION_PATCH ${CMAKE_MATCH_3}) +endif() \ No newline at end of file From 3836d1480b3b9e9a773464d895ce4ffc2182537d Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Mon, 23 Sep 2024 13:34:34 +0200 Subject: [PATCH 04/13] ci: add packing job --- .dockerignore | 2 +- .github/workflows/ci.yaml | 38 ---------------------------------- .github/workflows/package.yaml | 29 ++++++++++++++++++++++++++ .github/workflows/test.yaml | 30 +++++++++++++++++++++++++++ ci/Dockerfile | 7 ++----- ci/entrypoint.sh | 10 +++++++++ 6 files changed, 72 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/package.yaml create mode 100644 .github/workflows/test.yaml create mode 100755 ci/entrypoint.sh diff --git a/.dockerignore b/.dockerignore index 7846b39..d71d4b3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,2 @@ .github -ci \ No newline at end of file +ci/Dockerfile \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 7fb7d18..0000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,38 +0,0 @@ -name: Build and test - -on: - push: - branches: ['master'] - pull_request: - -env: - BUILD_TYPE: Release - -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-20.04, ubuntu-22.04] - - steps: - - name: Install dependencies - run: | - sudo apt install build-essential cmake git libboost-system-dev libboost-thread-dev - git clone https://github.com/google/googletest.git - cd googletest - cmake CMakeLists.txt - make - sudo make install - - - uses: actions/checkout@v2 - - - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_FLAGS="-Werror" - - - name: Build - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Test - working-directory: ${{github.workspace}}/build - run: ctest -C ${{env.BUILD_TYPE}} diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml new file mode 100644 index 0000000..bbc7e80 --- /dev/null +++ b/.github/workflows/package.yaml @@ -0,0 +1,29 @@ +name: Package + +on: + push: + +jobs: + package: + runs-on: ubuntu-24.04 + strategy: + matrix: + platform: [linux/arm64/v8] + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + platforms: linux/arm64 + + - name: Prepare container + run: docker buildx build -f ci/Dockerfile . -t libcreate --platform ${{ matrix.platform }} --load + - name: Build + run: docker run --platform ${{ matrix.platform }} -v ./output:/libcreate/_packages libcreate diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..986dc29 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,30 @@ +name: Build and test + +on: + push: + branches: ["master"] + pull_request: + +env: + BUILD_TYPE: Release + +jobs: + test: + runs-on: ubuntu-24.04 + + steps: + - name: Install dependencies + run: | + sudo apt install build-essential cmake git libboost-system-dev libboost-thread-dev file libgtest-dev googletest + + - uses: actions/checkout@v4 + + - name: Configure CMake + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_FLAGS="-Werror" + + - name: Build + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + run: ctest -C ${{env.BUILD_TYPE}} diff --git a/ci/Dockerfile b/ci/Dockerfile index c303ca9..6516bf9 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -2,7 +2,7 @@ FROM ubuntu:24.04 RUN apt update && \ apt install -y \ - build-essential cmake file \ + build-essential cmake git file \ libboost-system-dev libboost-thread-dev \ libgtest-dev googletest && \ rm -rf /var/lib/apt/lists/* @@ -11,7 +11,4 @@ WORKDIR /libcreate COPY . . WORKDIR /libcreate/build -RUN cmake -B /libcreate/build -S /libcreate -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Werror" && \ - cmake --build /libcreate/build --config Release && \ - ctest -C Release --output-on-failure && \ - cpack --build /libcreate/build -G DEB +ENTRYPOINT ["/bin/bash", "/libcreate/ci/entrypoint.sh"] diff --git a/ci/entrypoint.sh b/ci/entrypoint.sh new file mode 100755 index 0000000..c371918 --- /dev/null +++ b/ci/entrypoint.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +cmake -B /libcreate/build -S /libcreate -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS='-Werror' +cmake --build /libcreate/build --config Release +ctest -C Release --output-on-failure +cpack --build /libcreate/build -G DEB \ No newline at end of file From efd9cf02c9229f5f1776f8579f1d447098c547ee Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Mon, 23 Sep 2024 14:06:29 +0200 Subject: [PATCH 05/13] ci: add tag extraction from github_ref var --- .github/workflows/package.yaml | 2 ++ cmake/Versioning.cmake | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index bbc7e80..1253655 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -2,6 +2,8 @@ name: Package on: push: + tags: + - "**" jobs: package: diff --git a/cmake/Versioning.cmake b/cmake/Versioning.cmake index b082127..7665011 100644 --- a/cmake/Versioning.cmake +++ b/cmake/Versioning.cmake @@ -8,6 +8,11 @@ if(GIT_EXECUTABLE) OUTPUT_STRIP_TRAILING_WHITESPACE ) + if(DEFINED ENV{GITHUB_REF}) + set(TAG_VERSION $ENV{GITHUB_REF}) + message(STATUS "Extracted version from GITHUB_REF") + endif() + if(TAG_VERSION STREQUAL "") set(TAG_VERSION 0.0.0) message(WARNING "Failed to determine version from Git tags. Using default version \"${TAG_VERSION}\".") From f8b977336a6372d0bcef1099d85c7ac4c30272ce Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Mon, 23 Sep 2024 14:09:47 +0200 Subject: [PATCH 06/13] ci: change tag filter --- .github/workflows/package.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index 1253655..04fc237 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -3,7 +3,7 @@ name: Package on: push: tags: - - "**" + - "*" jobs: package: From 1979a5d4058cce3b49f700d42285cd5b8b2d9535 Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Mon, 23 Sep 2024 14:31:09 +0200 Subject: [PATCH 07/13] ci: add push to compREP --- .github/workflows/package.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index 04fc237..3fe9610 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -29,3 +29,11 @@ jobs: run: docker buildx build -f ci/Dockerfile . -t libcreate --platform ${{ matrix.platform }} --load - name: Build run: docker run --platform ${{ matrix.platform }} -v ./output:/libcreate/_packages libcreate + - name: Push deb to compREP + uses: cpina/github-action-push-to-another-repository@main + with: + source-directory: "output/" + target-directory: "debs/complib/" + destination-github-username: "F-WuTS" + destination-repository-name: "compREP" + target-branch: master From 52201a39324e6d0c0b04b20d44dbd0ef343c04db Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Mon, 23 Sep 2024 15:51:44 +0200 Subject: [PATCH 08/13] ci: fix SSH_DEPLOY_KEY env var --- .github/workflows/package.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index 3fe9610..113c7bb 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -31,6 +31,8 @@ jobs: run: docker run --platform ${{ matrix.platform }} -v ./output:/libcreate/_packages libcreate - name: Push deb to compREP uses: cpina/github-action-push-to-another-repository@main + env: + SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} with: source-directory: "output/" target-directory: "debs/complib/" From f3cafc241d96b60b89d6522a0ae40ee67faeced3 Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Mon, 23 Sep 2024 17:12:41 +0200 Subject: [PATCH 09/13] ci: change from ubuntu base to debian base --- CMakeLists.txt | 3 ++- ci/Dockerfile | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54d6ded..007b56b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ # Setup # ######### +cmake_minimum_required(VERSION 3.25) + set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(Versioning) @@ -17,7 +19,6 @@ include(Versioning) # target_link_libraries(... ${libcreate_LIBRARIES}) # -cmake_minimum_required(VERSION 3.28) project( libcreate VERSION ${TAG_VERSION_MAJOR}.${TAG_VERSION_MINOR}.${TAG_VERSION_PATCH} diff --git a/ci/Dockerfile b/ci/Dockerfile index 6516bf9..3274bbe 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:24.04 +FROM debian:bookworm RUN apt update && \ apt install -y \ From 78424d187c78b34df71efae599b06f4dca96665e Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Mon, 23 Sep 2024 21:13:21 +0200 Subject: [PATCH 10/13] cmake: do not install to opt --- ci/Dockerfile | 2 +- ci/entrypoint.sh | 7 ++++++- cmake/Packing.cmake | 9 --------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/ci/Dockerfile b/ci/Dockerfile index 3274bbe..bf82ed3 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -2,7 +2,7 @@ FROM debian:bookworm RUN apt update && \ apt install -y \ - build-essential cmake git file \ + build-essential cmake git file tree \ libboost-system-dev libboost-thread-dev \ libgtest-dev googletest && \ rm -rf /var/lib/apt/lists/* diff --git a/ci/entrypoint.sh b/ci/entrypoint.sh index c371918..680207f 100755 --- a/ci/entrypoint.sh +++ b/ci/entrypoint.sh @@ -7,4 +7,9 @@ set -o pipefail cmake -B /libcreate/build -S /libcreate -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS='-Werror' cmake --build /libcreate/build --config Release ctest -C Release --output-on-failure -cpack --build /libcreate/build -G DEB \ No newline at end of file +cpack --build /libcreate/build -G DEB + +debs=(/libcreate/_packages/*.deb) +cp "${debs[0]}" /tmp/libcreate.deb +dpkg-deb -R /tmp/libcreate.deb /tmp/libcreate +tree /tmp/libcreate \ No newline at end of file diff --git a/cmake/Packing.cmake b/cmake/Packing.cmake index 93b1feb..58d81b8 100644 --- a/cmake/Packing.cmake +++ b/cmake/Packing.cmake @@ -13,9 +13,6 @@ set(CPACK_VERBATIM_VARIABLES YES) set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) SET(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_SOURCE_DIR}/_packages") -# https://unix.stackexchange.com/a/11552/254512 -set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/some")#/${CMAKE_PROJECT_VERSION}") - set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) @@ -40,11 +37,5 @@ set( # package name for deb. If set, then instead of some-application-0.9.2-Linux.deb # you'll get some-application_0.9.2_amd64.deb (note the underscores too) set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) -# that is if you want every group to have its own package, -# although the same will happen if this is not set (so it defaults to ONE_PER_GROUP) -# and CPACK_DEB_COMPONENT_INSTALL is set to YES -set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)#ONE_PER_GROUP) -# without this you won't be able to pack only specified component -set(CPACK_DEB_COMPONENT_INSTALL YES) include(CPack) \ No newline at end of file From 3ac90c382e5db2b87348264add23be3bcdd455a7 Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Mon, 23 Sep 2024 22:46:52 +0200 Subject: [PATCH 11/13] ci: change target-dir in comprep to debs/libcreate --- .github/workflows/package.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index 113c7bb..5a1e8f4 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -35,7 +35,7 @@ jobs: SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} with: source-directory: "output/" - target-directory: "debs/complib/" + target-directory: "debs/libcreate/" destination-github-username: "F-WuTS" destination-repository-name: "compREP" target-branch: master From e51895fa18a9599a3173975679d39bb691e69afb Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Wed, 25 Sep 2024 21:54:46 +0200 Subject: [PATCH 12/13] cmake: add default Werror, extract version only from GITHUB_REF if tag --- .github/workflows/test.yaml | 2 +- CMakeLists.txt | 2 +- cmake/Versioning.cmake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 986dc29..fb0bcce 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v4 - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_FLAGS="-Werror" + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} diff --git a/CMakeLists.txt b/CMakeLists.txt index 007b56b..e39cf16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ project( VERSION ${TAG_VERSION_MAJOR}.${TAG_VERSION_MINOR}.${TAG_VERSION_PATCH} ) -add_compile_options(-Wall -Wextra -Wpedantic) +add_compile_options(-Wall -Wextra -Wpedantic -Werror) set(PACKAGE_VERSION ${TAG_VERSION_MAJOR}.${TAG_VERSION_MINOR}.${TAG_VERSION_PATCH}) diff --git a/cmake/Versioning.cmake b/cmake/Versioning.cmake index 7665011..d659c5c 100644 --- a/cmake/Versioning.cmake +++ b/cmake/Versioning.cmake @@ -8,7 +8,7 @@ if(GIT_EXECUTABLE) OUTPUT_STRIP_TRAILING_WHITESPACE ) - if(DEFINED ENV{GITHUB_REF}) + if(DEFINED ENV{GITHUB_REF} AND ENV{GITHUB_REF_TYPE} EQUAL "tag") set(TAG_VERSION $ENV{GITHUB_REF}) message(STATUS "Extracted version from GITHUB_REF") endif() From 5a591cfbbad809c82f1d9370418ae9b01ab18348 Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Wed, 25 Sep 2024 21:58:36 +0200 Subject: [PATCH 13/13] ci: remove Werror from entrypoint --- ci/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/entrypoint.sh b/ci/entrypoint.sh index 680207f..779d753 100755 --- a/ci/entrypoint.sh +++ b/ci/entrypoint.sh @@ -4,7 +4,7 @@ set -o errexit set -o nounset set -o pipefail -cmake -B /libcreate/build -S /libcreate -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS='-Werror' +cmake -B /libcreate/build -S /libcreate -DCMAKE_BUILD_TYPE=Release cmake --build /libcreate/build --config Release ctest -C Release --output-on-failure cpack --build /libcreate/build -G DEB