Try to put all in one CI test file #31
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: Unix CI | |
on: [push,pull_request] | |
jobs: | |
Test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, ubuntu-latest, macos-12, windows-2022, windows-2019] | |
compiler: [llvm-13.0.0, clang++-14, gcc-11, msvc] | |
standard: [14, 17, 20, 23] | |
build_type: [Release, Debug] | |
include: | |
# Ubuntu and macOS with Ninja | |
- os: ubuntu-20.04 | |
generator: "Ninja Multi-Config" | |
- os: ubuntu-latest | |
generator: "Ninja Multi-Config" | |
- os: macos-12 | |
generator: "Ninja Multi-Config" | |
# Windows with Visual Studio | |
- os: windows-2022 | |
generator: "Visual Studio 17 2022" | |
- os: windows-2019 | |
generator: "Visual Studio 17 2022" | |
exclude: | |
# Exclude msvc on non-Windows platforms | |
- os: ubuntu-20.04 | |
compiler: msvc | |
- os: ubuntu-latest | |
compiler: msvc | |
- os: macos-12 | |
compiler: msvc | |
# Exclude gcc on Windows platforms | |
- os: windows-2022 | |
compiler: gcc-11 | |
- os: windows-2019 | |
compiler: gcc-11 | |
# Exclude gcc on mac platforms | |
- os: macos-12 | |
compiler: gcc-11 | |
# Exclude llvm on Windows platforms | |
- os: windows-2022 | |
compiler: llvm-13.0.0 | |
- os: windows-2019 | |
compiler: llvm-13.0.0 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Cpp | |
uses: aminya/setup-cpp@v1 | |
with: | |
compiler: ${{ matrix.compiler }} | |
vcvarsall: ${{ contains(matrix.os, 'windows' )}} | |
cmake: true | |
ninja: true | |
vcpkg: false | |
ccache: true | |
clangtidy: true | |
cppcheck: true | |
gcovr: true | |
opencppcoverage: true | |
- name: setup dependencies - Unix | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get -y update | |
sudo apt-get -y install -y ninja-build libboost-all-dev libasio-dev | |
- name: setup dependencies - macOS | |
if: runner.os == 'macOS' | |
run: | | |
brew install ninja boost asio | |
- name: setup dependencies - Windows | |
if: runner.os == 'Windows' | |
run: | | |
choco install ninja | |
choco install boost-msvc-14.1 | |
# # Download and extract Asio | |
curl -L -o asio.zip https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-1-18-2.zip | |
tar -xf asio.zip | |
move asio-asio-1-18-2 asio | |
- name: Configure CMake - Unix | |
if: runner.os != 'Windows' | |
run: | | |
cmake -S . -B ./build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DCMAKE_CXX_STANDARD=${{matrix.standard}} -DCLI_BuildTests=ON -DCLI_BuildExamples=ON -DCLI_UseBoostAsio=ON | |
- name: Configure CMake - Windows | |
# windows need asio library path | |
if: runner.os == 'Windows' | |
run: | | |
cmake -S . -B ./build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DCMAKE_CXX_STANDARD=${{matrix.standard}} -DCLI_BuildTests=ON -DCLI_BuildExamples=ON -DCLI_UseBoostAsio=ON -DASIO_INCLUDEDIR=${{ github.workspace }}/asio/asio/include | |
- name: Build | |
run: | | |
# cd /home/runner/work/cli/cli/build | |
# make all | |
cmake --build ./build --config ${{matrix.build_type}} | |
- name: run tests | |
# on windows test_suite throws an exception, but only on the CI environment! | |
if: runner.os != 'Windows' | |
# working-directory: ./build/test/${{matrix.build_type}} | |
working-directory: ./build | |
run: | | |
# cd /home/runner/work/cli/cli/build/test/ | |
# ./test_suite | |
ctest -C ${{matrix.build_type}} --output-on-failure |