Skip to content

Merge pull request #289 from dpogue/python3.12-fixes #252

Merge pull request #289 from dpogue/python3.12-fixes

Merge pull request #289 from dpogue/python3.12-fixes #252

Workflow file for this run

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.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@v2
- name: Checkout vcpkg
uses: actions/checkout@v2
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
Write-Host "::set-output name=ref::$(git rev-parse HEAD)"
- name: Restore Dependency Libraries
uses: actions/cache@v2
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@v2
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@v2
with:
name: libhsplasma-${{ matrix.platform.str }}-py${{ matrix.platform.python }}
path: build/install