Skip to content

Commit

Permalink
Merge pull request #51 from ispras/coverage_ci
Browse files Browse the repository at this point in the history
CI coverage report
  • Loading branch information
ssmolov authored Aug 19, 2024
2 parents b43494f + 7752f98 commit 6ee7c2c
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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: |
Expand All @@ -78,3 +79,20 @@ jobs:
- name: Run tests
run: |
"${{env.BUILD_DIR}}/${{env.TESTS_EXECUTABLE}}"
- name: Gather coverage info
if: ${{ matrix.compiler == 'g++' }}
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
if: ${{ matrix.compiler == 'g++' }}
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: "${{env.COV_INFO_DIR}}"

0 comments on commit 6ee7c2c

Please sign in to comment.