From 2bdc8dd3a4002b86601c98a857f4fc88f9e032c9 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Thu, 27 Oct 2022 12:25:14 -0700 Subject: [PATCH] Cirrus configuration for Windows builds --- .cirrus.yml | 22 +++++++++++++++++++++- .gitignore | 1 + ci/windows/Dockerfile | 12 ++++++------ ci/windows/build.cmd | 11 +++++++++++ ci/windows/prepare.cmd | 7 +++++++ ci/windows/test.cmd | 7 +++++++ 6 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 ci/windows/build.cmd create mode 100644 ci/windows/prepare.cmd create mode 100644 ci/windows/test.cmd diff --git a/.cirrus.yml b/.cirrus.yml index 2c5648a0fd..faf44239ec 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -59,7 +59,7 @@ ci_template: &CI_TEMPLATE only_if: > ( $CIRRUS_REPO_NAME != 'zeek-security' || $CIRRUS_OS != "darwin" ) && ( ( $CIRRUS_PR != '' && $CIRRUS_BRANCH !=~ 'dependabot/.*' ) || - ( $CIRRUS_REPO_NAME == 'zeek' && + ( $CIRRUS_REPO_NAME == 'ms-zeek' && ( $CIRRUS_BRANCH == 'master' || $CIRRUS_BRANCH =~ 'release/.*' @@ -357,3 +357,23 @@ ubsan_sanitizer_task: # CXXFLAGS: -DZEEK_DICT_DEBUG # ZEEK_CI_CONFIGURE_FLAGS: *TSAN_SANITIZER_CONFIG # ZEEK_CI_DISABLE_SCRIPT_PROFILING: 1 + +windows_task: + # 2 hour timeout just for potential of building Docker image taking a while + timeout_in: 120m + windows_container: + # image: cirrusci/windowsservercore:cmake + # image: zeekurity/broker-ci-windows:latest + dockerfile: ci/windows/Dockerfile + os_version: 2019 + cpu: 8 + # Not allowed to request less than 8GB for an 8 CPU Windows VM. + memory: 8GB + sync_submodules_script: git submodule update --recursive --init + prepare_script: ci/windows/prepare.cmd + build_script: ci/windows/build.cmd + test_script: ci/windows/test.cmd + env: + ZEEK_CI_CPUS: 8 + # Give verbose error output on a test failure. + CTEST_OUTPUT_ON_FAILURE: 1 diff --git a/.gitignore b/.gitignore index 9a7412b64b..6a31b11bd7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Ignore anything prefixed with build since people # tend to name all of their build directories prefixed that way. build* +!ci/windows/build.cmd tmp *.gcov diff --git a/ci/windows/Dockerfile b/ci/windows/Dockerfile index 86d204ca50..af632901db 100644 --- a/ci/windows/Dockerfile +++ b/ci/windows/Dockerfile @@ -12,12 +12,12 @@ RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePoin # Install prerequisites RUN choco install -y --no-progress visualstudio2019buildtools --version=16.11.11.0 RUN choco install -y --no-progress visualstudio2019-workload-vctools --version=1.0.0 --package-parameters '--add Microsoft.VisualStudio.Component.VC.ATLMFC' -RUN choco install conan -y -RUN choco install sed -y -RUN choco install winflexbison3 -y -RUN choco install msysgit -y -RUN choco install python -y -RUN choco install openssl -y +RUN choco install -y --no-progress conan +RUN choco install -y --no-progress sed +RUN choco install -y --no-progress winflexbison3 +RUN choco install -y --no-progress msysgit +RUN choco install -y --no-progress python +RUN choco install -y --no-progress openssl # Set working environment. SHELL [ "cmd", "/c" ] diff --git a/ci/windows/build.cmd b/ci/windows/build.cmd new file mode 100644 index 0000000000..b64396a417 --- /dev/null +++ b/ci/windows/build.cmd @@ -0,0 +1,11 @@ +:: Import the visual studio compiler environment into the one running in the +:: cmd current shell. This path is hard coded to the one on the CI image, but +:: can be adjusted if running builds locally. Unfortunately, the initial path +:: isn't in the environment so we have to hardcode the whole path. +call "c:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 + +mkdir build +cd build + +cmake.exe .. -DCMAKE_BUILD_TYPE=release -DENABLE_ZEEK_UNIT_TESTS=yes -G Ninja +cmake.exe --build . diff --git a/ci/windows/prepare.cmd b/ci/windows/prepare.cmd new file mode 100644 index 0000000000..162381367e --- /dev/null +++ b/ci/windows/prepare.cmd @@ -0,0 +1,7 @@ +@echo on + +echo %ZEEK_CI_CPUS% +wmic cpu get NumberOfCores, NumberOfLogicalProcessors/Format:List +systeminfo +dir C: +choco list --localonly diff --git a/ci/windows/test.cmd b/ci/windows/test.cmd new file mode 100644 index 0000000000..aae40887d9 --- /dev/null +++ b/ci/windows/test.cmd @@ -0,0 +1,7 @@ +:: See build.cmd for documentation on this call. +call "c:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 + +:: We currently don't have any tests to run on Windows, so this is just commented out. +:: We'll expand on this later. +:: cd build +:: ctest -C release || exit \b 1