From 892f2561477960e7913b0963b0bd2768add40ff9 Mon Sep 17 00:00:00 2001 From: Douglas Cordeiro Date: Mon, 20 Feb 2023 19:58:40 -0300 Subject: [PATCH] chore: Improve CI build (#2) * chore: Improve CI build * chore: Improve CI build, fix make instruction * chore: Remove build.zip * chore: Remove build.zip * chore: Add run id to build artifact --- .github/workflows/codeql.yml | 27 +++++++++++++++++++++++++-- .gitignore | 1 + CMakeLists.txt | 4 +++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0d33fee..a87c25e 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -47,6 +47,7 @@ jobs: run: | echo "Installing dependencies" sudo apt -y install nlohmann-json3-dev lcov libgtest-dev + shell: bash - name: Build run: | @@ -54,14 +55,36 @@ jobs: rm -Rf build mkdir -p build cd build - cmake .. - make + cmake .. -DENABLE_COVERAGE=ON + make VERBOSE=1 + shell: bash - name: Testing run: | echo "Making test" cd build make test + shell: bash + + - name: Coverage + run: | + cd build + make coverage + shell: bash + + - name: Generating artifacts + run: | + mkdir -p ${{github.workspace}}/artifacts/build-${{github.run_id}} + cp -r build/coverage ${{github.workspace}}/artifacts/build-${{github.run_id}}/ + cp -r build/bin ${{github.workspace}}/artifacts/build-${{github.run_id}}/ + cp -r build/Testing ${{github.workspace}}/artifacts/build-${{github.run_id}}/ + shell: bash + + - name: Upload build artifacts + uses: actions/upload-artifact@v2 + with: + name: build-${{github.run_id}} + path: ${{github.workspace}}/artifacts/build-${{github.run_id}}/ - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 diff --git a/.gitignore b/.gitignore index d0aef54..8c2c6ea 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # Build artifacts bin/ build/ +build* # Dependency files vendor/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 7aa96bd..d33c6a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.10) project(cism) set(CPACK_PACKAGE_CONTACT "cronnosli@gmail.com") @@ -17,6 +17,8 @@ set(CPACK_DEBIAN_PACKAGE_SECTION "devel") set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") include(CPack) +option(ENABLE_COVERAGE "Set building for coverage, all optimizations will be disabled" OFF) + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON)