Skip to content

Build and Test

Build and Test #385

Workflow file for this run

name: Build and Test
on:
push:
pull_request:
schedule:
- cron: '0 0 * * 0' # weekly
jobs:
build:
runs-on: ${{ matrix.base.os }}
strategy:
fail-fast: false
matrix:
base: [
# Qt v5.15.2
{name: 'qt-5.15.2 ubuntu', os: ubuntu-latest, build_type: Debug, qt_version: [5, 15, 2], shared_libs: 'OFF', tests: 'ON'},
{name: 'qt-5.15.2 windows', os: windows-latest, build_type: Debug, qt_version: [5, 15, 2], shared_libs: 'OFF', tests: 'ON', cmake_flags: '"-DAnyRPC_ROOT=C:/Program Files (x86)/AnyRPC" "-DGTest_ROOT=C:/Program Files (x86)/googletest-distribution"'},
{name: 'qt-5.15.2 macos', os: macos-13, build_type: Debug, qt_version: [5, 15, 2], shared_libs: 'OFF', tests: 'ON'},
# Qt v6.2.3
{name: 'qt-6.2.3 ubuntu', os: ubuntu-latest, build_type: Debug, qt_version: [6, 2, 3], shared_libs: 'OFF', tests: 'ON'},
{name: 'qt-6.2.3 windows', os: windows-latest, build_type: Debug, qt_version: [6, 2, 3], shared_libs: 'OFF', tests: 'ON', cmake_flags: '"-DAnyRPC_ROOT=C:/Program Files (x86)/AnyRPC" "-DGTest_ROOT=C:/Program Files (x86)/googletest-distribution"'},
{name: 'qt-6.2.3 macos', os: macos-latest, build_type: Debug, qt_version: [6, 2, 3], shared_libs: 'OFF', tests: 'ON'},
# Qt v6.5.0
{name: 'qt-6.5.0 ubuntu', os: ubuntu-latest, build_type: Debug, qt_version: [6, 5, 0], shared_libs: 'OFF', tests: 'ON'},
{name: 'qt-6.5.0 windows', os: windows-latest, build_type: Debug, qt_version: [6, 5, 0], shared_libs: 'OFF', tests: 'ON', cmake_flags: '"-DAnyRPC_ROOT=C:/Program Files (x86)/AnyRPC" "-DGTest_ROOT=C:/Program Files (x86)/googletest-distribution"'},
{name: 'qt-6.5.0 macos', os: macos-latest, build_type: Debug, qt_version: [6, 5, 0], shared_libs: 'OFF', tests: 'ON'},
# shared libs
{name: 'shared-libs ubuntu', os: ubuntu-latest, build_type: Debug, qt_version: [6, 2, 3], shared_libs: 'ON', tests: 'OFF'},
{name: 'shared-libs windows', os: windows-latest, build_type: Debug, qt_version: [6, 2, 3], shared_libs: 'ON', tests: 'OFF', cmake_flags: '"-DAnyRPC_ROOT=C:/Program Files (x86)/AnyRPC" "-DGTest_ROOT=C:/Program Files (x86)/googletest-distribution"'},
{name: 'shared-libs macos', os: macos-latest, build_type: Debug, qt_version: [6, 2, 3], shared_libs: 'ON', tests: 'OFF'},
# release build
{name: 'release ubuntu', os: ubuntu-latest, build_type: Release, qt_version: [6, 2, 3], shared_libs: 'OFF', tests: 'ON'},
# compilers
{name: 'clang++ ubuntu', os: ubuntu-latest, build_type: Debug, qt_version: [6, 2, 3], shared_libs: 'OFF', tests: 'ON', cmake_flags: '-DCMAKE_CXX_COMPILER=clang++', triplet: 'x64-linux'},
{name: 'g++ ubuntu', os: ubuntu-latest, build_type: Debug, qt_version: [6, 2, 3], shared_libs: 'OFF', tests: 'ON', cmake_flags: '-DCMAKE_CXX_COMPILER=g++', triplet: 'x64-linux'},
]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ join(matrix.base.qt_version, '.') }}
cache: true
- name: Install dependencies
env:
CI_BUILD_TYPE: ${{ matrix.base.build_type }}
SHARED_LIBS: ${{ matrix.base.shared_libs }}
run: sh ./ci/install-deps.sh
- name: "Configure"
run: |
mkdir build
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.base.build_type }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSPIX_BUILD_TESTS=${{ matrix.base.tests }} -DSPIX_BUILD_EXAMPLES=ON ${{ matrix.base.cmake_flags }} -DBUILD_SHARED_LIBS=${{ matrix.base.shared_libs }} -DSPIX_QT_MAJOR=${{ matrix.base.qt_version[0] }} .
- name: "Print cmake compile commands"
if: ${{ !contains(matrix.base.os, 'windows') }}
run: cat build/compile_commands.json
- name: "Build"
run: cmake --build build --config ${{ matrix.base.build_type }}
- name: "Run Tests"
run: cd build && ctest -VV -C ${{ matrix.base.build_type }} && cd ..
- name: "Install Spix (*nix)"
if: ${{ !contains(matrix.base.os, 'windows') }}
run: sudo cmake --install build --config ${{ matrix.base.build_type }}
- name: "Install Spix (win)"
if: ${{ contains(matrix.base.os, 'windows') }}
run: cmake --install build --config ${{ matrix.base.build_type }}
- name: "Build Standalone Example"
run: |
cd examples/BasicStandalone
mkdir build
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.base.build_type }} -DSPIX_QT_MAJOR=${{ matrix.base.qt_version[0] }} ${{ matrix.base.cmake_flags}} .
cmake --build build --config ${{ matrix.base.build_type }}