]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
ci: Add VS2022 and MSBuild to Windows CI runners (#1108)
authorRafael Kitover <rkitover@gmail.com>
Mon, 18 Jul 2022 12:42:50 +0000 (05:42 -0700)
committerGitHub <noreply@github.com>
Mon, 18 Jul 2022 12:42:50 +0000 (14:42 +0200)
.github/workflows/build.yaml
ci/build
unittest/CMakeLists.txt

index fe0e3a39f0603641505517d515783fba19e793d5..f54424b1b423ecf42d13479c7b1fc7b82e745388 100644 (file)
@@ -187,7 +187,7 @@ jobs:
             RUN_TESTS: unittest-in-wine
             apt_get: elfutils mingw-w64 wine
 
-          - name: Windows VS2019 32-bit
+          - name: Windows VS2019 32-bit Ninja
             os: windows-2019
             msvc_arch: x64_x86
             allow_test_failures: true  # For now, don't fail the build on failure
@@ -198,8 +198,63 @@ jobs:
             CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON
             TEST_CC: clang -target i686-pc-windows-msvc
 
-          - name: Windows VS2019 64-bit
+          - name: Windows VS2019 32-bit MSBuild
             os: windows-2019
+            msvc_arch: x64_x86
+            allow_test_failures: true  # For now, don't fail the build on failure
+            CC: cl
+            CXX: cl
+            ENABLE_CACHE_CLEANUP_TESTS: 1
+            CMAKE_GENERATOR: Visual Studio 16 2019
+            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON -A Win32
+            TEST_CC: clang -target i686-pc-windows-msvc
+
+          - name: Windows VS2019 64-bit Ninja
+            os: windows-2019
+            msvc_arch: x64
+            allow_test_failures: true  # For now, don't fail the build on failure
+            CC: cl
+            CXX: cl
+            ENABLE_CACHE_CLEANUP_TESTS: 1
+            CMAKE_GENERATOR: Ninja
+            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON
+            TEST_CC: clang -target x86_64-pc-windows-msvc
+
+          - name: Windows VS2019 64-bit MSBuild
+            os: windows-2019
+            msvc_arch: x64
+            allow_test_failures: true  # For now, don't fail the build on failure
+            CC: cl
+            CXX: cl
+            ENABLE_CACHE_CLEANUP_TESTS: 1
+            CMAKE_GENERATOR: Visual Studio 16 2019
+            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON -A x64
+            TEST_CC: clang -target x86_64-pc-windows-msvc
+
+          - name: Windows VS2022 32-bit Ninja
+            os: windows-2022
+            msvc_arch: x64_x86
+            allow_test_failures: true  # For now, don't fail the build on failure
+            CC: cl
+            CXX: cl
+            ENABLE_CACHE_CLEANUP_TESTS: 1
+            CMAKE_GENERATOR: Ninja
+            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON
+            TEST_CC: clang -target i686-pc-windows-msvc
+
+          - name: Windows VS2022 32-bit MSBuild
+            os: windows-2022
+            msvc_arch: x64_x86
+            allow_test_failures: true  # For now, don't fail the build on failure
+            CC: cl
+            CXX: cl
+            ENABLE_CACHE_CLEANUP_TESTS: 1
+            CMAKE_GENERATOR: Visual Studio 17 2022
+            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON -A Win32
+            TEST_CC: clang -target i686-pc-windows-msvc
+
+          - name: Windows VS2022 64-bit Ninja
+            os: windows-2022
             msvc_arch: x64
             allow_test_failures: true  # For now, don't fail the build on failure
             CC: cl
@@ -209,6 +264,17 @@ jobs:
             CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON
             TEST_CC: clang -target x86_64-pc-windows-msvc
 
+          - name: Windows VS2022 64-bit MSBuild
+            os: windows-2022
+            msvc_arch: x64
+            allow_test_failures: true  # For now, don't fail the build on failure
+            CC: cl
+            CXX: cl
+            ENABLE_CACHE_CLEANUP_TESTS: 1
+            CMAKE_GENERATOR: Visual Studio 17 2022
+            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON -A x64
+            TEST_CC: clang -target x86_64-pc-windows-msvc
+
           - name: Clang address & UB sanitizer
             os: ubuntu-20.04
             CC: clang
index ff50bbfbfb298b94f15945db639da981da342660..648bf4c2d9dc026ec8d793652723dde77e427764 100755 (executable)
--- a/ci/build
+++ b/ci/build
@@ -17,7 +17,16 @@ else
     mkdir -p ${BUILDDIR:-build}
     cd ${BUILDDIR:-build}
     ${CMAKE_PREFIX:-} cmake ${CMAKE_PARAMS:-} ${CCACHE_LOC:-..}
-    ${CMAKE_PREFIX:-} cmake --build . ${EXTRA_CMAKE_BUILD_FLAGS:-} -- -j$JOBS
+
+    case "${CMAKE_GENERATOR}" in
+        [Vv]isual" "[Ss]tudio*) # MSBuild, use all CPUs.
+            ${CMAKE_PREFIX:-} cmake --build . ${EXTRA_CMAKE_BUILD_FLAGS:-} -- -m
+            ;;
+        *) # Ninja automatically uses all available CPUs.
+            ${CMAKE_PREFIX:-} cmake --build . ${EXTRA_CMAKE_BUILD_FLAGS:-}
+            ;;
+    esac
+
     case "${RUN_TESTS:-all}" in
         all)
             CC=${TEST_CC:-${CC}} ctest --output-on-failure -j$JOBS "$@"
index 237fead4ac365e4e812237162f41fe785a1dc7f5..4f52bf9ce69b6d8c6c51977d1635d232a8e232d0 100644 (file)
@@ -41,6 +41,11 @@ endif()
 
 add_executable(unittest ${source_files})
 
+if(MSVC)
+  # Turn off /Zc:preprocessor for this test because it triggers a bug in some older Windows 10 SDK headers.
+  set_source_files_properties(test_Stat.cpp PROPERTIES COMPILE_FLAGS /Zc:preprocessor-)
+endif()
+
 target_link_libraries(
   unittest
   PRIVATE standard_settings standard_warnings ccache_framework third_party)