Skip to content

Added windows workflow #39

Added windows workflow

Added windows workflow #39

Workflow file for this run

name: "Python Bindings Unit Tests"
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: build-python-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
python-tests:
name: "Test python bindings"
strategy:
matrix:
on: [ 'ubuntu-24.04', 'macos-15-intel', 'macos-26', 'windows-2022', 'windows-2025' ]
python: [ '3.10', '3.11', '3.12', '3.13' ]
runs-on: ${{matrix.on}}
env:
INSTALL_PREFIX: ${{ startsWith(matrix.on, 'windows-') && format('{0}\\install', github.workspace) || '/usr/local' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version: ${{matrix.python}}
- name: "Install packages ubuntu"
if: ${{ startsWith(matrix.on, 'ubuntu-') }}
run: sudo apt install -y ninja-build g++
- name: "Setup macos runner"
if: ${{ startsWith(matrix.on, 'macos-') }}
uses: Homebrew/actions/setup-homebrew@main
- name: "Install macos packages"
if: ${{ startsWith(matrix.on, 'macos-') }}
run: brew install ninja gcc cmake
- name: "Install Windows packages"
if: ${{ startsWith(matrix.on, 'windows-') }}
shell: pwsh
run: choco install cmake ninja --yes --installargs 'ADD_CMAKE_TO_PATH=System'
- name: "Run CMake (UNIX)"
if: ${{ !startsWith(matrix.on, 'windows-') }}
run: |
cmake -DCMAKE_BUILD_TYPE=Release \
-G Ninja \
-B ../build \
-S ${GITHUB_WORKSPACE}
cmake --build ../build -j $(nproc)
sudo cmake --install ../build --prefix $INSTALL_PREFIX
- name: "Run CMake (Windows)"
if: ${{ startsWith(matrix.on, 'windows-') }}
shell: pwsh
run: |
cmake -G "Ninja" `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_INSTALL_PREFIX="$install_prefix" `
-B ../build `
-S $env:GITHUB_WORKSPACE
cmake --build ../build --parallel
cmake --install ../build
- name: "Install python test environment"
run: python -m pip install -r test-requirement.txt
- name: "Run Python tests (WINDOWS)"
if: ${{ startsWith(matrix.on, 'windows-') }}
shell: bash
run: |
PYBIND_FILE=$(ls $INSTALL_PREFIX\\lib\\python\\py_capio_cl*.pyd | head -n 1)
export CAPIO_CL_PY_BINDING_PATH=$(cygpath -m "$PYBIND_FILE")
echo "Python module path: $CAPIO_CL_PY_BINDING_PATH"
pytest tests/python/test_*
- name: "Run Python tests (UNIX)"
if: ${{ !startsWith(matrix.on, 'windows-') }}
shell: bash
run: |
export CAPIO_CL_PY_BINDING_PATH=$(realpath $INSTALL_PREFIX/lib/python/py_capio_cl*)
echo "Python module path: $CAPIO_CL_PY_BINDING_PATH"
pytest ${GITHUB_WORKSPACE}/tests/python/test_*