diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc6fc79..07ac030 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,9 +12,9 @@ jobs: steps: - uses: actions/checkout@v1 - name: Build Makefile with CMake - run: cmake . + run: cmake -S . -B build - name: Build with Makefile - run: make + run: make -C build ComSquare - name: Archive production artifact uses: actions/upload-artifact@v1 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 396cc05..a583351 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,11 +22,11 @@ jobs: - name: Install Gcovr run: python -m pip install --upgrade pip gcovr - name: Build Makefile with CMake - run: cmake -DTEST=on . + run: cmake -S . -B build - name: Build with Makefile - run: make + run: make -C build unit_tests - name: Execute tests - run: ./unit_tests + run: .build/unit_tests - name: Output coverage run: gcovr -e tests/ -o coverage.xml --xml - name: Publish to CodeCov diff --git a/CMakeLists.txt b/CMakeLists.txt index 32da58f..bda854b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,16 +7,12 @@ project(ComSquare) # show compilation warnings add_compile_options(-W -Wall -Wextra -Wshadow) -if (TEST) - # make unit tests - add_executable(unit_tests sources/hello.cpp tests/hello.cpp) +# make unit tests +add_executable(unit_tests sources/hello.cpp tests/hello.cpp) - # include criterion & coverage - target_link_libraries(unit_tests criterion -lgcov) - target_compile_options(unit_tests PUBLIC -fprofile-arcs -ftest-coverage -g -O0) +# include criterion & coverage +target_link_libraries(unit_tests criterion -lgcov) +target_compile_options(unit_tests PUBLIC -fprofile-arcs -ftest-coverage) -else (TEST) - # make app - add_executable(ComSquare sources/main.cpp sources/hello.cpp) - -endif (TEST) +# make app +add_executable(ComSquare main.cpp sources/hello.cpp) diff --git a/sources/main.cpp b/main.cpp similarity index 100% rename from sources/main.cpp rename to main.cpp