decorator example #187
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: std_e C/C++ CI | |
on: | |
push: | |
#branches: [ master ] | |
pull_request: | |
#branches: [ master ] | |
jobs: | |
ci: | |
name: ${{ matrix.name }} | |
runs-on: ubuntu-latest | |
env: | |
CMAKE_GENERATOR: Unix Makefiles | |
ASAN_OPTIONS: strict_string_checks=true:detect_odr_violation=2:detect_stack_use_after_return=true:check_initialization_order=true:strict_init_order=true | |
TSAN_OPTIONS: force_seq_cst_atomics=1 | |
CTEST_OUTPUT_ON_FAILURE: ON | |
CTEST_PARALLEL_LEVEL: 1 | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true # because of the set-env calls | |
strategy: | |
fail-fast: false | |
matrix: | |
# Github Actions requires a single row to be added to the build matrix. | |
# See https://help.github.com/en/articles/workflow-syntax-for-github-actions. | |
name: [ | |
gcc-8, | |
gcc-10, | |
gcc-11, | |
gcc-13, | |
#clang-8, | |
#clang-10, | |
] | |
include: | |
- name: gcc-8 | |
compiler: gcc | |
version: "8" | |
- name: gcc-10 | |
compiler: gcc | |
version: "10" | |
- name: gcc-11 | |
compiler: gcc | |
version: "11" | |
- name: gcc-13 | |
compiler: gcc | |
version: "13" | |
#- name: clang-8 | |
# compiler: clang | |
# version: "8" | |
#- name: clang-10 | |
# compiler: clang | |
# version: "10" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Install (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
## CMake 3.15 allows specifying the generator using the CMAKE_GENERATOR | |
## environment variable. | |
#curl -sSL https://github.com/Kitware/CMake/releases/download/v3.15.4/cmake-3.15.4-Linux-x86_64.tar.gz -o cmake.tar.gz | |
#sudo tar xf cmake.tar.gz --strip 1 -C /usr/local | |
sudo apt-get update | |
if [ "${{ matrix.compiler }}" = "gcc" ]; then | |
sudo apt-get install -y g++-${{ matrix.version }} | |
echo "::set-env name=CC::gcc-${{ matrix.version }}" | |
echo "::set-env name=CXX::g++-${{ matrix.version }}" | |
else | |
sudo apt-get install -y clang-${{ matrix.version }} | |
echo "::set-env name=CC::clang-${{ matrix.version }}" | |
echo "::set-env name=CXX::clang++-${{ matrix.version }}" | |
fi | |
#sudo apt-get install lcov | |
#sudo apt-get install -y ninja-build valgrind | |
#- name: Configure ASAN/UBSAN | |
# if: runner.os == 'Linux' || runner.os == 'macOS' | |
# run: | | |
# # https://stackoverflow.com/a/37939589/11900641 | |
# function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } | |
# # Disable sanitizers in configurations where we know they are buggy. | |
# # TODO: Move these conditions to the if clause if Github Actions ever | |
# # adds support for comparing versions. | |
# # See: https://github.community/t5/GitHub-Actions/Allow-comparing-versions-in-if-conditions/m-p/33912#M1710 | |
# if [ "${{ runner.os }}" = "Linux" ] && \ | |
# [ "${{ matrix.compiler }}" = "gcc" ] && \ | |
# [ $(version ${{ matrix.version }}) -le $(version "5.0") ]; then | |
# exit 0 | |
# fi | |
# if [ "${{ runner.os }}" = "Linux" ] && \ | |
# [ "${{ matrix.compiler }}" = "clang" ] && \ | |
# [ $(version ${{ matrix.version }}) -le $(version "6.0") ]; then | |
# exit 0 | |
# fi | |
# if [ "${{ runner.os }}" = "macOS" ] && \ | |
# [ "${{ matrix.compiler }}" = "xcode" ] && \ | |
# [ $(version ${{ matrix.version }}) -le $(version "9.4.1") ]; then | |
# exit 0 | |
# fi | |
# if [ "${{ runner.os }}" = "macOS" ] && \ | |
# [ "${{ matrix.compiler }}" = "gcc" ]; then | |
# exit 0 | |
# fi | |
# ASAN_UBSAN_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" | |
# # Link statically against ASAN libraries because dynamically linking | |
# # against ASAN libraries causes problems when using dlopen on Ubuntu. | |
# # See: https://github.com/DaanDeMeyer/doctest/runs/249002713 | |
# if [ "${{ runner.os }}" = "Linux" ] && [ "${{ matrix.compiler }}" = "gcc" ]; then | |
# ASAN_UBSAN_FLAGS="$ASAN_UBSAN_FLAGS -static-libasan" | |
# fi | |
# # Compiling in bash on Windows doesn't work and powershell doesn't | |
# # exit on non-zero exit codes so we're forced to use cmd which means | |
# # we don't have a cross platform way to access environment variables. | |
# # To circumvent this, we put the sanitizer flags in an environment | |
# # variable that is automatically picked up by CMake. | |
# echo "::set-env name=CXXFLAGS::$ASAN_UBSAN_FLAGS" | |
#- name: Configure TSAN | |
# if: runner.os == 'Linux' || runner.os == 'macOS' | |
# run: | | |
# # https://stackoverflow.com/a/37939589/11900641 | |
# function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } | |
# if [ "${{ runner.os }}" = "Linux" ] && \ | |
# [ "${{ matrix.compiler }}" = "gcc" ] && \ | |
# [ $(version ${{ matrix.version }}) -le $(version "6.0") ]; then | |
# exit 0 | |
# fi | |
# if [ "${{ runner.os }}" = "Linux" ] && \ | |
# [ "${{ matrix.compiler }}" = "clang" ] && \ | |
# [ $(version ${{ matrix.version }}) -le $(version "3.9") ]; then | |
# exit 0 | |
# fi | |
# if [ "${{ runner.os }}" = "macOS" ] && \ | |
# [ "${{ matrix.compiler }}" = "gcc" ]; then | |
# exit 0 | |
# fi | |
# TSAN_FLAGS="-fsanitize=thread -pie -fPIE" | |
# if [ "${{ runner.os }}" = "Linux" ] && [ "${{ matrix.compiler }}" = "gcc" ]; then | |
# TSAN_FLAGS="$TSAN_FLAGS -static-libtsan" | |
# fi | |
# # The thread sanitizers build does not run on Windows so we can just | |
# # use bash syntax to access the TSAN flags in the thread sanitizers | |
# # build step. | |
# echo "::set-env name=TSAN_FLAGS::$TSAN_FLAGS" | |
- name: Build & Test Debug x64 | |
run: | | |
cmake -E remove_directory build | |
cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=17 | |
cmake --build build | |
cd build | |
ctest | |
- name: Build & Test Release x64 | |
run: | | |
cmake -E remove_directory build | |
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 | |
cmake --build build | |
cd build | |
ctest | |
- name: Build & Test Release x64 - C++20 | |
if: matrix.compiler != 'gcc' || matrix.version != '8' | |
run: | | |
cmake -E remove_directory build | |
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=20 | |
cmake --build build | |
cd build | |
ctest | |
#- name: Build & Test Debug x64 Thread Sanitizers | |
# if: runner.os == 'Linux' || runner.os == 'macOS' | |
# run: | | |
# cmake -E remove_directory build | |
# cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS="$TSAN_FLAGS" | |
# cmake --build build | |
# cd build | |
# ctest | |
# - name: Build & Test Debug and Coverage x64 | |
# run: | | |
# cmake -E remove_directory build | |
# cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=17 -Dstd_e_ENABLE_COVERAGE=ON | |
# cmake --build build | |
# cd build | |
# ctest | |
# make std_e_coverage |