doctest

FORK: The fastest feature-rich C++11/14/17/20 single-header testing framework
git clone https://git.neptards.moe/neptards/doctest.git
Log | Files | Refs | README

main.yml (8264B)


      1 name: CI
      2 
      3 on:
      4   push:
      5     paths-ignore:
      6       - 'doc/**'
      7       - 'scripts/**'
      8       - 'LICENSE.txt'
      9       - 'README.md'
     10   pull_request:
     11     paths-ignore:
     12       - 'doc/**'
     13       - 'scripts/**'
     14       - 'LICENSE.txt'
     15       - 'README.md'
     16 
     17 env:
     18   CTEST_OUTPUT_ON_FAILURE: ON
     19   CTEST_PARALLEL_LEVEL: 2
     20 
     21 jobs:
     22   coverage:
     23     runs-on: ubuntu-latest
     24 
     25     steps:
     26       - uses: actions/checkout@v2
     27 
     28       - name: Install
     29         run: sudo apt-get install -y ninja-build lcov
     30 
     31       - name: Generate
     32         run: cmake -B build -S . -G Ninja -D CMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage"
     33 
     34       - name: Build
     35         run: cmake --build build
     36 
     37       - name: Test
     38         run: ctest --test-dir build --no-tests=error
     39 
     40       - name: LCOV
     41         run: |
     42           mkdir coverage
     43           lcov -c -d build/ -o coverage/lcov.info --include "*doctest/parts*"
     44 
     45       - name: Codecov
     46         uses: codecov/codecov-action@v2
     47         with:
     48           files: ./coverage/lcov.info
     49           fail_ci_if_error: true
     50 
     51   clang-tidy:
     52     if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
     53     runs-on: ubuntu-22.04
     54 
     55     steps:
     56       - uses: actions/checkout@v2
     57 
     58       - name: Install
     59         run: sudo apt-get install -y ninja-build clang-tidy-14
     60 
     61       - name: Generate
     62         run: cmake -B build -S . -G Ninja -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_EXPORT_COMPILE_COMMANDS=ON -D CMAKE_CXX_CLANG_TIDY="clang-tidy-14;-warnings-as-errors=*"
     63 
     64       - name: Build
     65         run: cmake --build build
     66 
     67   ci:
     68     if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
     69     runs-on: ${{ matrix.os }}
     70 
     71     env:
     72       CMAKE_GENERATOR: Ninja
     73       ASAN_OPTIONS: strict_string_checks=true:detect_odr_violation=2:detect_stack_use_after_return=true:check_initialization_order=true:strict_init_order=true
     74       TSAN_OPTIONS: force_seq_cst_atomics=1
     75 
     76     strategy:
     77       fail-fast: false
     78       matrix:
     79         os: ["windows-2019", "windows-2022"]
     80         compiler: ["cl", "clang", "clang-cl"]
     81 
     82         include:
     83           - os: ubuntu-18.04
     84             compiler: gcc
     85             version: "4.8"
     86 
     87           - os: ubuntu-18.04
     88             compiler: gcc
     89             version: "4.9"
     90 
     91           - os: ubuntu-18.04
     92             compiler: gcc
     93             version: "5"
     94 
     95           - os: ubuntu-18.04
     96             compiler: gcc
     97             version: "6"
     98 
     99           - os: ubuntu-18.04
    100             compiler: gcc
    101             version: "7"
    102 
    103           - os: ubuntu-18.04
    104             compiler: gcc
    105             version: "8"
    106 
    107           - os: ubuntu-latest
    108             compiler: gcc
    109             version: "9"
    110 
    111           - os: ubuntu-latest
    112             compiler: gcc
    113             version: "10"
    114 
    115           - os: ubuntu-latest
    116             compiler: gcc
    117             version: "11"
    118 
    119           - os: ubuntu-18.04
    120             compiler: clang
    121             version: "3.5"
    122 
    123           - os: ubuntu-18.04
    124             compiler: clang
    125             version: "3.6"
    126 
    127           - os: ubuntu-18.04
    128             compiler: clang
    129             version: "3.7"
    130 
    131           - os: ubuntu-18.04
    132             compiler: clang
    133             version: "3.8"
    134 
    135           - os: ubuntu-18.04
    136             compiler: clang
    137             version: "3.9"
    138 
    139           - os: ubuntu-18.04
    140             compiler: clang
    141             version: "4.0"
    142 
    143           - os: ubuntu-18.04
    144             compiler: clang
    145             version: "5.0"
    146 
    147           - os: ubuntu-18.04
    148             compiler: clang
    149             version: "6.0"
    150 
    151           - os: ubuntu-18.04
    152             compiler: clang
    153             version: "7"
    154 
    155           - os: ubuntu-18.04
    156             compiler: clang
    157             version: "8"
    158 
    159           - os: ubuntu-latest
    160             compiler: clang
    161             version: "9"
    162 
    163           - os: ubuntu-latest
    164             compiler: clang
    165             version: "10"
    166 
    167           - os: ubuntu-latest
    168             compiler: clang
    169             version: "11"
    170 
    171           - os: ubuntu-latest
    172             compiler: clang
    173             version: "12"
    174 
    175           - os: ubuntu-latest
    176             compiler: clang
    177             version: "13"
    178 
    179           - os: macOS-10.15
    180             compiler: xcode
    181             version: "10.3"
    182 
    183           - os: macOS-latest
    184             compiler: xcode
    185             version: "11.7"
    186 
    187           - os: macOS-latest
    188             compiler: xcode
    189             version: "12.5.1"
    190 
    191           - os: macOS-latest
    192             compiler: xcode
    193             version: "13.2.1"
    194 
    195           - os: macOS-latest
    196             compiler: gcc
    197             version: "11"
    198 
    199     steps:
    200       - uses: actions/checkout@v2
    201 
    202       - name: Install (Linux)
    203         if: runner.os == 'Linux'
    204         run: |
    205           # Required for libc6-dbg:i386 and g++-multilib packages which are
    206           # needed for x86 builds.
    207           sudo dpkg --add-architecture i386
    208 
    209           # clang-3.7 and earlier are not available in Bionic anymore so we get
    210           # them from the Xenial repositories instead.
    211           sudo add-apt-repository "deb http://dk.archive.ubuntu.com/ubuntu/ xenial main"
    212           sudo add-apt-repository "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe"
    213 
    214           # clang->=13 is not currently available by default
    215           if [ "${{ matrix.compiler }}" = "clang" -a ${{ matrix.version }} -ge 13  ]; then
    216             wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
    217             sudo add-apt-repository "deb https://apt.llvm.org/focal/ llvm-toolchain-focal-${{ matrix.version }} main"
    218           fi
    219 
    220           sudo apt-get update
    221 
    222           # libc6-dbg:i386 is required for running valgrind on x86.
    223           sudo apt-get install -y ninja-build valgrind libc6-dbg:i386
    224 
    225           if [ "${{ matrix.compiler }}" = "gcc" ]; then
    226             sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib
    227           else
    228             sudo apt-get install -y clang-${{ matrix.version }} g++-multilib
    229           fi
    230 
    231       - name: Install (macOS)
    232         if: runner.os == 'macOS'
    233         run: |
    234             brew install ninja
    235             if [ "${{ matrix.compiler }}" = "xcode" ]; then
    236               sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app
    237             fi
    238 
    239       - name: Configure x64
    240         uses: ilammy/msvc-dev-cmd@v1
    241 
    242       - name: Build & Test x64
    243         run: python3 .github/workflows/build_and_test.py ${{ runner.os }} x64 ${{ matrix.compiler }} ${{ matrix.version }}
    244 
    245       - name: Configure x86
    246         uses: ilammy/msvc-dev-cmd@v1
    247         with:
    248           arch: x86
    249 
    250       # MacOS doesn't support x86 from Xcode 10 onwards.
    251 
    252       - name: Build & Test x86
    253         if: runner.os == 'Linux' || runner.os == 'Windows' && matrix.compiler != 'clang-cl'
    254         run: python3 .github/workflows/build_and_test.py ${{ runner.os }} x86 ${{ matrix.compiler }} ${{ matrix.version }}
    255 
    256   ci-min-gw:
    257     if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
    258     runs-on: windows-latest
    259 
    260     strategy:
    261       fail-fast: false
    262       matrix:
    263         configuration: ["Debug", "Release"]
    264 
    265     steps:
    266       - uses: actions/checkout@v2
    267 
    268       - name: Set up MinGW
    269         uses: egor-tensin/setup-mingw@v2
    270 
    271       - name: Generate
    272         run: cmake -B build -S . -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE=${{ matrix.configuration }}
    273 
    274       - name: Build
    275         run: cmake --build build
    276 
    277       - name: Test
    278         run: ctest --test-dir build --no-tests=error
    279 
    280   ci-msvs:
    281     if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
    282     runs-on: ${{ matrix.toolset == 'v143' && 'windows-2022' || 'windows-2019' }}
    283 
    284     strategy:
    285       fail-fast: false
    286       matrix:
    287         toolset: ["v140", "v141", "v142", "v143", "ClangCl"]
    288         architecture: ["Win32", "x64"]
    289         configuration: ["Debug", "Release"]
    290 
    291     steps:
    292       - uses: actions/checkout@v2
    293 
    294       - name: Generate
    295         run: cmake -B build -S . -G "${{ matrix.toolset == 'v143' && 'Visual Studio 17 2022' || 'Visual Studio 16 2019' }}" \
    296             -A ${{ matrix.architecture }} -T ${{ matrix.toolset }}
    297 
    298       - name: Build
    299         run: cmake --build build --config ${{ matrix.configuration }}
    300 
    301       - name: Test
    302         run: ctest -C ${{ matrix.configuration }} --test-dir build --no-tests=error