-
Notifications
You must be signed in to change notification settings - Fork 30
96 lines (85 loc) · 4.42 KB
/
windows-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Windows-CI
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.platform.image }}
strategy:
matrix:
platform:
- { image: windows-2022, generator: Visual Studio 17 2022, toolset: v143, cmake-arch: x64, arch: x64, python: "3.12", unity: ON, str: windows-x64-v143 }
- { image: windows-2022, generator: Visual Studio 17 2022, toolset: v143, cmake-arch: x64, arch: x64, python: "3.11", unity: ON, str: windows-x64-v143 }
- { image: windows-2022, generator: Visual Studio 17 2022, toolset: v143, cmake-arch: x64, arch: x64, python: "3.10", unity: ON, str: windows-x64-v143 }
- { image: windows-2019, generator: Visual Studio 16 2019, toolset: v142, cmake-arch: Win32, arch: x86, python: 3.9, unity: ON, str: windows-x86-v142 }
- { image: windows-2019, generator: Visual Studio 16 2019, toolset: v142, cmake-arch: x64, arch: x64, python: 3.8, unity: OFF, str: windows-x64-v142 }
# The windows-2016 image with VS 2017 is going the way of the dodo, so just use VS2019 with the 2017 compiler.
- { image: windows-2019, generator: Visual Studio 16 2019, toolset: v141, cmake-arch: Win32, arch: x86, python: 3.7, unity: OFF, str: windows-x86-v141 }
- { image: windows-2019, generator: Visual Studio 16 2019, toolset: v141, cmake-arch: x64, arch: x64, python: 3.6, unity: ON, str: windows-x64-v141 }
env:
VCPKG_BINARY_SOURCES: 'clear'
VCPKG_DEFAULT_HOST_TRIPLET: windows-hsplasma
VCPKG_OVERLAY_TRIPLETS: '${{ github.workspace }}/overlay-triplets'
steps:
- name: Checkout HSPlasma
uses: actions/checkout@v4
- name: Checkout vcpkg
uses: actions/checkout@v4
with:
repository: microsoft/vcpkg
path: vcpkg
# Write out a custom vcpkg triplet for the toolset hackery we will do.
- name: Generate Triplet
run: |
mkdir -p overlay-triplets | Out-Null
Set-Content -Path "overlay-triplets/windows-hsplasma.cmake" @"
set(VCPKG_TARGET_ARCHITECTURE ${{ matrix.platform.arch }})
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_PLATFORM_TOOLSET ${{ matrix.platform.toolset }})
"@
# Use actions/cache for our library cache because we use multiple compilers per triplet.
# This would cause package hash collisions in the NuGet store, triggering upload race failures.
- name: Determine vcpkg rev
id: vcpkg-rev
run: |
Set-Location vcpkg
"ref=$(git rev-parse HEAD)" >> $env:GITHUB_OUTPUT
- name: Restore Dependency Libraries
uses: actions/cache@v4
with:
path: build/vcpkg_installed
key: vcpkg-${{ matrix.platform.str }} ${{ steps.vcpkg-rev.outputs.ref }} ${{ hashFiles('vcpkg.json') }}
restore-keys: |
vcpkg-${{ matrix.platform.str }} ${{ steps.vcpkg-rev.outputs.ref }}
vcpkg-${{ matrix.platform.str }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.platform.python }}
architecture: ${{ matrix.platform.arch }}
- name: Configure
run: |
cmake `
-G "${{ matrix.platform.generator }}" -A "${{ matrix.platform.cmake-arch }}" -T "${{ matrix.platform.toolset }}" `
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}"/vcpkg/scripts/buildsystems/vcpkg.cmake `
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/install" `
-DCMAKE_UNITY_BUILD=${{ matrix.platform.unity }} `
-DVCPKG_TARGET_TRIPLET=windows-hsplasma `
-DPython3_EXECUTABLE="${{ env.pythonLocation }}/python.exe" `
-DPython3_LIBRARY="${{ env.pythonLocation }}/libs/python$("${{ matrix.platform.python }}".replace('.', '')).lib" `
-DPython3_INCLUDE_DIR="${{ env.pythonLocation }}/include" `
-S . -B build
- name: Build
run: |
cmake --build build --config Release -j 2
- name: Install
run: |
cmake --build build --target INSTALL --config Release -j 2
- name: Test
run: |
Set-Location build/install/bin
python -c "import PyHSPlasma; print(dir(PyHSPlasma))"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: libhsplasma-${{ matrix.platform.str }}-py${{ matrix.platform.python }}
path: build/install