From 5122a69b7b82f89424aa3c4ed24bf50289bf21f7 Mon Sep 17 00:00:00 2001 From: offa <8887756+offa@users.noreply.github.com> Date: Wed, 18 Mar 2026 18:09:20 +0100 Subject: [PATCH] Add MSVC support --- .github/workflows/ci.yml | 13 +++++++++++++ action.yml | 11 +++++++---- test/CMakeLists.txt | 25 ++++++++++++++----------- test/ci_build.sh | 15 ++++++++++++--- 4 files changed, 46 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d758133..447afca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,19 @@ jobs: - name: Build run: test/ci_build.sh + build_msvc: + runs-on: windows-latest + name: "msvc" + steps: + - uses: actions/checkout@main + - name: Conan Action + uses: ./ + - name: Setup MSVC + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 + - name: Build + run: test/ci_build.sh + shell: bash + yamllint: runs-on: ubuntu-latest steps: diff --git a/action.yml b/action.yml index 185c61b..466a33d 100644 --- a/action.yml +++ b/action.yml @@ -8,12 +8,15 @@ branding: runs: using: "composite" steps: + - name: "Setup pipx" + if: runner.os == 'Linux' + run: | + apt-get update + apt-get install -y pipx + echo "$HOME/.local/bin" >> "$GITHUB_PATH" + shell: bash - name: "Setup Conan" run: | - apt-get update - apt-get install -y pipx - echo "$HOME/.local/bin" >> "$GITHUB_PATH" - export PATH="${HOME}/.local/bin:${PATH}" pipx install conan conan config install "${GITHUB_ACTION_PATH}/settings_user.yml" conan profile detect diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 38c3f68..8bfe676 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,17 +9,20 @@ set(CMAKE_CXX_EXTENSIONS OFF) find_package(Catch2 REQUIRED) -add_compile_options(-Wall - -Wextra - -pedantic - -pedantic-errors - -Werror - -Wshadow - -Wold-style-cast - -Wnull-dereference - -Wnon-virtual-dtor - -Woverloaded-virtual - ) + +if (NOT MSVC) + add_compile_options(-Wall + -Wextra + -pedantic + -pedantic-errors + -Werror + -Wshadow + -Wold-style-cast + -Wnull-dereference + -Wnon-virtual-dtor + -Woverloaded-virtual + ) +endif() add_executable(gha-test gha-test.cpp) target_link_libraries(gha-test PRIVATE Catch2::Catch2WithMain) diff --git a/test/ci_build.sh b/test/ci_build.sh index be1faaf..8306d1c 100755 --- a/test/ci_build.sh +++ b/test/ci_build.sh @@ -2,11 +2,20 @@ set -ex +pipx install ninja + mkdir "test/build" cd "test/build" -conan install .. -of . --build=missing -cmake --preset conan-release .. -make -j +conan install \ + -of . \ + --build=missing \ + -s compiler.cppstd=20 \ + -s build_type=Release \ + -c "tools.cmake.cmaketoolchain:generator=Ninja" \ + .. + +cmake --preset conan-release .. +cmake --build . -j ./gha-test