61 lines
2.2 KiB
YAML
61 lines
2.2 KiB
YAML
name: CMake
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
env:
|
|
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
|
BUILD_TYPE: Release
|
|
GENERATE_COVERAGE: true
|
|
LCOV_ROOT: ${{github.workspace}}/lcov
|
|
GCOV: gcov-4.8
|
|
|
|
jobs:
|
|
build:
|
|
# The CMake configure and build commands are platform agnostic and should work equally
|
|
# well on Windows or Mac. You can convert this to a matrix build if you need
|
|
# cross-platform coverage.
|
|
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Install coverage tools
|
|
run: |
|
|
mkdir -p "$LCOV_ROOT"
|
|
wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.14.orig.tar.gz --output-document="$LCOV_ROOT/lcov.tar.gz"
|
|
tar -xf "$LCOV_ROOT/lcov.tar.gz" --strip-components=1 -C "$LCOV_ROOT"
|
|
echo "$LCOV_ROOT/bin" >> $GITHUB_PATH
|
|
shell: bash
|
|
- name: Info
|
|
run: |
|
|
lcov --version
|
|
gcov --version
|
|
|
|
- name: Configure CMake
|
|
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
|
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
|
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILDER_ENABLE_PROFILING=true
|
|
|
|
- name: Build
|
|
# Build your program with the given configuration
|
|
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
|
|
|
- name: Run Unit Tests
|
|
working-directory: ${{github.workspace}}/build
|
|
run: ./test/unit-tests/unit-tests
|
|
|
|
- name: Prune external code coverage
|
|
run: rm -rf ./external/google-test/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.gcda
|
|
|
|
- name: Generate code coverage report
|
|
run: |
|
|
lcov --directory . --capture --output-file coverage.info
|
|
lcov --remove coverage.info 'test/*' '/usr/*' 'external/*' --output-file coverage.info
|
|
lcov --list coverage.info
|