Skip to content

Fix windows builds

Fix windows builds #86

Workflow file for this run

# Copyright (C) 2023 Roberto Rossini ([email protected])
# SPDX-License-Identifier: MIT
name: Wheels
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- ".github/workflows/wheels.yml"
- "cmake/**"
- "src/**"
- "test/**"
- "CMakeLists.txt"
- "conanfile.txt"
- "pyproject.toml"
- "setup.cfg"
- "setup.py"
tags:
- 'v*.*.*'
pull_request:
paths:
- ".github/workflows/wheels.yml"
- "cmake/**"
- "src/**"
- "test/**"
- "CMakeLists.txt"
- "conanfile.txt"
- "pyproject.toml"
- "setup.cfg"
- "setup.py"
release:
types:
- published
# https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
CONAN_HOME: "${{ github.workspace }}/conan/"
CCACHE_DIR: "${{ github.workspace }}/ccache/"
jobs:
build-sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build SDist
run: pipx run build --sdist
- name: Check metadata
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v3
with:
name: sdist
path: dist/*.tar.gz
build-wheels-linux:
name: Wheels on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS_LINUX: x86_64
- name: Verify clean directory
run: git diff --exit-code
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels-linux
path: wheelhouse/*.whl
build-wheels-macos:
name: Wheels on macOS
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: |
pip3 install 'conan>=2' delocate
sudo conan profile detect --force
cd devel/cibw/macos/
sudo ./cibw_setup_deps.sh
- name: Build wheels
env:
HICTKPY_SETUP_SKIP_CONAN: '1'
CMAKE_ARGS: '-DCMAKE_PREFIX_PATH=/usr/local/share'
MACOSX_DEPLOYMENT_TARGET: '10.15'
run: pip wheel . -vv --no-deps
- name: Fix wheels
run: |
delocate-wheel --check-archs -v hictkpy*.whl
- name: Test wheels
run: |
wheel=(hictkpy*.whl)
pip install "${wheel[@]}[test]"
pytest test -v
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels-macos-py${{ matrix.python-version }}
path: ./*.whl
build-wheels-windows:
name: Wheels on Windows
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Generate cache key
id: cache-key
run: |
hash="${{ hashFiles('conanfile.txt', '.github/workflows/wheels.yml') }}"
echo "conan-key=pip-$hash" >> $GITHUB_OUTPUT
- name: Restore Conan cache
id: cache-conan
uses: actions/cache/restore@v3
with:
key: conan-${{ steps.cache-key.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}
- name: Build wheels
run: pip wheel . -vv --no-deps
- name: Save Conan cache
uses: actions/cache/save@v3
if: steps.cache-conan.outputs.cache-hit != 'true'
with:
key: conan-${{ steps.cache-key.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}
- name: Fix wheels
run: |
wheel=(hictkpy*.whl)
7zip x "*.whl
mkdir hictkpy
cp hictkpy*.pyd hictkpy/
find "$CONAN_HOME/p/" -type f -name deflate.dll -exec sh -c 'cp "$1 hictkpy/"' {} +
find "$CONAN_HOME/p/" -type f -name hdf5.dll -exec sh -c 'cp "$1 hictkpy/"' {} +
find "$CONAN_HOME/p/" -type f -name zlib.dll -exec sh -c 'cp "$1 hictkpy/"' {} +
rm "$wheel"
7zip a "$wheel" -tzip -r hictkpy-*.dist-info/ hictkpy/
- name: Test wheels
run: |
wheel=(hictkpy*.whl)
pip install "${wheel[@]}[test]"
pytest test -v
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels-windows-py${{ matrix.python-version }}
path: ./*.whl