Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI coverage report #51

Merged
merged 4 commits into from
Aug 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}}"