Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate travis to github actions #100

Merged
merged 12 commits into from
Feb 12, 2025
Merged
71 changes: 71 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CI

on:
push:
branches:
- master
pull_request:

jobs:
build:
runs-on: ubuntu-24.04

env:
LINUX_DIST: bionic
DEPS_DIR: ${{ github.workspace }}/deps
COMPILER_NAME: gcc
CXX: g++
CC: gcc
RUN_TESTS: true
COVERAGE: false
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# 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 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: Show tool versions
run: |
echo $PATH
echo $CXX
$CXX --version
$CXX -v
cmake --version
lcov --version
gcov --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.GITHUB_TOKEN }}
publish_dir: ./doc/html
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions test/CodeCoverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
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

Expand Down