diff --git a/.github/actions/install-apt-packages/action.yml b/.github/actions/install-apt-packages/action.yml new file mode 100644 index 00000000..9cbd5220 --- /dev/null +++ b/.github/actions/install-apt-packages/action.yml @@ -0,0 +1,23 @@ +name: 'install-apt-packages' +description: 'Install necessary apt packages' +runs: + using: "composite" + steps: + - id: install-apt-packages + run: | + sudo apt -y install \ + doxygen \ + graphviz \ + imagemagick \ + python3 \ + python3-pip \ + python3-sphinxcontrib.spelling \ + python3-venv \ + software-properties-common \ + wget \ + libasio-dev \ + libtinyxml2-dev \ + clang-tidy \ + curl \ + grep + shell: bash diff --git a/.github/actions/install-python-packages/action.yml b/.github/actions/install-python-packages/action.yml new file mode 100644 index 00000000..354d1255 --- /dev/null +++ b/.github/actions/install-python-packages/action.yml @@ -0,0 +1,20 @@ +name: 'install-python-packages' +description: 'Install necessary python packages' +runs: + using: "composite" + steps: + - id: install-python-packages + run: | + sudo pip3 install -U \ + sphinx==3.0.3 \ + doc8==0.8.0 \ + sphinx_rtd_theme==0.4.3 \ + sphinxcontrib.spelling==5.0.0 \ + sphinxcontrib-imagehelper==1.1.1 \ + colcon-common-extensions \ + colcon-mixin \ + vcstool \ + GitPython \ + setuptools \ + gcovr + shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc7f2e37..88fd3acb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,3 +98,74 @@ jobs: # . install/local_setup.sh # colcon test --packages-select is-fiware --event-handlers console_direct+ # colcon test-result + + uncrustify: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + with: + path: src/integration-service + + - name: Fetch all branches and tags + run: | + cd src/integration-service + git fetch --prune --unshallow + + - uses: ./src/integration-service/.github/actions/install-apt-packages + - uses: ./src/integration-service/.github/actions/install-python-packages + + - name: Install uncrustify + run: | + git clone https://github.com/uncrustify/uncrustify.git \ + --branch uncrustify-0.71.0 \ + --single-branch uncrustify + mkdir -p uncrustify/build + cd uncrustify/build + cmake .. + sudo cmake --build . --target install + cd ../.. + sudo rm -rf uncrustify + + - name: Clone ament_lint + run: | + git clone https://github.com/ament/ament_lint.git src/ament_lint + + - name: Build ament_uncrustify + run: colcon build --packages-up-to ament_uncrustify + + - name: Fetch uncrustify config file + run: | + curl \ + -l https://raw.githubusercontent.com/eProsima/cpp-style/master/uncrustify.cfg \ + -o uncrustify.cfg + + - name: Get difference + run: | + cd src/integration-service + echo "MODIFIED_FILES=$(git diff --name-only origin/${GITHUB_BASE_REF} origin/${GITHUB_HEAD_REF} | grep -e '\.h' -e '\.hpp' -e '\.cpp' | tr '\n' ' ')" >> $GITHUB_ENV + + - name: Check difference + run: | + cd src/integration-service + if [[ -z "${MODIFIED_FILES}" ]] + then + touch empty.hpp + echo "MODIFIED_FILES=empty.hpp" >> $GITHUB_ENV + fi + + - name: Check style + run: | + source install/local_setup.bash + cd src/integration-service + ament_uncrustify \ + -c ../../uncrustify.cfg \ + --language CPP \ + --xunit-file ../../uncrustify_results.xml \ + ${MODIFIED_FILES} + + - name: Upload uncrustify results + uses: actions/upload-artifact@v1 + with: + name: uncrustify_results + path: uncrustify_results.xml diff --git a/core/src/utils/Log.cpp b/core/src/utils/Log.cpp index 0b48421c..775d377e 100644 --- a/core/src/utils/Log.cpp +++ b/core/src/utils/Log.cpp @@ -130,9 +130,9 @@ Logger& Logger::operator <<( //============================================================================== Logger& Logger::operator <<( - std::basic_ostream >& + std::basic_ostream>& (*func)( - std::basic_ostream >&)) + std::basic_ostream>&)) { switch (_status) {