Skip to content

Commit

Permalink
Update CI/CD (#296)
Browse files Browse the repository at this point in the history
* Update Code_Coverage.yml

* Retry

* Update codeql.yml

* Update cmake.yml

* Update codeql.yml

* Update cmake.yml

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* updated CI

* Updated Code Coverage and CodeQL
  • Loading branch information
ZigRazor authored May 16, 2023
1 parent ffeae86 commit 8fe01ef
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/Code_Coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 4 additions & 4 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

13 changes: 11 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ if(TEST)
PUBLIC ${zlib_SOURCE_DIR}
)
target_link_libraries(test_exe
PUBLIC pthread
PUBLIC GTest::gtest_main
PUBLIC zlibstatic
)
Expand All @@ -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)
add_test(test_DOT test_exe --gtest_filter=DOTTest*)
endif(TEST)
6 changes: 3 additions & 3 deletions test/DOTTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ TEST(DOTTest, WriteToDotMixed) {

TEST(DOTTest, ReadFromDotUndirected) {
CXXGraph::Graph<int> graph;
graph.readFromDotFile("..", "test_dot_undirected");
graph.readFromDotFile("../../test", "test_dot_undirected");

// Check that the graph is undirected
ASSERT_EQ(graph.isDirectedGraph(), false);
Expand All @@ -87,7 +87,7 @@ TEST(DOTTest, ReadFromDotUndirected) {

TEST(DOTTest, ReadFromDotUndirectedWeighted) {
CXXGraph::Graph<int> graph;
graph.readFromDotFile("..", "test_dot_weighted");
graph.readFromDotFile("../../test", "test_dot_weighted");

// Check that the graph is undirected
ASSERT_EQ(graph.isDirectedGraph(), false);
Expand Down Expand Up @@ -117,7 +117,7 @@ TEST(DOTTest, ReadFromDotUndirectedWeighted) {

TEST(DOTTest, ReadFromDotDirected) {
CXXGraph::Graph<int> graph;
graph.readFromDotFile("..", "test_dot_directed");
graph.readFromDotFile("../../test", "test_dot_directed");

// Check that the graph is undirected
ASSERT_EQ(graph.isDirectedGraph(), true);
Expand Down

0 comments on commit 8fe01ef

Please sign in to comment.