From 433db6c525b0610ef44e0bd612b34c58da78da8b Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 18:21:50 +0000 Subject: [PATCH 01/17] Add multiple configurations --- .github/workflows/cxx.yml | 100 ++++++++++++++------------------------ 1 file changed, 37 insertions(+), 63 deletions(-) diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index 2ac2e49..705bbdb 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -1,7 +1,4 @@ -# Copyright © 2024 Bret Brown -# SPDX-License-Identifier: MIT - -name: Test +name: Test Multi-Platform on: push: @@ -17,67 +14,44 @@ on: - "test/**" - "CMakeLists.txt" - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - jobs: - test: - runs-on: ubuntu-latest + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: - cfg: - - { id: ubuntu-gcc-werror, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'"} - - { id: ubuntu-gcc-aubsan, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_FLAGS=-fsanitize=address -fsanitize=undefined"} - - { id: ubuntu-gcc-tsan, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_FLAGS=-fsanitize=thread"} - - { id: ubuntu-gcc-static, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: ""} - - { id: ubuntu-gcc-static-cxx98, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=on"} - - { id: ubuntu-gcc-static-cxx11, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=on"} - - { id: ubuntu-gcc-static-cxx14, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=on"} - - { id: ubuntu-gcc-static-cxx17, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=on"} - - { id: ubuntu-gcc-static-cxx20, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on"} - - { id: ubuntu-gcc-dynamic, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DBUILD_SHARED_LIBS=on"} - - { id: ubuntu-clang-static, platform: ubuntu, cc: clang, cpp: clang++, cmake_args: ""} - - { id: ubuntu-clang-dynamic, platform: ubuntu, cc: clang, cpp: clang++, cmake_args: "-DBUILD_SHARED_LIBS=on"} - # Disabling Rocky until it catches up on CMake versions or a way to sideload newer version of CMake - # is identified. - # - { id: rockylinux-gcc-static, platform: rockylinux, cc: gcc, cpp: g++, cmake_args: ""} - # - { id: rockylinux-clang-static, platform: rockylinux, cc: clang, cpp: clang++, cmake_args: ""} + include: + - { os: windows-latest, build_type: Release, c_compiler: cl, cpp_compiler: cl, cmake_args: "" } + - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'" } + - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-fsanitize=address -fsanitize=undefined'" } + - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_FLAGS='-fsanitize=thread'" } + - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=on" } + - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=on" } + - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=on" } + - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=on" } + - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on" } + - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-DBUILD_SHARED_LIBS=on" } + - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'" } + - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-fsanitize=address -fsanitize=undefined'" } + - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_FLAGS='-fsanitize=thread'" } + - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=on" } + - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=on" } + - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=on" } + - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=on" } + - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on" } + - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-DBUILD_SHARED_LIBS=on" } + - { os: macos-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "" } steps: - - uses: actions/checkout@v2 - # GitHub runners have updated the Ubuntu Linux Kernel to use strong ASLR, - # but LLVM is not configured for this change, and thus the address - # sanitizer breaks. - # - # The next image is supposed to fix this, so if the Ubuntu image has been - # updated, this work around is no longer required. - - name: get runner image version - id: runner-image-version - run: | - echo "image-version=$(echo $ImageVersion)" >> "$GITHUB_OUTPUT" - working-directory: . - - name: modify number of bits to use for ASLR entropy - if: ${{ steps.runner-image-version.outputs.ImageVersion }} == '20240310.1.0' - run: | - sudo sysctl -a | grep vm.mmap.rnd - sudo sysctl -w vm.mmap_rnd_bits=28 - working-directory: . - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - push: false - load: true - tags: ${{ matrix.cfg.id }} - file: .ci/docker/${{ matrix.cfg.platform }}.Dockerfile - build-args: | - cc=${{ matrix.cfg.cc }} - cxx=${{ matrix.cfg.cpp }} - cmake_args=${{ matrix.cfg.cmake_args }} - cache-from: type=gha - cache-to: type=gha,mode=max - - name: Run tests - run: | - docker run ${{ matrix.cfg.id }} ctest --test-dir build + - uses: actions/checkout@v3 + + - name: Configure CMake + run: cmake -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} ${{ matrix.cmake_args }} + + - name: Build + run: cmake --build + + - name: Test + run: ctest -C --output-on-failure \ No newline at end of file From adb77a50294c5ef8bacf788b42d2dcc58ba6ff35 Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 18:23:17 +0000 Subject: [PATCH 02/17] Force run CI --- .github/workflows/cxx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index 705bbdb..eab2c3d 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -54,4 +54,4 @@ jobs: run: cmake --build - name: Test - run: ctest -C --output-on-failure \ No newline at end of file + run: ctest -C --output-on-failure From 6e2fc28fe142f28beeb7dd28e4af166b365f8ed8 Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 18:36:23 +0000 Subject: [PATCH 03/17] Fix CI --- .github/workflows/cxx.yml | 101 ++++++++++++++++++++++++++++++-------- 1 file changed, 81 insertions(+), 20 deletions(-) diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index eab2c3d..254fb74 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -23,26 +23,87 @@ jobs: matrix: include: - - { os: windows-latest, build_type: Release, c_compiler: cl, cpp_compiler: cl, cmake_args: "" } - - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'" } - - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-fsanitize=address -fsanitize=undefined'" } - - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_FLAGS='-fsanitize=thread'" } - - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=on" } - - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=on" } - - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=on" } - - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=on" } - - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on" } - - { os: ubuntu-latest, c_compiler: gcc, cpp_compiler: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-DBUILD_SHARED_LIBS=on" } - - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'" } - - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-fsanitize=address -fsanitize=undefined'" } - - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_FLAGS='-fsanitize=thread'" } - - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=on" } - - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=on" } - - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=on" } - - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=on" } - - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on" } - - { os: ubuntu-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "-DCMAKE_CXX_FLAGS='-DBUILD_SHARED_LIBS=on" } - - { os: macos-latest, c_compiler: clang, cpp_compiler: clang++, cmake_args: "" } + - os: windows-latest + build_type: Release + c_compiler: cl + cpp_compiler: cl + cmake_args: "" + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'" + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + cmake_args: "-DCMAKE_CXX_FLAGS='-fsanitize=address -fsanitize=undefined'" + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_FLAGS='-fsanitize=thread'" + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=on" + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=on" + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=on" + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=on" + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on" + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + cmake_args: "-DCMAKE_CXX_FLAGS='-DBUILD_SHARED_LIBS=on" + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'" + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + cmake_args: "-DCMAKE_CXX_FLAGS='-fsanitize=address -fsanitize=undefined'" + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_FLAGS='-fsanitize=thread'" + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=on" + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=on" + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=on" + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=on" + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on" + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + cmake_args: "-DCMAKE_CXX_FLAGS='-DBUILD_SHARED_LIBS=on" + - os: macos-latest + c_compiler: clang + cpp_compiler: clang++ + cmake_args: "" steps: - uses: actions/checkout@v3 From 3164c889007f3ff6d1a637f1e2b250590bc2ebd8 Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 18:41:04 +0000 Subject: [PATCH 04/17] Remove path restrictions --- .ci/docker/rockylinux.Dockerfile | 29 ----------------------------- .ci/docker/ubuntu.Dockerfile | 28 ---------------------------- .github/workflows/cxx.yml | 8 -------- 3 files changed, 65 deletions(-) delete mode 100644 .ci/docker/rockylinux.Dockerfile delete mode 100644 .ci/docker/ubuntu.Dockerfile diff --git a/.ci/docker/rockylinux.Dockerfile b/.ci/docker/rockylinux.Dockerfile deleted file mode 100644 index 9821de2..0000000 --- a/.ci/docker/rockylinux.Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM rockylinux:9 - -# Enable EPEL -RUN dnf update -y -RUN dnf install -y 'dnf-command(config-manager)' -RUN dnf config-manager --set-enabled crb -y -RUN dnf install epel-release -y - -# Install dependencies -RUN dnf install -y \ - clang \ - g++ \ - ninja-build \ - cmake -RUN dnf clean all - -# Copy code -WORKDIR /workarea -COPY ./ ./ - -ARG cc=gcc -ARG cxx=g++ -ARG cmake_args= - -ENV CC="$cc" CXX="$cxx" CMAKE_GENERATOR="Ninja" CMAKE_EXPORT_COMPILE_COMMANDS=on -RUN cmake -B build -S . "$cmake_args" && \ - cmake --build build --verbose && \ - DESTDIR=build/staging cmake --install build --prefix /opt/example --component libexample-dev && \ - find build/staging -type f diff --git a/.ci/docker/ubuntu.Dockerfile b/.ci/docker/ubuntu.Dockerfile deleted file mode 100644 index fbfe4ed..0000000 --- a/.ci/docker/ubuntu.Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -# Using a non-LTS Ubuntu, just until CMake 3.23 is available on Ubuntu 24.04 -FROM ubuntu:23.10 - -# Install dependencies -RUN apt-get update -RUN apt-get install -y \ - clang \ - clang-tidy \ - g++ \ - ninja-build \ - cmake -RUN apt-get clean - -WORKDIR /workarea -COPY ./ ./ - -ARG cc=gcc -ARG cxx=g++ -ARG cmake_args= - -# Workaround Ubuntu broken ASan -RUN sysctl vm.mmap_rnd_bits=28 - -ENV CC="$cc" CXX="$cxx" CMAKE_GENERATOR="Ninja" CMAKE_EXPORT_COMPILE_COMMANDS=on -RUN cmake -B build -S . "$cmake_args" && \ - cmake --build build --verbose && \ - DESTDIR=build/staging cmake --install build --prefix /opt/example --component libexample-dev && \ - find build/staging -type f diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index 254fb74..41d162f 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -3,16 +3,8 @@ name: Test Multi-Platform on: push: branches: [ main ] - paths: - - "src/**" - - "test/**" - - "CMakeLists.txt" pull_request: branches: [ main ] - paths: - - "src/**" - - "test/**" - - "CMakeLists.txt" jobs: build: From faffdcc6631b90784bdbf121d3074216623150bc Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 18:42:53 +0000 Subject: [PATCH 05/17] Add . to cmake build command --- .github/workflows/cxx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index 41d162f..f9b5dba 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -104,7 +104,7 @@ jobs: run: cmake -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} ${{ matrix.cmake_args }} - name: Build - run: cmake --build + run: cmake --build . - name: Test run: ctest -C --output-on-failure From c3101c76aad395635740917c461e11e21def2f2f Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 18:45:08 +0000 Subject: [PATCH 06/17] Remove extra -DCMAKE_CXX_FLAGS --- .github/workflows/cxx.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index f9b5dba..b1d9f83 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -31,27 +31,27 @@ jobs: - os: ubuntu-latest c_compiler: gcc cpp_compiler: g++ - cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_FLAGS='-fsanitize=thread'" + cmake_args: "-DCMAKE_CXX_FLAGS='-fsanitize=thread'" - os: ubuntu-latest c_compiler: gcc cpp_compiler: g++ - cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=on" + cmake_args: "-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=on" - os: ubuntu-latest c_compiler: gcc cpp_compiler: g++ - cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=on" + cmake_args: "-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=on" - os: ubuntu-latest c_compiler: gcc cpp_compiler: g++ - cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=on" + cmake_args: "-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=on" - os: ubuntu-latest c_compiler: gcc cpp_compiler: g++ - cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=on" + cmake_args: "-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=on" - os: ubuntu-latest c_compiler: gcc cpp_compiler: g++ - cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on" + cmake_args: "-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on" - os: ubuntu-latest c_compiler: gcc cpp_compiler: g++ @@ -67,31 +67,31 @@ jobs: - os: ubuntu-latest c_compiler: clang cpp_compiler: clang++ - cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_FLAGS='-fsanitize=thread'" + cmake_args: "-DCMAKE_CXX_FLAGS='-fsanitize=thread'" - os: ubuntu-latest c_compiler: clang cpp_compiler: clang++ - cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=on" + cmake_args: "-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=on" - os: ubuntu-latest c_compiler: clang cpp_compiler: clang++ - cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=on" + cmake_args: "-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=on" - os: ubuntu-latest c_compiler: clang cpp_compiler: clang++ - cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=on" + cmake_args: "-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=on" - os: ubuntu-latest c_compiler: clang cpp_compiler: clang++ - cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=on" + cmake_args: "-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=on" - os: ubuntu-latest c_compiler: clang cpp_compiler: clang++ - cmake_args: "-DCMAKE_CXX_FLAGS='-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on" + cmake_args: "-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on" - os: ubuntu-latest c_compiler: clang cpp_compiler: clang++ - cmake_args: "-DCMAKE_CXX_FLAGS='-DBUILD_SHARED_LIBS=on" + cmake_args: "-DBUILD_SHARED_LIBS=on" - os: macos-latest c_compiler: clang cpp_compiler: clang++ From 22deef38bb6d2aadadac87e2545c70c2ec3c9ce0 Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 18:46:39 +0000 Subject: [PATCH 07/17] Remove another extra -DCMAKE_CXX_FLAGS --- .github/workflows/cxx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index b1d9f83..d62dde6 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -55,7 +55,7 @@ jobs: - os: ubuntu-latest c_compiler: gcc cpp_compiler: g++ - cmake_args: "-DCMAKE_CXX_FLAGS='-DBUILD_SHARED_LIBS=on" + cmake_args: "-DBUILD_SHARED_LIBS=on" - os: ubuntu-latest c_compiler: clang cpp_compiler: clang++ From 0553aa5e8a2f9d272edda620eec1e33f69fec023 Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 18:53:14 +0000 Subject: [PATCH 08/17] Remove --output-on-failure --- .github/workflows/cxx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index d62dde6..448b0f8 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -107,4 +107,4 @@ jobs: run: cmake --build . - name: Test - run: ctest -C --output-on-failure + run: ctest -C From 02ab26c10e5d92e14d2ab8f4814603a531738427 Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 19:02:14 +0000 Subject: [PATCH 09/17] Add . to ctest? --- .github/workflows/cxx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index 448b0f8..3f6e4a4 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -107,4 +107,4 @@ jobs: run: cmake --build . - name: Test - run: ctest -C + run: ctest -C . From a44322034b6ba5898e4491b24880d172d640eb5f Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 19:05:12 +0000 Subject: [PATCH 10/17] Add BUILD_TESTING flag --- .github/workflows/cxx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index 3f6e4a4..3f3fe92 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -101,7 +101,7 @@ jobs: - uses: actions/checkout@v3 - name: Configure CMake - run: cmake -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} ${{ matrix.cmake_args }} + run: cmake -DBUILD_TESTING -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} ${{ matrix.cmake_args }} - name: Build run: cmake --build . From 6d1f4fbaba4f5066ea178e1d27a392ceb8611d05 Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 19:06:08 +0000 Subject: [PATCH 11/17] Set to on --- .github/workflows/cxx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index 3f3fe92..b6c9500 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -101,7 +101,7 @@ jobs: - uses: actions/checkout@v3 - name: Configure CMake - run: cmake -DBUILD_TESTING -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} ${{ matrix.cmake_args }} + run: cmake -DBUILD_TESTING=on -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} ${{ matrix.cmake_args }} - name: Build run: cmake --build . From e251e568350151353b974a1c4482635a97de9758 Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 19:33:02 +0000 Subject: [PATCH 12/17] Use resets --- .github/workflows/cxx.yml | 66 +++++++++--------------- CMakePresets.json | 105 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+), 43 deletions(-) create mode 100644 CMakePresets.json diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index b6c9500..528b88f 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -17,94 +17,74 @@ jobs: include: - os: windows-latest build_type: Release - c_compiler: cl - cpp_compiler: cl cmake_args: "" + preset: msvc-debug - os: ubuntu-latest - c_compiler: gcc - cpp_compiler: g++ cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'" + preset: gcc-debug - os: ubuntu-latest - c_compiler: gcc - cpp_compiler: g++ cmake_args: "-DCMAKE_CXX_FLAGS='-fsanitize=address -fsanitize=undefined'" + preset: gcc-debug - os: ubuntu-latest - c_compiler: gcc - cpp_compiler: g++ cmake_args: "-DCMAKE_CXX_FLAGS='-fsanitize=thread'" + preset: gcc-debug - os: ubuntu-latest - c_compiler: gcc - cpp_compiler: g++ cmake_args: "-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=on" + preset: gcc-debug - os: ubuntu-latest - c_compiler: gcc - cpp_compiler: g++ cmake_args: "-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=on" + preset: gcc-debug - os: ubuntu-latest - c_compiler: gcc - cpp_compiler: g++ cmake_args: "-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=on" + preset: gcc-debug - os: ubuntu-latest - c_compiler: gcc - cpp_compiler: g++ cmake_args: "-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=on" + preset: gcc-debug - os: ubuntu-latest - c_compiler: gcc - cpp_compiler: g++ cmake_args: "-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on" + preset: gcc-debug - os: ubuntu-latest - c_compiler: gcc - cpp_compiler: g++ cmake_args: "-DBUILD_SHARED_LIBS=on" + preset: gcc-debug - os: ubuntu-latest - c_compiler: clang - cpp_compiler: clang++ cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'" + preset: clang-debug - os: ubuntu-latest - c_compiler: clang - cpp_compiler: clang++ cmake_args: "-DCMAKE_CXX_FLAGS='-fsanitize=address -fsanitize=undefined'" + preset: clang-debug - os: ubuntu-latest - c_compiler: clang - cpp_compiler: clang++ cmake_args: "-DCMAKE_CXX_FLAGS='-fsanitize=thread'" + preset: clang-debug - os: ubuntu-latest - c_compiler: clang - cpp_compiler: clang++ cmake_args: "-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=on" + preset: clang-debug - os: ubuntu-latest - c_compiler: clang - cpp_compiler: clang++ cmake_args: "-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=on" + preset: clang-debug - os: ubuntu-latest - c_compiler: clang - cpp_compiler: clang++ cmake_args: "-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=on" + preset: clang-debug - os: ubuntu-latest - c_compiler: clang - cpp_compiler: clang++ cmake_args: "-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=on" + preset: clang-debug - os: ubuntu-latest - c_compiler: clang - cpp_compiler: clang++ cmake_args: "-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on" + preset: clang-debug - os: ubuntu-latest - c_compiler: clang - cpp_compiler: clang++ cmake_args: "-DBUILD_SHARED_LIBS=on" + preset: clang-debug - os: macos-latest - c_compiler: clang - cpp_compiler: clang++ cmake_args: "" + preset: clang-debug steps: - uses: actions/checkout@v3 - name: Configure CMake - run: cmake -DBUILD_TESTING=on -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} ${{ matrix.cmake_args }} + run: cmake .. --preset ${{ matrix.preset }} -DBUILD_TESTING=on ${{ matrix.cmake_args }} - name: Build - run: cmake --build . + run: cmake --build --preset ${{ matrix.preset }} - name: Test - run: ctest -C . + run: ctest --preset ${{ matrix.preset }} diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..f1209b2 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,105 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "gcc-base", + "hidden": true, + "generator": "Unix Makefiles", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_C_COMPILER": "gcc", + "CMAKE_CXX_COMPILER": "g++", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + } + }, + { + "name": "clang-base", + "hidden": true, + "generator": "Unix Makefiles", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + } + }, + { + "name": "msvc-base", + "hidden": true, + "generator": "Visual Studio 17 2022", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_C_COMPILER": "cl", + "CMAKE_CXX_COMPILER": "cl", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + } + }, + { + "name": "gcc-debug", + "displayName": "gcc-debug", + "inherits": "gcc-base" + }, + { + "name": "clang-debug", + "displayName": "clang-debug", + "inherits": "clang-base" + }, + { + "name": "msvc-debug", + "displayName": "msvc-debug", + "inherits": "msvc-base" + } + ], + "buildPresets": [ + { + "name": "gcc-debug", + "configurePreset": "gcc-debug" + }, + { + "name": "clang-debug", + "configurePreset": "clang-debug" + }, + { + "name": "msvc-debug", + "configurePreset": "msvc-debug" + } + ], + "testPresets": [ + { + "name": "gcc-debug", + "configurePreset": "gcc-debug", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": true + } + }, + { + "name": "clang-debug", + "configurePreset": "clang-debug", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": true + } + }, + { + "name": "msvc-debug", + "configurePreset": "msvc-debug", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": true + } + } + ] +} \ No newline at end of file From acb1916c85f83192a32f1078c9076e457da7121e Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 19:34:26 +0000 Subject: [PATCH 13/17] Remove extra path --- .github/workflows/cxx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index 528b88f..e9b2e15 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -81,7 +81,7 @@ jobs: - uses: actions/checkout@v3 - name: Configure CMake - run: cmake .. --preset ${{ matrix.preset }} -DBUILD_TESTING=on ${{ matrix.cmake_args }} + run: cmake --preset ${{ matrix.preset }} -DBUILD_TESTING=on ${{ matrix.cmake_args }} - name: Build run: cmake --build --preset ${{ matrix.preset }} From 0e2063657f34be0226843faad4b1ea9856d2e20d Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 19:53:44 +0000 Subject: [PATCH 14/17] Change windows generator --- CMakePresets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakePresets.json b/CMakePresets.json index f1209b2..1e49e90 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -28,7 +28,7 @@ { "name": "msvc-base", "hidden": true, - "generator": "Visual Studio 17 2022", + "generator": "Unix Makefiles", "binaryDir": "${sourceDir}/build/${presetName}", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", From 72b6c4ba5cee180942a97eadf73c12340ca92520 Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 19:58:06 +0000 Subject: [PATCH 15/17] Get Ninja --- .github/workflows/cxx.yml | 5 +++++ CMakePresets.json | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index e9b2e15..7425779 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -78,6 +78,11 @@ jobs: preset: clang-debug steps: + - name: Setup Ninja + uses: ashutoshvarma/setup-ninja@master + with: + version: 1.12.0 + - uses: actions/checkout@v3 - name: Configure CMake diff --git a/CMakePresets.json b/CMakePresets.json index 1e49e90..b76e86a 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -4,7 +4,7 @@ { "name": "gcc-base", "hidden": true, - "generator": "Unix Makefiles", + "generator": "Ninja", "binaryDir": "${sourceDir}/build/${presetName}", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", @@ -16,7 +16,7 @@ { "name": "clang-base", "hidden": true, - "generator": "Unix Makefiles", + "generator": "Ninja", "binaryDir": "${sourceDir}/build/${presetName}", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", @@ -28,7 +28,7 @@ { "name": "msvc-base", "hidden": true, - "generator": "Unix Makefiles", + "generator": "Ninja", "binaryDir": "${sourceDir}/build/${presetName}", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", From b13471c49bf19a57142ce46ff056245420a218c6 Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 20:00:24 +0000 Subject: [PATCH 16/17] Use a different ninja action --- .github/workflows/cxx.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index 7425779..c9f142d 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -78,13 +78,11 @@ jobs: preset: clang-debug steps: - - name: Setup Ninja - uses: ashutoshvarma/setup-ninja@master - with: - version: 1.12.0 - - uses: actions/checkout@v3 + - name: Setup Ninja + uses: seanmiddleditch/gha-setup-ninja@master + - name: Configure CMake run: cmake --preset ${{ matrix.preset }} -DBUILD_TESTING=on ${{ matrix.cmake_args }} From 8c771f42fa0e6842c31f0e5cf694d62d5c02b1a2 Mon Sep 17 00:00:00 2001 From: Matthew Guidry Date: Thu, 2 May 2024 20:12:19 +0000 Subject: [PATCH 17/17] Setup msvc dev env --- .github/workflows/cxx.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cxx.yml b/.github/workflows/cxx.yml index c9f142d..d5218dd 100644 --- a/.github/workflows/cxx.yml +++ b/.github/workflows/cxx.yml @@ -79,9 +79,13 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: seanmiddleditch/gha-setup-ninja@master - - name: Setup Ninja - uses: seanmiddleditch/gha-setup-ninja@master + - name: Setup MSVC + if: startsWith(matrix.os, 'windows') + uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: x64 - name: Configure CMake run: cmake --preset ${{ matrix.preset }} -DBUILD_TESTING=on ${{ matrix.cmake_args }}