forked from boostorg/mqtt5
Run test coverage
Summary: related to T13434 - boost is installed as header only (binaries do not work with the coroutine code) - added test coverage, final results: https://app.codecov.io/github/ksimicevic/async-mqtt5/commit/d9ef85a89b9361f916c747c928fa9303a2a0df2f/tree - finally can compile coroutine code Reviewers: ivica Reviewed By: ivica Subscribers: miljen, iljazovic Differential Revision: https://repo.mireo.local/D27287
This commit is contained in:
+19
-30
@@ -28,16 +28,6 @@ jobs:
|
||||
cxxflags: ''
|
||||
ldflags: ''
|
||||
|
||||
- toolset: g++-12
|
||||
compiler: g++-12
|
||||
install: g++-12
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:22.04
|
||||
build-type: 'Release'
|
||||
cxxstd: 17
|
||||
cxxflags: ''
|
||||
ldflags: ''
|
||||
|
||||
- toolset: clang++-12
|
||||
compiler: clang++-12
|
||||
install: clang++-12
|
||||
@@ -64,14 +54,14 @@ jobs:
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:22.04
|
||||
build-type: 'Release'
|
||||
cxxstd: 17
|
||||
cxxflags: '-fdeclspec'
|
||||
cxxstd: 20
|
||||
cxxflags: ''
|
||||
ldflags: ''
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
container: ${{ matrix.container }}
|
||||
env:
|
||||
CXXFLAGS: ${{ matrix.cxxflags }} -Wall -Wextra -std=c++17
|
||||
CXXFLAGS: ${{ matrix.cxxflags }} -Wall -Wextra
|
||||
LDFLAGS: ${{ matrix.ldflags }}
|
||||
CMAKE_BUILD_PARALLEL_LEVEL: 4
|
||||
|
||||
@@ -83,33 +73,32 @@ jobs:
|
||||
if: matrix.container
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get -y install sudo wget tar cmake git openssl libssl-dev pkg-config
|
||||
apt-get -y install sudo wget tar cmake openssl libssl-dev pkg-config
|
||||
|
||||
- name: Install compiler
|
||||
run: sudo apt-get install -y ${{ matrix.install }}
|
||||
|
||||
- name: Install Boost
|
||||
uses: MarkusJx/install-boost@v2.4.4
|
||||
id: install-boost
|
||||
with:
|
||||
boost_version: 1.82.0
|
||||
platform_version: 22.04
|
||||
- name: Setup Boost
|
||||
run: |
|
||||
wget https://archives.boost.io/release/${{ env.BOOST_VERSION }}/source/boost_${{ env.BOOST_DIR_VER_NAME }}.tar.gz
|
||||
tar xzf boost_${{ env.BOOST_DIR_VER_NAME }}.tar.gz
|
||||
mkdir /usr/local/boost_${{ env.BOOST_DIR_VER_NAME }}
|
||||
mv boost_${{ env.BOOST_DIR_VER_NAME }}/boost /usr/local/boost_${{ env.BOOST_DIR_VER_NAME }}
|
||||
rm boost_${{ env.BOOST_DIR_VER_NAME }}.tar.gz
|
||||
|
||||
- name: Setup library
|
||||
run: |
|
||||
cmake -S . -B build/${{ matrix.compiler }} -DCMAKE_CXX_COMPILER="${{ matrix.compiler }}"
|
||||
sudo cmake --install build/${{ matrix.compiler }}
|
||||
env:
|
||||
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
|
||||
cmake -S . -B build -DCMAKE_CXX_COMPILER="${{ matrix.compiler }}" \
|
||||
-DBoost_INCLUDE_DIR="/usr/local/boost_${{ env.BOOST_DIR_VER_NAME }}"
|
||||
sudo cmake --install build
|
||||
|
||||
- name: Build tests
|
||||
run: |
|
||||
cmake -S test/unit -B test/unit/build/${{ matrix.compiler }} \
|
||||
cmake -S test/unit -B test/unit/build \
|
||||
-DCMAKE_CXX_COMPILER="${{ matrix.compiler }}" -DCMAKE_CXX_FLAGS="${{ env.CXXFLAGS }}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${{ env.LDFLAGS }}" -DCMAKE_BUILD_TYPE="${{ matrix.build-type }}"
|
||||
cmake --build test/unit/build/${{ matrix.compiler }}
|
||||
env:
|
||||
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
|
||||
-DCMAKE_CXX_STANDARD="${{ matrix.cxxstd }}" -DCMAKE_EXE_LINKER_FLAGS="${{ env.LDFLAGS }}" -DCMAKE_BUILD_TYPE="${{ matrix.build-type }}" \
|
||||
-DBoost_INCLUDE_DIR="/usr/local/boost_${{ env.BOOST_DIR_VER_NAME }}"
|
||||
cmake --build test/unit/build -j 4
|
||||
|
||||
- name: Run tests
|
||||
run: ./test/unit/build/${{ matrix.compiler }}/mqtt-test --log_level=test_suite
|
||||
run: ./test/unit/build/mqtt-test --log_level=test_suite
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
name: coverage
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
BOOST_VERSION: 1.82.0
|
||||
BOOST_DIR_VER_NAME: 1_82_0
|
||||
|
||||
jobs:
|
||||
posix:
|
||||
name: "coverage ${{matrix.compiler}} -std=c++${{matrix.cxxstd}}"
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- toolset: coverage
|
||||
compiler: g++-11
|
||||
install: g++-11
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:22.04
|
||||
cxxstd: 20
|
||||
cxxflags: '-g -O0 -std=c++20 --coverage -fkeep-inline-functions -fkeep-static-functions'
|
||||
ldflags: '--coverage'
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
container: ${{ matrix.container }}
|
||||
env:
|
||||
CMAKE_BUILD_PARALLEL_LEVEL: 4
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup container environment
|
||||
if: matrix.container
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get -y install sudo wget tar cmake openssl libssl-dev pkg-config lcov
|
||||
|
||||
- name: Install compiler
|
||||
run: sudo apt-get install -y ${{ matrix.install }}
|
||||
|
||||
- name: Setup Boost
|
||||
run: |
|
||||
wget https://archives.boost.io/release/${{ env.BOOST_VERSION }}/source/boost_${{ env.BOOST_DIR_VER_NAME }}.tar.gz
|
||||
tar xzf boost_${{ env.BOOST_DIR_VER_NAME }}.tar.gz
|
||||
mkdir /usr/local/boost_${{ env.BOOST_DIR_VER_NAME }}
|
||||
mv boost_${{ env.BOOST_DIR_VER_NAME }}/boost /usr/local/boost_${{ env.BOOST_DIR_VER_NAME }}
|
||||
rm boost_${{ env.BOOST_DIR_VER_NAME }}.tar.gz
|
||||
|
||||
- name: Setup library
|
||||
run: |
|
||||
cmake -S . -B build -DCMAKE_CXX_COMPILER="${{ matrix.compiler }}" \
|
||||
-DBoost_INCLUDE_DIR="/usr/local/boost_${{ env.BOOST_DIR_VER_NAME }}"
|
||||
sudo cmake --install build
|
||||
|
||||
- name: Build tests
|
||||
run: |
|
||||
cmake -S test/unit -B test/unit/build -DCMAKE_CXX_COMPILER="${{ matrix.compiler }}" -DCMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.ldflags }}" -DCMAKE_BUILD_TYPE="Coverage" \
|
||||
-DBoost_INCLUDE_DIR="/usr/local/boost_${{ env.BOOST_DIR_VER_NAME }}"
|
||||
cmake --build test/unit/build -j 4
|
||||
|
||||
- name: Run tests
|
||||
run: ./test/unit/build/mqtt-test --log_level=test_suite
|
||||
|
||||
- name: Generate Coverage Report
|
||||
run: |
|
||||
lcov --capture --output-file coverage.info --directory test/unit/build
|
||||
lcov --remove coverage.info '/usr/include/*' --output-file coverage.info
|
||||
lcov --remove coverage.info '**/test/*' --output-file coverage.info
|
||||
lcov --remove coverage.info '**/boost/*' --output-file coverage.info
|
||||
|
||||
- name: Upload coverage reports to Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
files: coverage.info
|
||||
fail_ci_if_error: true
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
Reference in New Issue
Block a user