diff --git a/.github/workflows/Code_Coverage.yml b/.github/workflows/Code_Coverage.yml index bf81acf86..8963cee13 100644 --- a/.github/workflows/Code_Coverage.yml +++ b/.github/workflows/Code_Coverage.yml @@ -35,24 +35,24 @@ jobs: - uses: actions/checkout@v2 - name: Configure CMake - run: cmake -B ${{github.workspace}}/build sudo apt-get install lcov gcovr + run: cmake -DTEST=ON -DCODE_COVERAGE=ON -B ${{github.workspace}}/build; sudo apt-get install lcov gcovr - name: Build # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build -j + run: cmake --build ${{github.workspace}}/build - name: run - working-directory: ${{github.workspace}}/build - run: ./test/test_exe + working-directory: ${{github.workspace}}/build/test + run: ./test_exe - name: create Report - working-directory: ${{github.workspace}}/build + working-directory: ${{github.workspace}}/build/test run: lcov --capture --directory .. --output-file coverage.info - uses: codecov/codecov-action@v3.1.3 with: #token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos - file: ./build/coverage.info # optional + file: ${{github.workspace}}/build/test/coverage.info # optional flags: unittests # optional name: codecov-umbrella # optional fail_ci_if_error: true # optional (default = false) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 507536e5a..7ff882b57 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -37,15 +37,15 @@ jobs: - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + run: cmake -DTEST=ON -B ${{github.workspace}}/build - name: Build # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j + run: cmake --build ${{github.workspace}}/build - name: Test - working-directory: ${{github.workspace}}/build + working-directory: ${{github.workspace}}/build/test # Execute tests defined by the CMake configuration. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest -C ${{env.BUILD_TYPE}} + run: ctest -C diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index cf5c09ed2..ae4f150c6 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -57,8 +57,17 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + #- name: Autobuild + # uses: github/codeql-action/autobuild@v2 + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -DTEST=ON -DEXAMPLES=ON -DBENCHMARK=ON -B ${{github.workspace}}/build + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c3610c801..472aee3e3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -58,6 +58,7 @@ if(TEST) PUBLIC ${zlib_SOURCE_DIR} ) target_link_libraries(test_exe + PUBLIC pthread PUBLIC GTest::gtest_main PUBLIC zlibstatic ) @@ -81,4 +82,5 @@ if(TEST) add_test(test_kosaraju test_exe --gtest_filter=TestKosaraju*) add_test(test_bestfirstsearch test_exe --gtest_filter=BestFirstSearch*) add_test(test_kahn test_exe --gtest_filter=Kahn*) -endif(TEST) \ No newline at end of file + add_test(test_DOT test_exe --gtest_filter=DOTTest*) +endif(TEST) diff --git a/test/DOTTest.cpp b/test/DOTTest.cpp index 11aef24ef..df65d7213 100644 --- a/test/DOTTest.cpp +++ b/test/DOTTest.cpp @@ -65,7 +65,7 @@ TEST(DOTTest, WriteToDotMixed) { TEST(DOTTest, ReadFromDotUndirected) { CXXGraph::Graph graph; - graph.readFromDotFile("..", "test_dot_undirected"); + graph.readFromDotFile("../../test", "test_dot_undirected"); // Check that the graph is undirected ASSERT_EQ(graph.isDirectedGraph(), false); @@ -87,7 +87,7 @@ TEST(DOTTest, ReadFromDotUndirected) { TEST(DOTTest, ReadFromDotUndirectedWeighted) { CXXGraph::Graph graph; - graph.readFromDotFile("..", "test_dot_weighted"); + graph.readFromDotFile("../../test", "test_dot_weighted"); // Check that the graph is undirected ASSERT_EQ(graph.isDirectedGraph(), false); @@ -117,7 +117,7 @@ TEST(DOTTest, ReadFromDotUndirectedWeighted) { TEST(DOTTest, ReadFromDotDirected) { CXXGraph::Graph graph; - graph.readFromDotFile("..", "test_dot_directed"); + graph.readFromDotFile("../../test", "test_dot_directed"); // Check that the graph is undirected ASSERT_EQ(graph.isDirectedGraph(), true);