Skip to content

UT + valgrind

UT + valgrind #782

Workflow file for this run

# req: failed log available in detail
name: UT + valgrind
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '51-54 2 * * 4' # 10:51-54am(BJ) every Thu
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: install valgrind
run: sudo apt-get update && sudo apt-get install valgrind
- name: install gmock & gtest # 1)always gtest latest 2)--depth 1 is to min download
run: git clone https://github.com/google/googletest.git --depth 1 && cd googletest && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr && sudo make install -j
- uses: actions/checkout@v4
- name: make ut
run: cmake -DCOV=1 -DCMAKE_CXX_COMPILER="g++" . && make -j
- name: ut
run: SLICE=always-malloc G_DEBUG=gc-friendly valgrind -v --tool=memcheck --leak-check=full --num-callers=40 --log-file=ut/gcovr/cov.valgrind.log --error-exitcode=6 ./ut_exe --gtest_brief=1
- name: install gcovr
run: pip install gcovr
- name: ut coverage (ret=2 is fail-under-line, =4 is fail-under-branch)
run: gcovr -k --config=ut/gcovr/gcovr.cfg && ls -lR .
- uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: |
./ut/gcovr/cov.*
./*gcov
./ut/CMakeFiles/UtLib.dir/domino/*PriDom*
- uses: codecov/codecov-action@v4
if: always()
with:
file: ut/gcovr/cov.xml # optional
flags: ci_main # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}