From f7f05f089a4d472766a052bdcbff21ce98286e8a Mon Sep 17 00:00:00 2001 From: AeroStun <24841307+AeroStun@users.noreply.github.com> Date: Sat, 5 Nov 2022 22:06:19 +0100 Subject: [PATCH] [CMake & CI] Upgrade build dependencies Signed-off-by: AeroStun <24841307+AeroStun@users.noreply.github.com> --- .github/workflows/build.yml | 89 ++++++++++--------- CMake/BuildProfiles/UbuntuImpish.cmake | 33 ------- CMake/BuildProfiles/UbuntuJammy.cmake | 2 +- ...buntuHirsute.cmake => UbuntuKinetic.cmake} | 4 +- CMake/Modules/SetupBoost.cmake | 12 +-- CMake/Modules/SetupMosquitto.cmake | 2 +- src/Ardrivo/String.cpp | 6 +- 7 files changed, 59 insertions(+), 89 deletions(-) delete mode 100644 CMake/BuildProfiles/UbuntuImpish.cmake rename CMake/BuildProfiles/{UbuntuHirsute.cmake => UbuntuKinetic.cmake} (93%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c2b2023..36e7b4a3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: coverage-linux: name: libSMCE (coverage) - Linux runs-on: ubuntu-latest - container: ubuntu:hirsute + container: ubuntu:jammy env: DEBIAN_FRONTEND: "noninteractive" steps: @@ -40,7 +40,7 @@ jobs: apt-get install -y lcov curl wget git cmake ninja-build g++ libmosquitto-dev pkg-config jq perl-base ninja --version cmake --version - wget -O Juniper.deb https://www.juniper-lang.org/installers/Juniper-3.0.0.deb + wget -O Juniper.deb https://www.juniper-lang.org/installers/Juniper-3.1.0.deb apt-get install ./Juniper.deb - name: Setup global CMake interceptor run: ci/setup-cmake-interceptor.sh @@ -69,11 +69,11 @@ jobs: run: | ci/scan-cmake-commands.sh - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: files: ./coverage.info,./cmake-codecov-report.json - name: Upload traces - uses: 'actions/upload-artifact@v2' + uses: 'actions/upload-artifact@v3' with: name: cmcov-traces path: CMakeTrace/ @@ -88,10 +88,10 @@ jobs: os: ubuntu-latest c: gcc-10 cxx: g++-10 - - lib: libc++ - os: ubuntu-latest - c: clang-14 - cxx: clang++-14 -stdlib=libc++ +# - lib: libc++ +# os: ubuntu-latest +# c: clang-15 +# cxx: clang++-15 -stdlib=libc++ env: CC: ${{ matrix.c }} CXX: ${{ matrix.cxx }} @@ -100,14 +100,14 @@ jobs: if: matrix.lib == 'libc++' run: | sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" - sudo apt-get update && sudo apt-get install -y clang-14 libc++-14-dev libc++abi-14-dev + sudo apt-get update && sudo apt-get install -y clang-15 libc++-15-dev libc++abi-15-dev - uses: actions/checkout@v3 - run: ci/setup-cmake-interceptor.sh - run: cmake -DSMCE_BUILD_PROFILE=CxxStdLibDebug -S . -B build - run: cmake --build build/ --target SMCE_Tests - run: (cd build/test/; ctest --output-on-failure) - run: ci/scan-cmake-commands.sh - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v3 with: files: ./cmake-codecov-report.json @@ -164,7 +164,7 @@ jobs: rm -rd build/packages/_CPack_Packages - name: Upload artifacts if: matrix.compiler.release - uses: 'actions/upload-artifact@v2' + uses: 'actions/upload-artifact@v3' with: name: libSMCE-ubuntu-${{ matrix.compiler.c }} path: build/packages/* @@ -176,9 +176,14 @@ jobs: fail-fast: false matrix: compiler: - - name: GCC 11 + - name: GCC 12 release: true slug: gcc + c: gcc-12 + cxx: g++-12 + - name: GCC 11 + release: false + slug: gcc c: gcc-11 cxx: g++-11 - name: GCC 10 @@ -186,12 +191,12 @@ jobs: slug: gcc c: gcc-10 cxx: g++-10 - - name: Clang/LLVM 13 + - name: Clang/LLVM 15 release: true slug: clang - c: clang-13 - cxx: clang++-13 - - name: AppleClang 12 + c: clang-15 + cxx: clang++-15 + - name: AppleClang 14 release: true slug: appleclang c: clang @@ -204,6 +209,7 @@ jobs: - name: Check deps run: | brew install ninja openssl@3 bash + [ "${{ matrix.compiler.slug }}" = "clang" ] && brew install llvm curl -sL https://github.com/AeroStun/brew-lipo/raw/master/brew-lipo.sh | bash -s openssl@3 ninja --version cmake --version @@ -225,8 +231,8 @@ jobs: if: matrix.compiler.slug != 'appleclang' run: | export OPENSSL_ROOT_DIR=$(brew --prefix openssl@3) - [ "${{ matrix.compiler.slug }}" = "clang" ] && export CC="$(brew --prefix llvm)/bin/clang -stdlib=libc++ -nostdinc++ -I/usr/local/opt/llvm/include/c++/v1 -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -Wno-unused-command-line-argument" - [ "${{ matrix.compiler.slug }}" = "clang" ] && export CXX="$(brew --prefix llvm)/bin/clang++ -stdlib=libc++ -nostdinc++ -I/usr/local/opt/llvm/include/c++/v1 -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -Wno-unused-command-line-argument" + [ "${{ matrix.compiler.slug }}" = "clang" ] && export CC="$(brew --prefix llvm)/bin/clang" + [ "${{ matrix.compiler.slug }}" = "clang" ] && export CXX="$(brew --prefix llvm)/bin/clang++" CXXFLAGS="-stdlib=libc++ -nostdinc++ -I/usr/local/opt/llvm/include/c++/v1 -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -Wno-unused-command-line-argument" mkdir build cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ @@ -237,8 +243,8 @@ jobs: run: cmake --build ./build - name: Build & Run tests run: | - [ "${{ matrix.compiler.slug }}" = "clang" ] && export CC="$(brew --prefix llvm)/bin/clang -stdlib=libc++ -nostdinc++ -I/usr/local/opt/llvm/include/c++/v1 -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -Wno-unused-command-line-argument" - [ "${{ matrix.compiler.slug }}" = "clang" ] && export CXX="$(brew --prefix llvm)/bin/clang++ -stdlib=libc++ -nostdinc++ -I/usr/local/opt/llvm/include/c++/v1 -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -Wno-unused-command-line-argument" + [ "${{ matrix.compiler.slug }}" = "clang" ] && export CC="$(brew --prefix llvm)/bin/clang" + [ "${{ matrix.compiler.slug }}" = "clang" ] && export CXX="$(brew --prefix llvm)/bin/clang++" CXXFLAGS="-stdlib=libc++ -nostdinc++ -I/usr/local/opt/llvm/include/c++/v1 -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -Wno-unused-command-line-argument" cmake --build ./build --target SMCE_Tests (cd build/test/; ctest --output-on-failure) - name: Package @@ -248,14 +254,14 @@ jobs: rm -rd build/packages/_CPack_Packages - name: Upload artifacts if: matrix.compiler.release - uses: 'actions/upload-artifact@v2' + uses: 'actions/upload-artifact@v3' with: name: libSMCE-macos-${{ matrix.compiler.slug }} path: build/packages/* - name: Collect CMake coverage information run: ci/scan-cmake-commands.sh - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: files: ./cmake-codecov-report.json @@ -309,7 +315,7 @@ jobs: rm -R packages/_CPack_Packages cd .. - name: Upload artifacts - uses: 'actions/upload-artifact@v2' + uses: 'actions/upload-artifact@v3' with: name: libSMCE-windows-${{ matrix.compiler.c }} path: build/packages/* @@ -477,12 +483,6 @@ jobs: run: | dnf -y install curl git cmake ninja ${{ matrix.compiler.pkg }} glibc-devel lib64openssl-devel ninja --version - - if [[ -f /usr/lib64/librt.so ]]; then - echo "This hotfix is no longer needed" && exit 255 - else - ln -s /lib64/librt.so.1 /usr/lib64/librt.so - fi - name: CMake configure run: | cmake -G Ninja \ @@ -548,19 +548,16 @@ jobs: image: debian:bookworm - name: Debian codename: Bullseye - image: gcc:11-bullseye + image: gcc:12-bullseye - name: Debian codename: Buster image: gcc:10-buster + - name: Ubuntu + codename: Kinetic + image: ubuntu:kinetic - name: Ubuntu codename: Jammy image: ubuntu:jammy - - name: Ubuntu - codename: Impish - image: ubuntu:impish - - name: Ubuntu - codename: Hirsute - image: ubuntu:hirsute - name: Ubuntu codename: Focal image: ubuntu:focal @@ -569,7 +566,7 @@ jobs: options: --security-opt seccomp=unconfined env: DEBIAN_FRONTEND: "noninteractive" - CMAKE_VERSION: 3.23.1 + CMAKE_VERSION: 3.24.3 steps: - name: Setup workdir run: mkdir /tmp/wk && cd /tmp/wk @@ -604,14 +601,14 @@ jobs: apt-get update -y apt-get install -y /host/build/*.deb - name: Upload artifacts - uses: 'actions/upload-artifact@v2' + uses: 'actions/upload-artifact@v3' with: name: libSMCE-DEB-${{ matrix.os.name }}${{ matrix.os.codename }} path: build/*.deb - name: Collect CMake coverage information run: ci/scan-cmake-commands.sh - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: files: ./cmake-codecov-report.json package-rpm: @@ -633,6 +630,10 @@ jobs: codename: 35 image: fedora:35 profile: FedoraHost + - name: Fedora + codename: 36 + image: fedora:36 + profile: FedoraHost # - name: Fedora # codename: Rawhide # image: fedora:rawhide @@ -641,8 +642,8 @@ jobs: codename: Leap image: opensuse/leap profile: OpenSuseLeap - c: gcc-10 - cxx: g++-10 + c: gcc-11 + cxx: g++-11 # - name: OpenMandriva # codename: Lx4.2 # image: openmandriva/4.2 @@ -659,7 +660,7 @@ jobs: - name: Fetch deps run: | [[ '${{ matrix.os.name }}' == 'Fedora' ]] && dnf install -y perl jq which tar git cmake rpmdevtools rpmlint ninja-build gcc-c++ openssl-devel || true - [[ '${{ matrix.os.name }}' == 'openSUSE' ]] && zypper install -y perl jq which tar git cmake rpmdevtools rpm-build rpmlint ninja gcc10-c++ libopenssl-devel || true + [[ '${{ matrix.os.name }}' == 'openSUSE' ]] && zypper install -y perl jq which tar git cmake rpmdevtools rpm-build rpmlint ninja gcc11-c++ libopenssl-devel || true [[ '${{ matrix.os.name }}' == 'OpenMandriva' ]] && dnf install -y perl jq which tar git cmake rpmdevtools rpm-build rpmlint ninja clang glibc-devel lib64openssl-devel || true - uses: actions/checkout@v3 - name: Setup global CMake interceptor @@ -688,13 +689,13 @@ jobs: cmake --build ./build ./build/stduart --help - name: Upload artifacts - uses: 'actions/upload-artifact@v2' + uses: 'actions/upload-artifact@v3' with: name: libSMCE-RPM-${{ matrix.os.name }}${{ matrix.os.codename }} path: build/*.rpm - name: Collect CMake coverage information run: ci/scan-cmake-commands.sh - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: files: ./cmake-codecov-report.json diff --git a/CMake/BuildProfiles/UbuntuImpish.cmake b/CMake/BuildProfiles/UbuntuImpish.cmake deleted file mode 100644 index dbd5c6ad..00000000 --- a/CMake/BuildProfiles/UbuntuImpish.cmake +++ /dev/null @@ -1,33 +0,0 @@ -# -# BuildProfiles/UbuntuImpish.cmake -# Copyright 2021-2022 ItJustWorksTM -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include_guard () -set (SMCE_PROFILE_VERSION 0) - -include ("${CMAKE_CURRENT_LIST_DIR}/Common/Debian.cmake") - -set (SMCE_BUILD_SHARED On) -set (SMCE_BUILD_STATIC On) -set (SMCE_CXXRT_LINKING SHARED) -set (SMCE_BOOST_LINKING SHARED) -set (SMCE_ARDRIVO_MQTT On) -set (SMCE_MOSQUITTO_LINKING AUTO) -set (SMCE_OPENSSL_LINKING SHARED) -set (SMCE_ARDRIVO_OV767X On) - -set (SMCE_OS_RELEASE "ubuntu2110") -set (SMCE_CPACK_PROFILE "Templates/Debian") diff --git a/CMake/BuildProfiles/UbuntuJammy.cmake b/CMake/BuildProfiles/UbuntuJammy.cmake index 2fafd139..b25b905a 100644 --- a/CMake/BuildProfiles/UbuntuJammy.cmake +++ b/CMake/BuildProfiles/UbuntuJammy.cmake @@ -1,5 +1,5 @@ # -# BuildProfiles/UbuntuImpish.cmake +# BuildProfiles/UbuntuJammy.cmake # Copyright 2021-2022 ItJustWorksTM # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/CMake/BuildProfiles/UbuntuHirsute.cmake b/CMake/BuildProfiles/UbuntuKinetic.cmake similarity index 93% rename from CMake/BuildProfiles/UbuntuHirsute.cmake rename to CMake/BuildProfiles/UbuntuKinetic.cmake index 6ed61796..2aa8c8d5 100644 --- a/CMake/BuildProfiles/UbuntuHirsute.cmake +++ b/CMake/BuildProfiles/UbuntuKinetic.cmake @@ -1,5 +1,5 @@ # -# BuildProfiles/UbuntuHirsute.cmake +# BuildProfiles/UbuntuKinetic.cmake # Copyright 2021-2022 ItJustWorksTM # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,5 +29,5 @@ set (SMCE_MOSQUITTO_LINKING AUTO) set (SMCE_OPENSSL_LINKING SHARED) set (SMCE_ARDRIVO_OV767X On) -set (SMCE_OS_RELEASE "ubuntu2104") +set (SMCE_OS_RELEASE "ubuntu2210") set (SMCE_CPACK_PROFILE "Templates/Debian") diff --git a/CMake/Modules/SetupBoost.cmake b/CMake/Modules/SetupBoost.cmake index bc7ce94f..4e3044d0 100644 --- a/CMake/Modules/SetupBoost.cmake +++ b/CMake/Modules/SetupBoost.cmake @@ -29,19 +29,19 @@ else () if (NOT BOOST_SOURCE_USE_GIT) if (NOT WIN32) FetchContent_Declare (Boost - URL "https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.gz" - URL_HASH SHA256=273f1be93238a068aba4f9735a4a2b003019af067b9c183ed227780b8f36062c + URL "https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.gz" + URL_HASH SHA256=4b2136f98bdd1f5857f1c3dea9ac2018effe65286cf251534b6ae20cc45e1847 ) else () FetchContent_Declare (Boost - URL "https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.7z" - URL_HASH SHA256=6c97cf4f4a0eb00ed776c88065ab3f59e183fa5e65f6464ff94f92328352d9d6 + URL "https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.7z" + URL_HASH SHA256=d12a2af721e22dbfb984ef061ee4c4ab2387f1904f6d65bc5acebaa34d6366ec ) endif () else () FetchContent_Declare (Boost GIT_REPOSITORY "https://github.com/boostorg/boost" - GIT_TAG "boost-1.79.0" + GIT_TAG "boost-1.80.0" GIT_SHALLOW On GIT_PROGRESS On ) @@ -52,7 +52,7 @@ else () FetchContent_Populate (Boost) if (NOT EXISTS "${boost_SOURCE_DIR}/CMakeLists.txt") - file (DOWNLOAD "https://github.com/boostorg/boost/raw/boost-1.79.0/CMakeLists.txt" "${boost_SOURCE_DIR}/CMakeLists.txt") + file (DOWNLOAD "https://github.com/boostorg/boost/raw/boost-1.80.0/CMakeLists.txt" "${boost_SOURCE_DIR}/CMakeLists.txt") endif () message ("Download complete") endif () diff --git a/CMake/Modules/SetupMosquitto.cmake b/CMake/Modules/SetupMosquitto.cmake index ea900cec..9f95a34e 100644 --- a/CMake/Modules/SetupMosquitto.cmake +++ b/CMake/Modules/SetupMosquitto.cmake @@ -62,7 +62,7 @@ elseif ("${SMCE_MOSQUITTO_LINKING}" STREQUAL "SOURCE") include (FetchContent) FetchContent_Declare (mosquitto GIT_REPOSITORY "https://github.com/eclipse/mosquitto" - GIT_TAG v2.0.10 + GIT_TAG v2.0.15 ) FetchContent_GetProperties (mosquitto) if (NOT mosquitto_POPULATED) diff --git a/src/Ardrivo/String.cpp b/src/Ardrivo/String.cpp index 948cba43..dc97ec5d 100644 --- a/src/Ardrivo/String.cpp +++ b/src/Ardrivo/String.cpp @@ -50,7 +50,8 @@ String::String(ConvTag, long double val) : m_u{std::to_string(val)} {} String::String(ConvTag, std::uintmax_t val, SMCE__BIN) { if (val == 0) { - m_u = "0"; + m_u.reserve(1); + m_u.push_back('0'); return; } m_u.resize(bit_width(val)); @@ -62,7 +63,8 @@ String::String(ConvTag, std::uintmax_t val, SMCE__BIN) { String::String(ConvTag, std::uintmax_t val, SMCE__HEX) { if (val == 0) { - m_u = "0"; + m_u.reserve(1); + m_u.push_back('0'); return; } const auto bits = bit_width(val);