Skip to content

Commit 69d4ac7

Browse files
Use Ninja in Windows CI and explicitly set the VS toolset version. (#1906)
* Use Ninja in Windows CI and explicitly set the VS toolset version. * Fix daily test CI. * Add vcpkg binary caching. * Pass `-A` in CMake only if specified by an environment variable. --------- Co-authored-by: Seth Shelnutt <[email protected]>
1 parent 55d7b3a commit 69d4ac7

File tree

4 files changed

+78
-1
lines changed

4 files changed

+78
-1
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,25 @@ jobs:
2121
# 11.7 necessary due to: https://github.com/actions/setup-python/issues/682#issuecomment-1604261330
2222
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.os == 'macos-12' && contains(fromJSON('["3.7", "3.8"]'), matrix.python-version) && '11.7' || '11' }}
2323
#MACOSX_DEPLOYMENT_TARGET: "10.11"
24+
# On windows-2019 we are using the Visual Studio generator, which is multi-config and places the build artifacts in a subdirectory
2425
steps:
2526
- name: Checkout TileDB-Py `dev`
2627
uses: actions/checkout@v3
2728

29+
# By default Visual Studio chooses the earliest installed toolset version
30+
# for the main build and vcpkg chooses the latest. Force it to use the
31+
# latest (14.39 currently).
32+
- name: Setup MSVC toolset (VS 2022)
33+
uses: TheMrMilchmann/setup-msvc-dev@v3
34+
if: matrix.os == 'windows-latest'
35+
with:
36+
arch: x64
37+
toolset: 14.39
38+
39+
- name: Install Ninja (VS 2022)
40+
uses: seanmiddleditch/gha-setup-ninja@v4
41+
if: matrix.os == 'windows-latest'
42+
2843
- name: Set up Python ${{ matrix.python-version }}
2944
uses: actions/setup-python@v4
3045
with:
@@ -80,6 +95,7 @@ jobs:
8095
fi
8196
env:
8297
TILEDB_FORCE_ALL_DEPS: True
98+
CMAKE_GENERATOR: "Ninja"
8399
if: matrix.os == 'windows-latest'
84100

85101
- name: "Download TileDB From Tarball And Build TileDB-Py (macOS)"

.github/workflows/daily-test-build-numpy.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,36 @@ jobs:
3535
# 11.7 necessary due to: https://github.com/actions/setup-python/issues/682#issuecomment-1604261330
3636
#MACOSX_DEPLOYMENT_TARGET: "10.15"
3737
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.os == 'macos-11' && contains(fromJson('["3.7", "3.8"]'), matrix.python-version) && '11.7' || '11' }}
38+
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
3839
steps:
3940
- name: Checkout TileDB-Py `dev`
4041
uses: actions/checkout@v3
4142

43+
# By default Visual Studio chooses the earliest installed toolset version
44+
# for the main build and vcpkg chooses the latest. Force it to use the
45+
# latest (14.39 currently).
46+
- name: Setup MSVC toolset (VS 2022)
47+
uses: TheMrMilchmann/setup-msvc-dev@v3
48+
if: matrix.os == 'windows-latest'
49+
with:
50+
arch: x64
51+
toolset: 14.39
52+
53+
- name: Install Ninja (VS 2022)
54+
uses: seanmiddleditch/gha-setup-ninja@v4
55+
if: matrix.os == 'windows-latest'
56+
57+
- name: Enable vcpkg binary caching
58+
uses: actions/github-script@v6
59+
with:
60+
script: |
61+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
62+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
63+
64+
- name: "Set CMAKE_GENERATOR"
65+
run: export CMAKE_GENERATOR="Ninja"
66+
if: matrix.os == 'windows-latest'
67+
4268
- name: Set up Python ${{ matrix.python-version }}
4369
uses: actions/setup-python@v2
4470
with:
@@ -67,6 +93,7 @@ jobs:
6793

6894
- name: Build TileDB-Py
6995
run: |
96+
echo "CMAKE_GENERATOR=$CMAKE_GENERATOR"
7097
python setup.py build_ext --inplace --werror
7198
python setup.py develop
7299

.github/workflows/daily-test-build.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929

3030
test:
3131
runs-on: ${{ matrix.os }}
32+
defaults:
33+
run:
34+
shell: bash
3235
strategy:
3336
matrix:
3437
os: [ubuntu-latest, macos-12, windows-latest]
@@ -39,8 +42,34 @@ jobs:
3942
env:
4043
TILEDB_VERSION: ${{ matrix.libtiledb_version }}
4144
MACOSX_DEPLOYMENT_TARGET: "11"
45+
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
4246

4347
steps:
48+
# By default Visual Studio chooses the earliest installed toolset version
49+
# for the main build and vcpkg chooses the latest. Force it to use the
50+
# latest (14.39 currently).
51+
- name: Setup MSVC toolset (VS 2022)
52+
uses: TheMrMilchmann/setup-msvc-dev@v3
53+
if: matrix.os == 'windows-latest'
54+
with:
55+
arch: x64
56+
toolset: 14.39
57+
58+
- name: Enable vcpkg binary caching
59+
uses: actions/github-script@v6
60+
with:
61+
script: |
62+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
63+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
64+
65+
- name: Install Ninja (VS 2022)
66+
uses: seanmiddleditch/gha-setup-ninja@v4
67+
if: matrix.os == 'windows-latest'
68+
69+
- name: "Set CMAKE_GENERATOR"
70+
run: echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
71+
if: matrix.os == 'windows-latest'
72+
4473
- name: Set up Python
4574
uses: actions/setup-python@v2
4675
with:
@@ -73,6 +102,7 @@ jobs:
73102

74103
- name: Build TileDB-Py
75104
run: |
105+
echo "CMAKE_GENERATOR=$CMAKE_GENERATOR"
76106
python setup.py build_ext --inplace --werror
77107
python setup.py develop
78108
env:

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
# Allow to override TILEDB_FORCE_ALL_DEPS with environment variable
4444
TILEDB_FORCE_ALL_DEPS = "TILEDB_FORCE_ALL_DEPS" in os.environ
4545
TILEDB_DISABLE_SERIALIZATION = "TILEDB_DISABLE_SERIALIZATION" in os.environ
46+
CMAKE_ARCHITECTURE = os.environ.get("CMAKE_ARCHITECTURE", None)
4647
CMAKE_GENERATOR = os.environ.get("CMAKE_GENERATOR", None)
4748

4849
# Directory containing this file
@@ -240,7 +241,10 @@ def build_libtiledb(src_dir):
240241
cmake_cmd.append("-DCMAKE_BUILD_TYPE={}".format(build_type))
241242

242243
if os.name == "nt":
243-
cmake_cmd.extend(["-A", "x64", "-DMSVC_MP_FLAG=/MP4"])
244+
cmake_cmd.extend(["-DMSVC_MP_FLAG=/MP4"])
245+
246+
if CMAKE_ARCHITECTURE:
247+
cmake_cmd.extend(["-A", CMAKE_ARCHITECTURE])
244248

245249
if CMAKE_GENERATOR:
246250
cmake_cmd.extend(["-G", CMAKE_GENERATOR])

0 commit comments

Comments
 (0)