From 7fef0dfaaa5c309bab4254b8f324e2f34aec76ea Mon Sep 17 00:00:00 2001 From: Moritz Wirger Date: Wed, 12 Feb 2025 20:43:07 +0100 Subject: [PATCH 01/13] Add build workflow --- .github/workflows/build.yml | 69 +++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..af9a53c4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,69 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + +jobs: + build: + runs-on: ubuntu-18.04 + + env: + LINUX_DIST: bionic + DEPS_DIR: ${{ github.workspace }}/deps + COMPILER_NAME: gcc + CXX: g++ + CC: gcc + RUN_TESTS: true + COVERAGE: false + # PATH: ${{ github.workspace }}/deps/cmake/bin:${{ env.PATH }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up dependencies + run: | + sudo apt-get update -qq + sudo apt-get install -y python-yaml doxygen graphviz + + - name: Install CodeCov and LCOV + run: | + sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-7 90 + wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.13.orig.tar.gz + tar xf lcov_1.13.orig.tar.gz + make -C lcov-1.13 "PREFIX=${HOME}/.local" install + echo "${HOME}/.local/bin" >> $GITHUB_PATH + + - name: Show tool versions + run: | + echo $PATH + echo $CXX + $CXX --version + $CXX -v + cmake --version + lcov --version + + - name: Build project + run: | + mkdir -p build + cd build + cmake .. -Dhueplusplus_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -Dhueplusplus_EXAMPLES=ON + make hueplusplus_examples hueplusplus_snippets + make coveragetest + cd .. + doxygen Doxyfile + touch doc/html/.nojekyll + + - name: Upload coverage to Codecov + run: | + bash <(curl -s https://codecov.io/bash) + + - name: Deploy documentation to GitHub Pages + if: github.ref == 'refs/heads/master' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GH_REPO_TOKEN }} + publish_dir: ./doc/html From 45d36a4237a30cb903d4c7f0f7d835ab77630308 Mon Sep 17 00:00:00 2001 From: Moritz Wirger Date: Wed, 12 Feb 2025 20:46:22 +0100 Subject: [PATCH 02/13] Switch to latest ubuntu version --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af9a53c4..6305e9ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-24.04 env: LINUX_DIST: bionic From 9047e5ab8788784e2396e8d598dc6d4e7808751e Mon Sep 17 00:00:00 2001 From: Moritz Wirger Date: Wed, 12 Feb 2025 20:47:45 +0100 Subject: [PATCH 03/13] Switch to python3-yaml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6305e9ee..8eb05e76 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,7 @@ jobs: - name: Set up dependencies run: | sudo apt-get update -qq - sudo apt-get install -y python-yaml doxygen graphviz + sudo apt-get install -y python3-yaml doxygen graphviz - name: Install CodeCov and LCOV run: | From ea4ebd30c3d41e004210b3b64585077dd4198187 Mon Sep 17 00:00:00 2001 From: Moritz Wirger Date: Wed, 12 Feb 2025 20:51:04 +0100 Subject: [PATCH 04/13] Upgrade to latest gcov and lcov --- .github/workflows/build.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8eb05e76..54400101 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,15 +27,15 @@ jobs: - name: Set up dependencies run: | sudo apt-get update -qq - sudo apt-get install -y python3-yaml doxygen graphviz + sudo apt-get install -y gcc g++ lcov doxygen graphviz python3-yaml - - name: Install CodeCov and LCOV - run: | - sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-7 90 - wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.13.orig.tar.gz - tar xf lcov_1.13.orig.tar.gz - make -C lcov-1.13 "PREFIX=${HOME}/.local" install - echo "${HOME}/.local/bin" >> $GITHUB_PATH + # - name: Install CodeCov and LCOV + # run: | + # sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-7 90 + # wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.13.orig.tar.gz + # tar xf lcov_1.13.orig.tar.gz + # make -C lcov-1.13 "PREFIX=${HOME}/.local" install + # echo "${HOME}/.local/bin" >> $GITHUB_PATH - name: Show tool versions run: | @@ -45,6 +45,7 @@ jobs: $CXX -v cmake --version lcov --version + gcov --version - name: Build project run: | From 400bc101d76e6f16c66b9fba8887d1e5689b82bd Mon Sep 17 00:00:00 2001 From: Moritz Wirger Date: Wed, 12 Feb 2025 20:59:13 +0100 Subject: [PATCH 05/13] Fix test cmake not including nlohmann json --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a003b3f3..9ee717c2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -103,7 +103,7 @@ if(LCOV_PATH AND GCOV_PATH) set_property(TARGET testcov_HuePlusPlus PROPERTY CXX_EXTENSIONS OFF) target_link_libraries(testcov_HuePlusPlus PRIVATE mbedtls) - target_link_libraries(testcov_HuePlusPlus PUBLIC gtest gmock) + target_link_libraries(testcov_HuePlusPlus PUBLIC nlohmann_json::nlohmann_json gtest gmock) target_include_directories(testcov_HuePlusPlus PUBLIC ${GTest_INCLUDE_DIRS}) # this will be already done by APPEND_COVERAGE_COMPILER_FLAGS() #set_target_properties( From 0687add053d992126fe5c3ad6d144c60ef5e4201 Mon Sep 17 00:00:00 2001 From: Moritz Wirger Date: Wed, 12 Feb 2025 21:09:21 +0100 Subject: [PATCH 06/13] Install latest lcov version to fix it --- .github/workflows/build.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 54400101..2afe65c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,15 +27,14 @@ jobs: - name: Set up dependencies run: | sudo apt-get update -qq - sudo apt-get install -y gcc g++ lcov doxygen graphviz python3-yaml + sudo apt-get install -y gcc g++ doxygen graphviz python3-yaml - # - name: Install CodeCov and LCOV - # run: | - # sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-7 90 - # wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.13.orig.tar.gz - # tar xf lcov_1.13.orig.tar.gz - # make -C lcov-1.13 "PREFIX=${HOME}/.local" install - # echo "${HOME}/.local/bin" >> $GITHUB_PATH + - name: Install CodeCov and LCOV + run: | + git clone https://github.com/linux-test-project/lcov.git + cd lcov + sudo make install + cd .. - name: Show tool versions run: | From c4b6a14ac2ce53610c25d324e1b830f7fcdb5caa Mon Sep 17 00:00:00 2001 From: Moritz Wirger Date: Wed, 12 Feb 2025 21:15:12 +0100 Subject: [PATCH 07/13] Try to ignore mismatch errors --- .github/workflows/build.yml | 15 ++++++++------- test/CodeCoverage.cmake | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2afe65c4..54400101 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,14 +27,15 @@ jobs: - name: Set up dependencies run: | sudo apt-get update -qq - sudo apt-get install -y gcc g++ doxygen graphviz python3-yaml + sudo apt-get install -y gcc g++ lcov doxygen graphviz python3-yaml - - name: Install CodeCov and LCOV - run: | - git clone https://github.com/linux-test-project/lcov.git - cd lcov - sudo make install - cd .. + # - name: Install CodeCov and LCOV + # run: | + # sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-7 90 + # wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.13.orig.tar.gz + # tar xf lcov_1.13.orig.tar.gz + # make -C lcov-1.13 "PREFIX=${HOME}/.local" install + # echo "${HOME}/.local/bin" >> $GITHUB_PATH - name: Show tool versions run: | diff --git a/test/CodeCoverage.cmake b/test/CodeCoverage.cmake index 8971d78c..fdd20419 100644 --- a/test/CodeCoverage.cmake +++ b/test/CodeCoverage.cmake @@ -157,7 +157,7 @@ function(SETUP_TARGET_FOR_COVERAGE) COMMAND ${Coverage_EXECUTABLE} # Capturing lcov counters and generating report - COMMAND ${LCOV_PATH} --directory . --capture --output-file ${Coverage_NAME}.info + COMMAND ${LCOV_PATH} --directory . --capture --output-file ${Coverage_NAME}.info --ignore-errors mismatch COMMAND ${LCOV_PATH} --remove ${Coverage_NAME}.info ${COVERAGE_EXCLUDES} --output-file ${Coverage_NAME}.info.cleaned COMMAND ${GENHTML_PATH} -o ${Coverage_NAME} ${Coverage_NAME}.info.cleaned COMMAND ${CMAKE_COMMAND} -E remove ${Coverage_NAME}.info ${Coverage_NAME}.info.cleaned From e9376aa867edf344dee776b79ba4f4eb10440385 Mon Sep 17 00:00:00 2001 From: Moritz Wirger Date: Wed, 12 Feb 2025 21:22:22 +0100 Subject: [PATCH 08/13] Ignore unused exclude patterns --- test/CodeCoverage.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CodeCoverage.cmake b/test/CodeCoverage.cmake index fdd20419..11de9b8a 100644 --- a/test/CodeCoverage.cmake +++ b/test/CodeCoverage.cmake @@ -157,7 +157,7 @@ function(SETUP_TARGET_FOR_COVERAGE) COMMAND ${Coverage_EXECUTABLE} # Capturing lcov counters and generating report - COMMAND ${LCOV_PATH} --directory . --capture --output-file ${Coverage_NAME}.info --ignore-errors mismatch + COMMAND ${LCOV_PATH} --directory . --capture --output-file ${Coverage_NAME}.info --ignore-errors mismatch unused COMMAND ${LCOV_PATH} --remove ${Coverage_NAME}.info ${COVERAGE_EXCLUDES} --output-file ${Coverage_NAME}.info.cleaned COMMAND ${GENHTML_PATH} -o ${Coverage_NAME} ${Coverage_NAME}.info.cleaned COMMAND ${CMAKE_COMMAND} -E remove ${Coverage_NAME}.info ${Coverage_NAME}.info.cleaned From 9dc5fd1411b7e0bf441c3d26be4b59928336a2fe Mon Sep 17 00:00:00 2001 From: Moritz Wirger Date: Wed, 12 Feb 2025 21:28:51 +0100 Subject: [PATCH 09/13] Fix missing ignore errors --- test/CodeCoverage.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CodeCoverage.cmake b/test/CodeCoverage.cmake index 11de9b8a..2ac38484 100644 --- a/test/CodeCoverage.cmake +++ b/test/CodeCoverage.cmake @@ -157,7 +157,7 @@ function(SETUP_TARGET_FOR_COVERAGE) COMMAND ${Coverage_EXECUTABLE} # Capturing lcov counters and generating report - COMMAND ${LCOV_PATH} --directory . --capture --output-file ${Coverage_NAME}.info --ignore-errors mismatch unused + COMMAND ${LCOV_PATH} --directory . --capture --output-file ${Coverage_NAME}.info --ignore-errors mismatch --ignore-errors unused COMMAND ${LCOV_PATH} --remove ${Coverage_NAME}.info ${COVERAGE_EXCLUDES} --output-file ${Coverage_NAME}.info.cleaned COMMAND ${GENHTML_PATH} -o ${Coverage_NAME} ${Coverage_NAME}.info.cleaned COMMAND ${CMAKE_COMMAND} -E remove ${Coverage_NAME}.info ${Coverage_NAME}.info.cleaned From 6e94ba6b6b9ea9ecffb1826f9413164d7bdb9559 Mon Sep 17 00:00:00 2001 From: Moritz Wirger Date: Wed, 12 Feb 2025 21:36:24 +0100 Subject: [PATCH 10/13] Add ignore errors to correct command --- test/CodeCoverage.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/CodeCoverage.cmake b/test/CodeCoverage.cmake index 2ac38484..57c01953 100644 --- a/test/CodeCoverage.cmake +++ b/test/CodeCoverage.cmake @@ -157,8 +157,8 @@ function(SETUP_TARGET_FOR_COVERAGE) COMMAND ${Coverage_EXECUTABLE} # Capturing lcov counters and generating report - COMMAND ${LCOV_PATH} --directory . --capture --output-file ${Coverage_NAME}.info --ignore-errors mismatch --ignore-errors unused - COMMAND ${LCOV_PATH} --remove ${Coverage_NAME}.info ${COVERAGE_EXCLUDES} --output-file ${Coverage_NAME}.info.cleaned + COMMAND ${LCOV_PATH} --directory . --capture --output-file ${Coverage_NAME}.info --ignore-errors mismatch + COMMAND ${LCOV_PATH} --remove ${Coverage_NAME}.info ${COVERAGE_EXCLUDES} --output-file ${Coverage_NAME}.info.cleaned --ignore-errors unused COMMAND ${GENHTML_PATH} -o ${Coverage_NAME} ${Coverage_NAME}.info.cleaned COMMAND ${CMAKE_COMMAND} -E remove ${Coverage_NAME}.info ${Coverage_NAME}.info.cleaned From f1bec420c673701f38bc64448109126448ceb47d Mon Sep 17 00:00:00 2001 From: Moritz Wirger Date: Wed, 12 Feb 2025 21:55:34 +0100 Subject: [PATCH 11/13] Update Readme badges --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index eae853c0..a010f2b5 100755 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # hueplusplus A simple and easy to use library for Philips Hue Lights -| Branch | Travis CI | Codecov | LGTM +| Branch | CI | Codecov | LGTM |:-|:-|:-|:-| -| [Master](https://github.com/enwi/hueplusplus/tree/master) | [![Build Status](https://travis-ci.com/enwi/hueplusplus.svg?branch=master)](https://travis-ci.com/enwi/hueplusplus) | [![codecov](https://codecov.io/gh/enwi/hueplusplus/branch/master/graph/badge.svg)](https://codecov.io/gh/enwi/hueplusplus) | [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/enwi/hueplusplus.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/enwi/hueplusplus/context:cpp) | -| [Development](https://github.com/enwi/hueplusplus/tree/development) | [![Build Status](https://travis-ci.com/enwi/hueplusplus.svg?branch=development)](https://travis-ci.com/enwi/hueplusplus) | [![codecov](https://codecov.io/gh/enwi/hueplusplus/branch/development/graph/badge.svg)](https://codecov.io/gh/enwi/hueplusplus) | | +| [Master](https://github.com/enwi/hueplusplus/tree/master) | [![CI](https://github.com/enwi/hueplusplus/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/enwi/hueplusplus/actions/workflows/build.yml)| [![codecov](https://codecov.io/gh/enwi/hueplusplus/branch/master/graph/badge.svg)](https://codecov.io/gh/enwi/hueplusplus) | [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/enwi/hueplusplus.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/enwi/hueplusplus/context:cpp) | +| [Development](https://github.com/enwi/hueplusplus/tree/development) | [![CI](https://github.com/enwi/hueplusplus/actions/workflows/build.yml/badge.svg?branch=development)](https://github.com/enwi/hueplusplus/actions/workflows/build.yml) | [![codecov](https://codecov.io/gh/enwi/hueplusplus/branch/development/graph/badge.svg)](https://codecov.io/gh/enwi/hueplusplus) | | ## Features * find bridges with SSDP or set an ip manually From 0817755c4aa10b7f5d786b5b121ebda2d27caaab Mon Sep 17 00:00:00 2001 From: Moritz Wirger Date: Wed, 12 Feb 2025 22:16:34 +0100 Subject: [PATCH 12/13] Fix missing CODECOV_TOKEN --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 54400101..fb6660b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,6 +18,7 @@ jobs: CC: gcc RUN_TESTS: true COVERAGE: false + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # PATH: ${{ github.workspace }}/deps/cmake/bin:${{ env.PATH }} steps: @@ -66,5 +67,5 @@ jobs: if: github.ref == 'refs/heads/master' uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GH_REPO_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./doc/html From 0f31327ee9fd8049f4ed4b3fc7077b83ad0c7d13 Mon Sep 17 00:00:00 2001 From: Moritz Wirger Date: Wed, 12 Feb 2025 22:26:50 +0100 Subject: [PATCH 13/13] Run ci on dev branch --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb6660b8..60bea111 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,7 @@ on: push: branches: - master + - development pull_request: jobs: