Skip to content

Nullable pointer concepts and checks (#239) #23

Nullable pointer concepts and checks (#239)

Nullable pointer concepts and checks (#239) #23

Workflow file for this run

#
# Copyright 2023 Antony Peacock
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
name: Code Coverage
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug
COMPILER_TYPE: gcc
COMPILER_VERSION: 12
STDLIB: libstdc++11
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: ${{ matrix.os }}
strategy:
matrix:
os: [ "ubuntu-latest" ]
steps:
- uses: actions/[email protected]
- name: Cache Conan data
uses: actions/[email protected]
env:
cache-name: cache-conan-data
with:
path: ${{github.workspace}}/.conan2/p
key: ${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-${{ matrix.settings.compiler.conan }}-${{ matrix.settings.compiler.version }}-${{ matrix.settings.lib }}
restore-keys: |
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-${{ matrix.settings.compiler.conan }}-${{ matrix.settings.compiler.version }}-
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-${{ matrix.settings.compiler.conan }}-
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-
# Previously GCC was installed via egor-tensin/setup-gcc@v1 but this does not install gcov with the compiler.
# By default Ubuntu has Gcov 11 installed. This worked so long as the compiler was gcc 11, but if a later gcc was
# installed then gcov could fail as it must be the same version as the compiler. By installing the compiler
# package we ensure that gcc and gcov are installed at the same time and the versions match. For more details
# see here: https://github.com/Twon/Morpheus/issues/184
- name: Install Latest GCC
shell: bash
run: |
sudo apt install -y g++-${{ env.COMPILER_VERSION }}
# We need to update symlink otherwise we end up with miss matched gcc/g++ and gcov versions.
sudo rm /usr/bin/gcc
sudo rm /usr/bin/g++
sudo rm /usr/bin/gcov
sudo ln -s /usr/bin/gcov-${{ env.COMPILER_VERSION }} /usr/bin/gcov
sudo ln -s /usr/bin/gcc-${{ env.COMPILER_VERSION }} /usr/bin/gcc
sudo ln -s /usr/bin/g++-${{ env.COMPILER_VERSION }} /usr/bin/g++
- name: Install Lcov
shell: bash
# Lcov 2.0 is missing a dependency on DateTime so manually install for now.
run: |
wget https://github.com/linux-test-project/lcov/archive/refs/tags/v2.0.tar.gz
tar -xvf v2.0.tar.gz
cd lcov-2.0
sudo make install
# Lcov 2.0 is missing a number of dependencies (DateTime and Capture::Tiny) so manually install for now.
# When this is addressed in Lcov then this should be removed.
- name: Install Missing Lcov Dependencies
shell: bash
run: |
sudo perl -MCPAN -e 'install Capture::Tiny'
sudo apt-get install libdatetime-perl
- name: Install Linux System Packages
shell: bash
run: |
sudo apt-get -y install libgl-dev
sudo apt-get -y install libopengl-dev
sudo apt-get -y install libglu1-mesa-dev
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install Python requirements
run: |
pip install -r ./requirements.txt
- name: Configure Conan
shell: bash
run: |
conan profile detect --force
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.cppstd=.*/compiler.cppstd=20/' .conan2/profiles/default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^build_type=.*/build_type=${{ env.BUILD_TYPE }}/' .conan2/profiles/default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler=.*/compiler=${{ env.COMPILER_TYPE }}/' .conan2/profiles/default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.version=.*/compiler.version=${{ env.COMPILER_VERSION }}/' .conan2/profiles/default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.libcxx=.*/compiler.libcxx=${{ env.STDLIB }}/' .conan2/profiles/default
sed -i.backup '1a mold*:build_type=Release' .conan2/profiles/default
sed -i.backup '1a onetbb*:build_type=Release' .conan2/profiles/default
sed -i.backup '1a mold*:compiler.libcxx=libstdc++11' .conan2/profiles/default
conan profile show -pr default
- name: Configure Install
working-directory: ${{github.workspace}}
shell: bash
run: |
conan install "${{github.workspace}}" --build missing -c tools.cmake.cmaketoolchain:generator=Ninja --build catch2/3.4.0
- name: Conan Preset
shell: bash
run: echo "CONAN_PRESET=conan-$(echo ${{env.BUILD_TYPE}} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- 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: |
source build/${{env.BUILD_TYPE}}/generators/conanbuild.sh
cmake --preset ${{ env.CONAN_PRESET }} -DENABLE_CODE_COVERAGE=1
- name: Build
# Build your program with the given configuration
run: |
source build/${{env.BUILD_TYPE}}/generators/conanbuild.sh
cmake --build --preset ${{ env.CONAN_PRESET }}
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --preset ${{ env.CONAN_PRESET }} --rerun-failed --output-on-failure
- name: Fastcov
# Run Fastcov target to collect coverage information.
run: cmake --build --preset ${{ env.CONAN_PRESET }} --target coverage
- name: Lcov
# Run LCov target to generate code coverage report
run: cmake --build --preset ${{ env.CONAN_PRESET }} --target coverage-lcov
- name: Cobertura
# Run Cobertura target to generate code coverage report in XML
run: cmake --build --preset ${{ env.CONAN_PRESET }} --target coverage-cobertura
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
working-directory: ${{github.workspace}}/build/${{env.BUILD_TYPE}}/coverage
gcov: true
gcov_include: ${{github.workspace}}/build/${{env.BUILD_TYPE}}/coverage/html
files: ${{github.workspace}}/build/${{env.BUILD_TYPE}}/coverage/cobertura_coverage.xml