From 68946aa8f3e35e5b0bde7fb7c0aad8ee8d35293c Mon Sep 17 00:00:00 2001 From: Muxianesty Date: Mon, 19 Aug 2024 01:12:29 +0300 Subject: [PATCH 1/4] First attempt at coverage CI procedures. --- .github/workflows/main.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c67c60e..197ba4f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,6 +16,7 @@ env: MLIR_TARGETS_PATH: "lib/cmake/mlir/MLIRTargets.cmake" BUILD_DIR: "build" TESTS_EXECUTABLE: test/utest + COV_INFO_DIR: "lcoverage.dir" jobs: build-and-test: @@ -30,7 +31,7 @@ jobs: - name: Download APT dependencies run: | sudo apt update - sudo apt install build-essential clang cmake g++ gcc liblpsolve55-dev lld make ninja-build libctemplate-dev + sudo apt install build-essential clang cmake g++ gcc liblpsolve55-dev lld make ninja-build libctemplate-dev lcov - name: Download and configure CIRCT & LLVM env: @@ -63,13 +64,13 @@ jobs: '"LLVMX86AsmParser" "LLVMX86Disassembler")/' "${{env.CIRCT_DIR}}/${{env.MLIR_TARGETS_PATH}}" cd "${{github.workspace}}" - - name: Configure Utopia HLS build + - name: Configure Utopia HLS build (with coverage info) env: CIRCT_DIR: "firtool-${{env.CIRCT_VERSION}}" run: | cmake -S . -B "${{env.BUILD_DIR}}" -G Ninja -DCMAKE_CXX_COMPILER="${{matrix.compiler}}" \ -DCMAKE_PREFIX_PATH="${{github.workspace}}/${{env.DEPENDENCIES_DIR}}/${{env.CIRCT_DIR}}" \ - -DSRC_FILES="${{github.workspace}}/examples/polynomial2/polynomial2.cpp" -DBUILD_TESTS=ON + -DSRC_FILES="${{github.workspace}}/examples/polynomial2/polynomial2.cpp" -DBUILD_TESTS=ON -DCMAKE_CXX_FLAGS="--coverage" - name: Build Utopia HLS run: | @@ -78,3 +79,18 @@ jobs: - name: Run tests run: | "${{env.BUILD_DIR}}/${{env.TESTS_EXECUTABLE}}" + + - name: Gather coverage info + env: + COV_INFO_FILE: "lcoverage.info" + run: | + lcov --capture --directory "${{github.workspace}}" -o ${{env.COV_INFO_FILE}} + lcov --remove ${{env.COV_INFO_FILE}} "${{github.workspace}}/${{env.BUILD_DIR}}/*" "${{github.workspace}}/lib/*" \ + "${{github.workspace}}/${{env.DEPENDENCIES_DIR}}"-o ${{env.COV_INFO_FILE}} + genhtml "${{env.COV_INFO_FILE}}" -o "${{env.COV_INFO_DIR}}" + + - name: Archive code coverage results + uses: actions/upload-artifact@v4 + with: + name: coverage-report + path: "${{env.COV_INFO_DIR}}" From 8e829f73278c4f0756891207068db79d4843031c Mon Sep 17 00:00:00 2001 From: Muxianesty Date: Mon, 19 Aug 2024 01:22:18 +0300 Subject: [PATCH 2/4] Coverage steps now have to run only with GCC compiler selected. --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 197ba4f..d9e2ef9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -81,6 +81,7 @@ jobs: "${{env.BUILD_DIR}}/${{env.TESTS_EXECUTABLE}}" - name: Gather coverage info + if: ${{ matrix.compiler == "g++" }} env: COV_INFO_FILE: "lcoverage.info" run: | @@ -90,6 +91,7 @@ jobs: genhtml "${{env.COV_INFO_FILE}}" -o "${{env.COV_INFO_DIR}}" - name: Archive code coverage results + if: ${{ matrix.compiler == "g++" }} uses: actions/upload-artifact@v4 with: name: coverage-report From 1d5202b5e043fcf6a803cd3c1942a457f02c979b Mon Sep 17 00:00:00 2001 From: Muxianesty Date: Mon, 19 Aug 2024 01:24:33 +0300 Subject: [PATCH 3/4] Quotes fixes. --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d9e2ef9..c191be9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -81,7 +81,7 @@ jobs: "${{env.BUILD_DIR}}/${{env.TESTS_EXECUTABLE}}" - name: Gather coverage info - if: ${{ matrix.compiler == "g++" }} + if: ${{ matrix.compiler == 'g++' }} env: COV_INFO_FILE: "lcoverage.info" run: | @@ -91,7 +91,7 @@ jobs: genhtml "${{env.COV_INFO_FILE}}" -o "${{env.COV_INFO_DIR}}" - name: Archive code coverage results - if: ${{ matrix.compiler == "g++" }} + if: ${{ matrix.compiler == 'g++' }} uses: actions/upload-artifact@v4 with: name: coverage-report From 7752f98cef2b8e0e409e9485ab19d0acd7cec4ab Mon Sep 17 00:00:00 2001 From: Muxianesty Date: Mon, 19 Aug 2024 01:30:22 +0300 Subject: [PATCH 4/4] Fixed missing space. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c191be9..b7db923 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -87,7 +87,7 @@ jobs: run: | lcov --capture --directory "${{github.workspace}}" -o ${{env.COV_INFO_FILE}} lcov --remove ${{env.COV_INFO_FILE}} "${{github.workspace}}/${{env.BUILD_DIR}}/*" "${{github.workspace}}/lib/*" \ - "${{github.workspace}}/${{env.DEPENDENCIES_DIR}}"-o ${{env.COV_INFO_FILE}} + "${{github.workspace}}/${{env.DEPENDENCIES_DIR}}" -o ${{env.COV_INFO_FILE}} genhtml "${{env.COV_INFO_FILE}}" -o "${{env.COV_INFO_DIR}}" - name: Archive code coverage results