Skip to content

v0.0.3

v0.0.3 #172

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@v4
with:
fetch-depth: 0
- name: Build SDist
run: pipx run build --sdist
- name: Check metadata
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
build-wheels-linux:
name: Wheels on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
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@v4
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.8', '3.9', '3.10', '3.11', '3.12' ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Generate cache key
id: cache-key
run: |
hash="${{ hashFiles('conanfile.txt') }}"
echo "conan-key=conan-macos-$hash" >> $GITHUB_OUTPUT
- name: Restore Conan cache
id: cache-conan
uses: actions/cache/restore@v3
with:
key: ${{ steps.cache-key.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}
- name: Build wheels
env:
MACOSX_DEPLOYMENT_TARGET: '10.15'
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: ${{ steps.cache-key.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}
- name: Fix wheels
run: |
pip install delocate
mkdir lib/
find "$CONAN_HOME/p/" -name '*.dylib' -exec cp '{}' lib/ \;
DYLD_LIBRARY_PATH="$PWD/lib/:/usr/local/lib:/usr/lib" \
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@v4
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.8', '3.9', '3.10', '3.11' ] #, '3.12' ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Generate cache key
id: cache-key
run: |
hash="${{ hashFiles('conanfile.txt') }}"
echo "conan-key=conan-windows-$hash" >> $GITHUB_OUTPUT
- name: Restore Conan cache
id: cache-conan
uses: actions/cache/restore@v3
with:
key: ${{ 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: ${{ steps.cache-key.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}
- name: Fix wheels
run: |
pip install delvewheel
mkdir dlls/
find "$CONAN_HOME/p/" -type f -name '*.dll' -exec cp '{}' dlls/ \;
delvewheel repair --add-path ./dlls/ hictkpy*.whl
- name: Test wheels
run: |
wheel=(wheelhouse/hictkpy*.whl)
pip install "${wheel[@]}[test]"
pytest test -v
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-py${{ matrix.python-version }}
path: wheelhouse/*.whl
package-artifacts:
name: Package artifacts
runs-on: ubuntu-latest
needs:
- build-sdist
- build-wheels-linux
- build-wheels-macos
- build-wheels-windows
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Archive artifacts
run: |
mkdir dist/
find artifacts -type f -name "hictkpy*.whl" -exec cp '{}' dist/ \;
find artifacts -type f -name "hictkpy*.tar.gz" -exec cp '{}' dist/ \;
tar -cf dist.tar dist/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist.tar