Skip to content

Commit 46fd693

Browse files
authored
feat: use vcpkg in Windows CI workflow with caching (#149)
* feat: use CUDA image for Python packaging * fix: do not use container engine on Linux * fix: install dependencies on MacOS * fix: typo * fix: make cibuildwheel use custom container image * refactor: skip 32 bit manylinux packages * chore: bump version * refactor: skip musl linux builds * update cibuildwheel * fix: use correct container image for packaging * refactor: use CPM source cache in CI * feat: add sccache on Windows * fix: sccache path * feat: use sccache on test workflow * feat: use vcpkg for VTK on windows * fix: seperate VTK build step * fix: remove alias in project config * chore: bump ViennaCore version * chore: bump version
1 parent 0854ed4 commit 46fd693

9 files changed

Lines changed: 68 additions & 23 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,10 @@ runs:
5050
if: ${{ inputs.os == 'macos-latest' }}
5151
run: |
5252
echo "MACOSX_DEPLOYMENT_TARGET=15.0" >> $GITHUB_ENV
53+
54+
- name: Setup vcpkg (Windows)
55+
shell: bash
56+
if: ${{ inputs.os == 'windows-latest' }}
57+
run: |
58+
git clone https://github.com/microsoft/vcpkg.git
59+
./vcpkg/bootstrap-vcpkg.bat

.github/workflows/build.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
runs-on: ${{ matrix.os }}
3333
container: ${{ matrix.container }}
3434

35+
env:
36+
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/.vcpkg-bincache
37+
3538
name: "🧪 Test on ${{ matrix.os }} (⚙️: ${{ matrix.config }}, 💿: ${{ matrix.container || matrix.os }})"
3639

3740
steps:
@@ -45,17 +48,37 @@ jobs:
4548

4649
- name: 📋 Install MacOS Dependencies
4750
if: ${{ matrix.os == 'macos-latest' }}
51+
run: brew install vtk
52+
53+
- name: Create vcpkg binary cache dir
54+
if: ${{ matrix.os == 'windows-latest' }}
55+
shell: pwsh
4856
run: |
49-
brew install vtk
57+
New-Item -ItemType Directory -Force -Path "${{ env.VCPKG_DEFAULT_BINARY_CACHE }}"
5058
51-
- name: 🦥 Cache Dependencies
59+
- name: 🦥 Cache VTK vcpkg build
60+
if: ${{ matrix.os == 'windows-latest' }}
5261
uses: actions/cache@v4
5362
with:
54-
key: test-${{ matrix.os }}-${{ matrix.config }}
55-
path: build/_deps/
63+
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
64+
key: vcpkg-${{ matrix.os }}-${{ matrix.config }}
65+
66+
- name: 🛠️ Build VTK (Windows)
67+
if: ${{ matrix.os == 'windows-latest' }}
68+
run: |
69+
./vcpkg/vcpkg install vtk
5670
57-
- name: 🏗️ Compile
58-
run: cmake -DVIENNALS_BUILD_TESTS=ON -B build && cmake --build build --config ${{ matrix.config }}
71+
- name: 🏗️ Compile (Windows)
72+
if: ${{ matrix.os == 'windows-latest' }}
73+
run: |
74+
cmake -DVIENNALS_BUILD_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -B build
75+
cmake --build build --config ${{ matrix.config }}
76+
77+
- name: 🏗️ Compile (other)
78+
if: ${{ matrix.os != 'windows-latest' }}
79+
run: |
80+
cmake -DVIENNALS_BUILD_TESTS=ON -B build
81+
cmake --build build --config ${{ matrix.config }}
5982
6083
- name: 🧪 Test
6184
run: ctest --output-on-failure -E "Benchmark|Performance" -C ${{ matrix.config }} --test-dir build

.github/workflows/python.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
runs-on: ${{ matrix.os }}
3030
container: ${{ matrix.container }}
3131

32+
env:
33+
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/.vcpkg-bincache
34+
3235
name: "🐍 Test Bindings on ${{ matrix.os }}"
3336

3437
steps:
@@ -42,14 +45,25 @@ jobs:
4245

4346
- name: 📋 Install MacOS Dependencies
4447
if: ${{ matrix.os == 'macos-latest' }}
48+
run: brew install vtk
49+
50+
- name: Create vcpkg binary cache dir
51+
if: ${{ matrix.os == 'windows-latest' }}
52+
shell: pwsh
4553
run: |
46-
brew install vtk
54+
New-Item -ItemType Directory -Force -Path "${{ env.VCPKG_DEFAULT_BINARY_CACHE }}"
4755
48-
- name: 🦥 Cache Dependencies
56+
- name: 🦥 Cache VTK vcpkg build
57+
if: ${{ matrix.os == 'windows-latest' }}
4958
uses: actions/cache@v4
5059
with:
51-
key: python-${{ matrix.os }}
52-
path: build/_deps/
60+
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
61+
key: vcpkg-${{ matrix.os }}-Release
62+
63+
- name: 🛠️ Build VTK (Windows)
64+
if: ${{ matrix.os == 'windows-latest' }}
65+
run: |
66+
./vcpkg/vcpkg install vtk
5367
5468
- name: 🛠️ Disable IPO
5569
if: ${{ matrix.os == 'ubuntu-latest' }}
@@ -60,6 +74,7 @@ jobs:
6074
- name: 🐍 Build and check Python Module (Windows)
6175
if: ${{ matrix.os == 'windows-latest' }}
6276
run: |
77+
$env:CMAKE_ARGS = "-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake"
6378
python -m venv venv
6479
./venv/Scripts/activate.bat
6580
pip install .

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ _generate/
2525
.eggs/
2626
test.ipynb
2727
testall.sh
28+
*_old*

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
22
project(
33
ViennaLS
44
LANGUAGES CXX
5-
VERSION 5.7.0)
5+
VERSION 5.7.1)
66

77
# --------------------------------------------------------------------------------------------------------
88
# Library options
@@ -76,7 +76,6 @@ endif()
7676
# --------------------------------------------------------------------------------------------------------
7777

7878
add_library(${PROJECT_NAME} INTERFACE)
79-
add_library(ViennaTools::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
8079

8180
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
8281
set_target_properties(
@@ -112,7 +111,7 @@ include(cmake/vtk.cmake)
112111

113112
CPMAddPackage(
114113
NAME ViennaCore
115-
VERSION 2.0.0
114+
VERSION 2.1.1
116115
GIT_REPOSITORY "https://github.com/ViennaTools/ViennaCore"
117116
OPTIONS "VIENNACORE_FORMAT_EXCLUDE build/"
118117
EXCLUDE_FROM_ALL ${VIENNALS_BUILD_PYTHON})

include/viennals/lsVersion.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
namespace viennals {
66

77
// Version information generated by CMake
8-
inline constexpr const char *version = "5.7.0";
8+
inline constexpr const char *version = "5.7.1";
99
inline constexpr int versionMajor = 5;
1010
inline constexpr int versionMinor = 7;
11-
inline constexpr int versionPatch = 0;
11+
inline constexpr int versionPatch = 1;
1212

1313
// Utility functions for version comparison
1414
inline constexpr uint32_t versionAsInteger() {

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ requires = [
66
build-backend = "scikit_build_core.build"
77

88
[project]
9-
version = "5.7.0"
9+
version = "5.7.1"
1010
name = "ViennaLS"
1111
readme = "README.md"
1212
license = {file = "LICENSE"}

python/viennals/__init__.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ from viennals._core import Mesh
2323
from viennals._core import NormalCalculationMethodEnum
2424
from viennals._core import PointData
2525
from viennals._core import Slice
26-
from viennals._core import SpatialSchemeEnum
2726
from viennals._core import SpatialSchemeEnum as IntegrationSchemeEnum
27+
from viennals._core import SpatialSchemeEnum
2828
from viennals._core import TemporalSchemeEnum
2929
from viennals._core import TransformEnum
3030
from viennals._core import TransformMesh
@@ -46,8 +46,8 @@ from viennals.d2 import CompareChamfer
4646
from viennals.d2 import CompareCriticalDimensions
4747
from viennals.d2 import CompareNarrowBand
4848
from viennals.d2 import CompareSparseField
49-
from viennals.d2 import CompareVolume as CompareArea
5049
from viennals.d2 import CompareVolume
50+
from viennals.d2 import CompareVolume as CompareArea
5151
from viennals.d2 import ConvexHull
5252
from viennals.d2 import CustomSphereDistribution
5353
from viennals.d2 import Cylinder
@@ -112,6 +112,6 @@ def setDimension(d: int):
112112
113113
"""
114114
PROXY_DIM: int = 2
115-
__version__: str = '5.7.0'
116-
version: str = '5.7.0'
115+
__version__: str = '5.7.1'
116+
version: str = '5.7.1'
117117
_C = _core

python/viennals/_core.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import enum
77
import typing
88
from viennals import d2
99
import viennals.d2
10-
from viennals import d3
1110
import viennals.d3
11+
from viennals import d3
1212
__all__: list[str] = ['BooleanOperationEnum', 'BoundaryConditionEnum', 'CurvatureEnum', 'Extrude', 'FeatureDetectionEnum', 'FileFormatEnum', 'IntegrationSchemeEnum', 'LogLevel', 'Logger', 'MaterialMap', 'Mesh', 'NormalCalculationMethodEnum', 'PointData', 'Slice', 'SpatialSchemeEnum', 'TemporalSchemeEnum', 'TransformEnum', 'TransformMesh', 'VTKReader', 'VTKRenderWindow', 'VTKWriter', 'VelocityField', 'VoidTopSurfaceEnum', 'd2', 'd3', 'setNumThreads', 'version']
1313
class BooleanOperationEnum(enum.IntEnum):
1414
INTERSECT: typing.ClassVar[BooleanOperationEnum] # value = <BooleanOperationEnum.INTERSECT: 0>
@@ -549,6 +549,6 @@ class VoidTopSurfaceEnum(enum.IntEnum):
549549
"""
550550
def setNumThreads(arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
551551
...
552-
__version__: str = '5.7.0'
553-
version: str = '5.7.0'
552+
__version__: str = '5.7.1'
553+
version: str = '5.7.1'
554554
IntegrationSchemeEnum = SpatialSchemeEnum

0 commit comments

Comments
 (0)