From 5d1d86f521719645da3af29ba3cbde79909a962c Mon Sep 17 00:00:00 2001 From: Julien Lamy Date: Sun, 14 Apr 2024 17:47:41 +0200 Subject: [PATCH] Add Windows CI --- .ci/build/build.py | 10 ++++++++-- .ci/build/conda.py | 3 ++- .github/workflows/build.yml | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.ci/build/build.py b/.ci/build/build.py index 04ea53c..3ad7267 100644 --- a/.ci/build/build.py +++ b/.ci/build/build.py @@ -15,11 +15,17 @@ subprocess.check_call( [ "cmake", - "-G", "Ninja", + # NOTE: if Ninja is used as a builder, compiler chain defaults to gcc on + # Windows + *(["-G", "Ninja"] if os.name != "nt" else []), "-DPython_EXECUTABLE={}".format(sys.executable), "-DCMAKE_INSTALL_PREFIX={}".format(install_dir), *([os.environ["CMAKE_OPTIONS"]] if "CMAKE_OPTIONS" in os.environ else []), workspace], cwd=build_dir) -subprocess.check_call(["ninja", "install"], cwd=build_dir) +subprocess.check_call( + [ + "cmake", "--build", ".", "--target", "install", "--config", "Release", + "--parallel"], + cwd=build_dir) diff --git a/.ci/build/conda.py b/.ci/build/conda.py index 6bf5d62..a8548fa 100644 --- a/.ci/build/conda.py +++ b/.ci/build/conda.py @@ -1,7 +1,8 @@ +import os import subprocess import sys -conda = sys.argv[1] if len(sys.argv) >= 2 else "conda" +conda = sys.argv[1] if len(sys.argv) >= 2 else os.environ.get("MAMBA_EXE", "conda") subprocess.check_call([ conda, "install", "--yes", "-c", "conda-forge", diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6735d62..c35525e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,7 @@ jobs: - { os: "ubuntu-latest", container: "ubuntu:jammy", packaging: "apt", cmake_options: "-DCMAKE_CXX_STANDARD=17", python: "python3" } - { os: "ubuntu-latest", packaging: "conda", cmake_options: "-DCMAKE_CXX_STANDARD=17", python: "python" } - { os: "macos-latest", packaging: "conda", cmake_options: "-DCMAKE_CXX_STANDARD=17", python: "python" } + - { os: "windows-latest", packaging: "conda", cmake_options: "-DCMAKE_CXX_STANDARD=17", python: "python" } env: WORKSPACE: "${{ github.workspace }}" CMAKE_OPTIONS: "${{ matrix.cmake_options }}" @@ -35,7 +36,7 @@ jobs: uses: mamba-org/setup-micromamba@v1 with: init-shell: bash powershell - environment-name: dicomifier + environment-name: odil create-args: python=3.11 if: ${{ contains(matrix.packaging, 'conda') }}