Skip to content

Commit

Permalink
ci: change Makefile and update unit-test.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesDias committed Dec 4, 2022
1 parent a7df3c2 commit c8a910f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Configure and build
- name: Configure, build, and run Google Test
run: |
make build
make test
- name: Run Google Test
- name: Run coverage
run: |
make test
make coverage
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) # Define explicitly to use of the standard C++17 declared in the previous line
set(CMAKE_CXX_EXTENSIONS OFF) # Disabling vendor-specific extensions

option(ENABLE_COVERAGE "Enable a Code Coverage build." ON)
option(ENABLE_COVERAGE "Enable a Code Coverage build." OFF)

### CMAKE MODULES
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/)
Expand Down
22 changes: 15 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@ all: build
@echo ""
@echo "Done!"

config:
@echo "-------------------- Configure CMake ---------------------"
build:
@echo "-------------------- Configure and Build CMake -----------"
cmake -S . -B build
cmake --build build -- -j4
@echo ""

build: config
@echo "-------------------- Build CMake--------------------------"
test: build
@echo "-------------------- Run CTest ---------------------------"
cd build && pwd && ctest --verbose
@echo ""

coverage:
@echo "-------------------- Build Coverage--------------------------"
cmake -DENABLE_COVERAGE=ON -S . -B build
cmake --build build --config Debug --target coverage -j4
@echo ""

test:
@echo "-------------------- Run CTest ---------------------------"
cd build && pwd && ctest --verbose
report:
@echo "-------------------- Coverage Report ---------------------"
lcov --capture --directory build/coverage --output-file coverage.info
genhtml coverage.info --output-directory test/
@echo ""

dependency:
Expand Down

0 comments on commit c8a910f

Please sign in to comment.