diff --git a/.github/workflows/coverage_report.yml b/.github/workflows/coverage_report.yml index 5df9c21..0c2acc9 100644 --- a/.github/workflows/coverage_report.yml +++ b/.github/workflows/coverage_report.yml @@ -16,29 +16,20 @@ jobs: rosdistro: ['noetic'] gcc: ['10'] cxx: ['17'] - container: ros:${{ matrix.rosdistro }}-ros-base-focal + container: + image: omavteam/ubuntu-omav-ros:ros-noetic-ros-base + credentials: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} steps: - uses: actions/checkout@v3 name: Checkout lpp with: repository: ethz-asl/lpp - token: ${{ secrets.PAT }} path: catkin_ws/src/lpp - - name: Install newest git version - run: sudo apt update && sudo apt-get install -y software-properties-common && sudo add-apt-repository -y ppa:git-core/ppa && sudo apt-get update && sudo apt-get install -y git - - - name: Install GCC version ${{ matrix.gcc }} - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa -y && sudo apt update && sudo apt install -y gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }} && sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.gcc }} - - - name: Install catkin tools - run: sudo apt install -y python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential python3-catkin-tools - - - name: Install system dependencies - run: sudo apt install -y libgoogle-glog-dev - - name: Install gcovr - run: sudo apt install -y gcovr + run: sudo apt update && sudo apt install -y gcovr - name: Build lpp run: source /opt/ros/${{ matrix.rosdistro }}/setup.bash && mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE="Debug" -DENABLE_COVERAGE=1 -DLPP_BUILD_TESTS=1 && make diff --git a/.github/workflows/cpp_ubuntu20_04.yml b/.github/workflows/cpp_ubuntu20_04.yml index 07c46be..d21434b 100644 --- a/.github/workflows/cpp_ubuntu20_04.yml +++ b/.github/workflows/cpp_ubuntu20_04.yml @@ -9,41 +9,39 @@ on: jobs: build: - runs-on: [self-hosted, linux] + runs-on: [ self-hosted, linux ] strategy: fail-fast: false matrix: - rosdistro: ['noetic'] - gcc: ['8', '9', '10', '11', '13'] - cxx: ['11', '14', '17', '20'] - container: ros:${{ matrix.rosdistro }}-ros-base-focal + rosdistro: [ 'noetic' ] + gcc: [ '8', '9', '10', '11', '13' ] + cxx: [ '11', '14', '17', '20' ] + container: + image: omavteam/ubuntu-omav-ros:ros-noetic-ros-base + credentials: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} name: ROS ${{ matrix.rosdistro }} - GCC ${{ matrix.gcc }} - C++${{ matrix.cxx }} steps: - - uses: actions/checkout@v4 - name: Checkout lpp - with: - repository: ethz-asl/lpp - token: ${{ secrets.PAT }} - path: catkin_ws/src/lpp + - uses: actions/checkout@v4 + name: Checkout lpp + with: + repository: ethz-asl/lpp + path: catkin_ws/src/lpp - - name: Install newest git version - run: sudo apt update && sudo apt-get install -y software-properties-common && sudo add-apt-repository -y ppa:git-core/ppa && sudo apt-get update && sudo apt-get install -y git + - name: Switch GCC version + run: | + update-alternatives --set gcc /usr/bin/gcc-${{ matrix.gcc }} + update-alternatives --set g++ /usr/bin/g++-${{ matrix.gcc}} + gcc --version + g++ --version - - name: Install GCC version ${{ matrix.gcc }} - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt update && sudo apt install -y gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }} && sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.gcc }} && gcc --version && g++ --version + - name: Build lpp + run: source /opt/ros/${{ matrix.rosdistro }}/setup.bash && catkin build -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DLPP_BUILD_TESTS=1 lpp && source ${GITHUB_WORKSPACE}/catkin_ws/devel/setup.bash + working-directory: catkin_ws + shell: bash - - name: Install catkin tools - run: sudo apt install -y python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential python3-catkin-tools - - - name: Install system dependencies - run: sudo apt install -y libgoogle-glog-dev - - - name: Build lpp - run: source /opt/ros/${{ matrix.rosdistro }}/setup.bash && catkin build -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DLPP_BUILD_TESTS=1 lpp && source ${GITHUB_WORKSPACE}/catkin_ws/devel/setup.bash - working-directory: catkin_ws - shell: bash - - - name: Run unittests - run: source /opt/ros/${{ matrix.rosdistro }}/setup.bash && source ${GITHUB_WORKSPACE}/catkin_ws/devel/setup.bash && rosrun lpp test_lpp && rosrun lpp test_glog && rosrun lpp test_lpp_custom && rosrun lpp test_nolog && rosrun lpp test_default && rosrun lpp test_roslog - working-directory: catkin_ws - shell: bash + - name: Run unittests + run: source /opt/ros/${{ matrix.rosdistro }}/setup.bash && source ${GITHUB_WORKSPACE}/catkin_ws/devel/setup.bash && rosrun lpp test_lpp && rosrun lpp test_glog && rosrun lpp test_lpp_custom && rosrun lpp test_nolog && rosrun lpp test_default && rosrun lpp test_roslog + working-directory: catkin_ws + shell: bash diff --git a/.github/workflows/deploy_coverage_report.yml b/.github/workflows/deploy_coverage_report.yml index e8b83d0..51fb213 100644 --- a/.github/workflows/deploy_coverage_report.yml +++ b/.github/workflows/deploy_coverage_report.yml @@ -17,7 +17,11 @@ jobs: rosdistro: ['noetic'] gcc: ['10'] cxx: ['17'] - container: ros:${{ matrix.rosdistro }}-ros-base-focal + container: + image: omavteam/ubuntu-omav-ros:ros-noetic-ros-base + credentials: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} permissions: pages: write # to deploy to Pages id-token: write # to verify the deployment originates from an appropriate source @@ -26,23 +30,10 @@ jobs: name: Checkout lpp with: repository: ethz-asl/lpp - token: ${{ secrets.PAT }} path: catkin_ws/src/lpp - - name: Install newest git version - run: sudo apt update && sudo apt-get install -y software-properties-common && sudo add-apt-repository -y ppa:git-core/ppa && sudo apt-get update && sudo apt-get install -y git - - - name: Install GCC version ${{ matrix.gcc }} - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa -y && sudo apt update && sudo apt install -y gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }} && sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.gcc }} - - - name: Install catkin tools - run: sudo apt install -y python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential python3-catkin-tools - - - name: Install system dependencies - run: sudo apt install -y libgoogle-glog-dev - - name: Install gcovr - run: sudo apt install -y gcovr + run: sudo apt update && sudo apt install -y gcovr - name: Build lpp run: source /opt/ros/${{ matrix.rosdistro }}/setup.bash && mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE="Debug" -DENABLE_COVERAGE=1 -DLPP_BUILD_TESTS=1 && make diff --git a/CMakeLists.txt b/CMakeLists.txt index 484f7a0..026b267 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,11 @@ endif () # Set standard of top level project or C++17 if (NOT DEFINED CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 17) - add_definitions(-Wall -Wextra -Wpedantic -Werror -Wno-unknown-pragmas) + if (ENABLE_COVERAGE) # Do not enable -Werror for coverage builds + add_definitions(-Wall -Wextra -Wpedantic -Wno-unknown-pragmas) + else () + add_definitions(-Wall -Wextra -Wpedantic -Werror -Wno-unknown-pragmas) + endif () else () set(CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD}) endif ()