Skip to content

Refactor code to use string_view instead of string for field and item… #258

Refactor code to use string_view instead of string for field and item…

Refactor code to use string_view instead of string for field and item… #258

Workflow file for this run

name: CMake
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build_type: [Debug, Release]
env:
BUILD_TYPE: ${{ matrix.build_type }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
if: matrix.build_type == 'Debug' && matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y lcov valgrind
- name: Configure CMake (Debug)
if: matrix.build_type == 'Debug'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON
- name: Configure CMake
if: matrix.build_type == 'Release'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test with coverage and memory sanitizer
if: matrix.build_type == 'Debug' && matrix.os == 'ubuntu-latest'
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure -T Test -T Coverage -T MemCheck
- name: Upload coverage reports to Codecov
if: matrix.build_type == 'Debug' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Test without coverage and memory sanitizer
if: matrix.build_type == 'Release' || matrix.os != 'ubuntu-latest'
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure -T Test
- name: Make coverage report
if: matrix.build_type == 'Debug' && matrix.os == 'ubuntu-latest'
run: |
lcov --capture --directory ${{github.workspace}}/build --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
lcov --list coverage.info