CI fixes #6
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| pull_request: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| format: | |
| name: clang-format | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Install clang-format | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install --no-install-recommends clang-format-18 | |
| - name: Check formatting | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} | |
| run: | | |
| if [[ "$BASE_SHA" =~ ^0+$ ]] || ! git cat-file -e "$BASE_SHA^{commit}"; then | |
| BASE_SHA=$(git rev-parse HEAD^) | |
| fi | |
| git clang-format-18 --binary clang-format-18 --diff \ | |
| "$BASE_SHA" HEAD --extensions hpp,cpp -- include tests examples bench | |
| ci: | |
| name: ${{ matrix.name }} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 30 | |
| env: | |
| CC: ${{ matrix.cc }} | |
| CXX: ${{ matrix.cxx }} | |
| VCPKG_DISABLE_METRICS: 1 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: GCC 13 | |
| version: 13 | |
| preset: gcc_debug_tests | |
| cc: gcc-13 | |
| cxx: g++-13 | |
| standard: c++23 | |
| stdlib: "" | |
| triplet: x64-linux | |
| debug_flags: -g | |
| libcxx: false | |
| libcxx_version: 0 | |
| - name: GCC 14 | |
| version: 14 | |
| preset: gcc_debug_tests | |
| cc: gcc-14 | |
| cxx: g++-14 | |
| standard: c++23 | |
| stdlib: "" | |
| triplet: x64-linux | |
| debug_flags: -g | |
| libcxx: false | |
| libcxx_version: 0 | |
| - name: Clang 16 | |
| version: 16 | |
| preset: clang_debug_tests | |
| cc: clang-16 | |
| cxx: clang++-16 | |
| standard: c++2b | |
| stdlib: -stdlib=libc++ | |
| triplet: x64-linux-libcxx | |
| debug_flags: -g -stdlib=libc++ | |
| libcxx: true | |
| libcxx_version: 18 | |
| - name: Clang 18 | |
| version: 18 | |
| preset: clang_debug_tests | |
| cc: clang-18 | |
| cxx: clang++-18 | |
| standard: c++23 | |
| stdlib: -stdlib=libc++ | |
| triplet: x64-linux-libcxx | |
| debug_flags: -g -stdlib=libc++ | |
| libcxx: true | |
| libcxx_version: 18 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Install libc++ | |
| if: matrix.libcxx | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install --no-install-recommends \ | |
| "libc++-${{ matrix.libcxx_version }}-dev" \ | |
| "libc++abi-${{ matrix.libcxx_version }}-dev" | |
| - name: Configure and build | |
| run: | | |
| export VCPKG_ROOT="$VCPKG_INSTALLATION_ROOT" | |
| cmake --preset ${{ matrix.preset }} \ | |
| -DCMAKE_CXX_COMPILER="$CXX" \ | |
| -DCMAKE_CXX_FLAGS_DEBUG="${{ matrix.debug_flags }}" \ | |
| -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} | |
| cmake --build build/${{ matrix.preset }} --parallel 2 | |
| - name: Check installed public headers | |
| run: | | |
| install_prefix="$PWD/build/header-install" | |
| cmake --install build/${{ matrix.preset }} --prefix "$install_prefix" | |
| dependency_includes="$PWD/build/${{ matrix.preset }}/vcpkg_installed/${{ matrix.triplet }}/include" | |
| while IFS= read -r header; do | |
| include_name=${header#"$install_prefix/include/"} | |
| printf '#include <%s>\n' "$include_name" | | |
| "$CXX" -std=${{ matrix.standard }} ${{ matrix.stdlib }} \ | |
| -I"$install_prefix/include" -I"$dependency_includes" \ | |
| -Wall -Wextra -Wpedantic -Werror \ | |
| -x c++ -fsyntax-only - | |
| done < <(find "$install_prefix/include" -type f -name '*.hpp' | sort) | |
| - name: Run unit tests | |
| run: >- | |
| ctest --test-dir build/${{ matrix.preset }} | |
| --output-on-failure --parallel 2 | |
| - name: Test installed CMake package | |
| if: matrix.name == 'GCC 14' | |
| run: | | |
| cmake --install build/${{ matrix.preset }} --prefix "$PWD/build/install" | |
| cmake -S tests/consumer -B build/consumer \ | |
| -DCMAKE_CXX_COMPILER="$CXX" \ | |
| -DCMAKE_PREFIX_PATH="$PWD/build/install" | |
| cmake --build build/consumer --parallel 2 | |
| ./build/consumer/websocketclient_consumer | |
| sanitizers: | |
| name: GCC 14 ASan + UBSan | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 30 | |
| env: | |
| CC: gcc-14 | |
| CXX: g++-14 | |
| VCPKG_DISABLE_METRICS: 1 | |
| UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Configure and build | |
| run: | | |
| export VCPKG_ROOT="$VCPKG_INSTALLATION_ROOT" | |
| cmake --preset gcc_debug_tests_san \ | |
| -DCMAKE_CXX_COMPILER="$CXX" \ | |
| -DCMAKE_CXX_FLAGS_DEBUG=-g \ | |
| -DVCPKG_TARGET_TRIPLET=x64-linux | |
| cmake --build build/gcc_debug_tests_san --parallel 2 | |
| - name: Run unit tests | |
| run: >- | |
| ctest --test-dir build/gcc_debug_tests_san | |
| --output-on-failure --parallel 2 | |
| no-exceptions: | |
| name: GCC 14 -fno-exceptions | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Compile public API without exceptions | |
| run: >- | |
| g++-14 -std=c++23 -fno-exceptions -Iinclude | |
| -Wall -Wextra -Wpedantic -Werror | |
| -fsyntax-only tests/compile/no_exceptions.cpp |