| name: Celix Coverage |
| |
| on: [push, pull_request] |
| |
| env: |
| CONAN_USER_HOME: "${{ github.workspace }}/release/" |
| CONAN_USER_HOME_SHORT: "${{ github.workspace }}/release/short" |
| CONAN_HOME: "${{ github.workspace }}/release/" |
| CCACHE_DIR: "${{ github.workspace }}/.ccache" |
| CCACHE_SLOPPINESS: include_file_ctime,include_file_mtime |
| |
| jobs: |
| coverage: |
| runs-on: ubuntu-22.04 |
| timeout-minutes: 120 |
| steps: |
| - name: Checkout source code |
| uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3.3.0 |
| - name: Install conan and lcov |
| run: | |
| sudo apt-get install -yq --no-install-recommends lcov |
| sudo pip install -U conan coverage |
| - name: Setup Conan Profile |
| run: | |
| # build profile |
| conan profile detect -f --name release |
| sed -i 's/compiler.cppstd=gnu14/compiler.cppstd=gnu17/g' `conan profile path release` |
| echo "[tool_requires]" >> `conan profile path release` |
| echo "cmake/3.26.4" >> `conan profile path release` |
| |
| # host profile |
| conan profile detect -f |
| sed -i 's/build_type=Release/build_type=Debug/g' `conan profile path default` |
| sed -i 's/compiler.cppstd=gnu14/compiler.cppstd=gnu17/g' `conan profile path default` |
| echo "[tool_requires]" >> `conan profile path default` |
| echo "cmake/3.26.4" >> `conan profile path default` |
| - name: Conan Cache |
| id: cache-conan |
| uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf #v4.2.2 |
| env: |
| cache-name: cache-conan2-modules |
| with: |
| path: ${{ env.CONAN_HOME }} |
| key: ${{ runner.os }}-gcov-builder-${{ env.cache-name }}-${{ hashFiles('conanfile.py') }} |
| restore-keys: ${{ runner.os }}-gcov-builder-${{ env.cache-name }}- |
| - name: Prepare ccache timestamp |
| id: ccache_cache_timestamp |
| run: | |
| echo timestamp=`date +"%Y-%m-%d-%H;%M;%S"` >> $GITHUB_OUTPUT |
| - name: ccache Cache |
| uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf #v4.2.2 |
| with: |
| path: ${{ env.CCACHE_DIR }} |
| key: ${{ runner.os }}-gcov-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} |
| restore-keys: | |
| ${{ runner.os }}-gcov-ccache- |
| - name: Install Dependencies and Build |
| env: |
| CONAN_BUILD_OPTIONS: | |
| -o celix/*:enable_testing=True |
| -o celix/*:build_all=True |
| -o celix/*:enable_code_coverage=True |
| -o celix/*:enable_testing_on_ci=True |
| -o celix/*:enable_ccache=True |
| -o mosquitto/*:broker=True |
| -o *:shared=True |
| run: | |
| conan build . -pr:b release -pr:h default ${CONAN_BUILD_OPTIONS} -b missing |
| - name: Test with coverage |
| run: | |
| cd build/Debug |
| source generators/conanrun.sh |
| make coverage |
| source generators/deactivate_conanrun.sh |
| lcx="lcov --output-file=coverage.info " && for i in `find . -name "*.info.cleaned"`; do lcx+=" --add-tracefile=$i"; done && $lcx |
| - name: Codecov |
| uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c #v4.4.1 |
| if: github.repository_owner == 'apache' |
| with: |
| files: build/Debug/coverage.info |
| disable_search: true |
| name: codecov-celix |
| token: ${{ secrets.CODECOV_TOKEN }} |