Skip to content

Commit

Permalink
🎨 (ci): Force color outpu for clang, gcc, googletest
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Jul 5, 2021
1 parent 0236c14 commit b58ab5a
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 13 deletions.
5 changes: 3 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# vim: set filetype=yaml:
---
HeaderFilterRegex: ""
UseColor: true

Checks: " \
-* \
, bugprone-assert-side-effect \
Expand Down Expand Up @@ -95,8 +98,6 @@ CheckOptions:
- key: readability-function-cognitive-complexity.IgnoreMacros
value: true

HeaderFilterRegex: ""

WarningsAsErrors: " \
modernize-*
"
2 changes: 2 additions & 0 deletions .github/workflows/ci-code_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ env:
CC: /usr/bin/gcc
CXX: /usr/bin/g++

CLICOLOR_FORCE: true # ninja

CCACHE_DIR: /home/runner/work/ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-cross_compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
runs-on: ubuntu-latest

env:
CLICOLOR_FORCE: true # ninja

CCACHE_DIR: /home/runner/work/ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/ci-unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ on:
- "feature/**"
- "bugfix/**"

env:
CLICOLOR_FORCE: true # ninja

CCACHE_DIR: /home/runner/work/ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6

jobs:
gcc:
name: gcc
Expand All @@ -23,10 +30,6 @@ jobs:
CC: /usr/bin/gcc
CXX: /usr/bin/g++

CCACHE_DIR: /home/runner/work/ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6

steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -108,10 +111,6 @@ jobs:
CC: /usr/bin/clang
CXX: /usr/bin/clang++

CCACHE_DIR: /home/runner/work/ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6

steps:
- uses: actions/checkout@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ set(CMAKE_C_EXTENSIONS TRUE)

# Add custom flags
add_compile_options(
-fdiagnostics-color
-fdiagnostics-color=always
$<$<COMPILE_LANGUAGE:CXX>:-Wno-register>
)

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ build_unit_tests:
run_unit_tests:
@echo ""
@echo "🏃‍♂️ Running unit tests 🧪"
@$(UNIT_TESTS_BUILD_DIR)/LekaOSUnitTestsExec --gtest_output=xml:$(UNIT_TESTS_COVERAGE_DIR)/google_test_detail.xml
@$(UNIT_TESTS_BUILD_DIR)/LekaOSUnitTestsExec --gtest_color=yes --gtest_output=xml:$(UNIT_TESTS_COVERAGE_DIR)/google_test_detail.xml

config_unit_tests: mkdir_build_unit_tests
@echo ""
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Colored output for compilation
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
message(STATUS "GCC found! Adding -fdiagnostics-color=always compile option")
add_compile_options("-fdiagnostics-color=always")
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(Apple)?Clang$")
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
message(STATUS "Clang found! Adding -fcolor-diagnostics compile option")
add_compile_options("-fcolor-diagnostics")
endif()

Expand Down

0 comments on commit b58ab5a

Please sign in to comment.