Skip to content

Test hictkpy against Python 3.13 #442

Test hictkpy against Python 3.13

Test hictkpy against Python 3.13 #442

Workflow file for this run

# Copyright (C) 2023 Roberto Rossini (roberros@uio.no)
# SPDX-License-Identifier: MIT
name: Build wheels
on:
workflow_dispatch:
push:
branches: [main]
paths:
- ".github/workflows/build-conan-deps.yml"
- ".github/workflows/wheels.yml"
- "cmake/**"
- "src/**"
- "test/**"
- "utils/devel/stubgen.py"
- "CMakeLists.txt"
- "conanfile.py"
- "pyproject.toml"
tags:
- "v*.*.*"
pull_request:
paths:
- ".github/workflows/build-conan-deps.yml"
- ".github/workflows/wheels.yml"
- "cmake/**"
- "src/**"
- "test/**"
- "utils/devel/stubgen.py"
- "CMakeLists.txt"
- "conanfile.py"
- "pyproject.toml"
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
jobs:
matrix-factory:
name: Generate job matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-result.outputs.matrix }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install cibuildwheel
run: pip install 'cibuildwheel>=2.21'
- name: Generate matrix
id: set-result
run: |
CIBW_ARCHS_LINUX=x86_64 cibuildwheel \
--print-build-identifiers \
--platform linux |
jq -nRc '{"wheel-config": inputs, "os": "ubuntu-latest", "arch": "x86_64"}' |
tee configs.json
if [ '${{ github.event_name }}' != 'pull_request' ]; then
CIBW_ARCHS_LINUX=aarch64 cibuildwheel \
--print-build-identifiers \
--platform linux |
jq -nRc '{"wheel-config": inputs, "os": "ubuntu-latest", "arch": "aarch64"}' |
tee -a configs.json
fi
CIBW_ARCHS_MACOS=x86_64 cibuildwheel \
--print-build-identifiers \
--platform macos |
jq -nRc '{"wheel-config": inputs, "os": "macos-13", "arch": "x86_64"}' |
tee -a configs.json
CIBW_ARCHS_MACOS=arm64 cibuildwheel \
--print-build-identifiers \
--platform macos |
jq -nRc '{"wheel-config": inputs, "os": "macos-14", "arch": "arm64"}' |
tee -a configs.json
CIBW_ARCHS_WINDOWS=AMD64 cibuildwheel \
--print-build-identifiers \
--platform windows |
jq -nRc '{"wheel-config": inputs, "os": "windows-2019", "arch": "AMD64"}' |
tee -a configs.json
MATRIX="$(jq -sc < configs.json)"
echo "matrix={\"include\": $MATRIX }" | tee -a "$GITHUB_OUTPUT"
build-conan-deps-linux-x86:
name: Build Conan deps (Linux x86_64)
uses: paulsengroup/hictkpy/.github/workflows/build-conan-deps.yml@main
with:
arch: x86_64
os: manylinux_2_28
build-conan-deps-linux-arm64:
name: Build Conan deps (Linux arm64)
uses: paulsengroup/hictkpy/.github/workflows/build-conan-deps.yml@main
with:
arch: aarch64
os: manylinux_2_28
build-conan-deps-macos-x86:
name: Build Conan deps (macOS x86_64)
uses: paulsengroup/hictkpy/.github/workflows/build-conan-deps.yml@main
with:
arch: x86_64
os: macos-13
build-conan-deps-macos-arm64:
name: Build Conan deps (macOS arm64)
uses: paulsengroup/hictkpy/.github/workflows/build-conan-deps.yml@main
with:
arch: arm64
os: macos-14
build-conan-deps-windows-x86:
name: Build Conan deps (Windows x86_64)
uses: paulsengroup/hictkpy/.github/workflows/build-conan-deps.yml@main
with:
arch: AMD64
os: windows-2019
build-sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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:
name: Build Wheels
needs:
- matrix-factory
- build-conan-deps-linux-x86
- build-conan-deps-linux-arm64
- build-conan-deps-macos-x86
- build-conan-deps-macos-arm64
- build-conan-deps-windows-x86
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix-factory.outputs.matrix) }}
env:
CONAN_HOME: "${{ github.workspace }}/.conan2"
HICTKPY_CONAN_INSTALL_ARGS: "--settings=compiler.cppstd=17;--settings=build_type=Release;--build=never;--options=*/*:shared=False"
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
if: startsWith(matrix.os, 'ubuntu')
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Restore Conan cache (Linux; x86_64)
if: startsWith(matrix.os, 'ubuntu') && matrix.arch == 'x86_64'
uses: actions/cache/restore@v4
with:
key: ${{ needs.build-conan-deps-linux-x86.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}/p
fail-on-cache-miss: true
- name: Restore Conan cache (Linux; aarch64)
if: |
github.event_name != 'pull_request' &&
startsWith(matrix.os, 'ubuntu') &&
matrix.arch == 'aarch64'
uses: actions/cache/restore@v4
with:
key: ${{ needs.build-conan-deps-linux-arm64.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}/p
fail-on-cache-miss: true
- name: Restore Conan cache (macOS; x86_64)
if: startsWith(matrix.os, 'macos') && matrix.arch == 'x86_64'
uses: actions/cache/restore@v4
with:
key: ${{ needs.build-conan-deps-macos-x86.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}/p
fail-on-cache-miss: true
- name: Restore Conan cache (macOS; aarch64)
if: startsWith(matrix.os, 'macos') && matrix.arch == 'arm64'
uses: actions/cache/restore@v4
with:
key: ${{ needs.build-conan-deps-macos-arm64.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}/p
fail-on-cache-miss: true
- name: Restore Conan cache (Windows; AMD64)
if: startsWith(matrix.os, 'windows') && matrix.arch == 'AMD64'
uses: actions/cache/restore@v4
with:
key: ${{ needs.build-conan-deps-windows-x86.outputs.conan-key }}
path: ${{ needs.build-conan-deps-windows-x86.outputs.conan-home }}\p
fail-on-cache-miss: true
- name: Build wheels
uses: pypa/cibuildwheel@v2.21
with:
only: ${{ matrix.wheel-config }}
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_ENVIRONMENT_LINUX: >
PIP_VERBOSE=1
HICTK_CI=1
CONAN_HOME='/host${{ env.CONAN_HOME }}'
CIBW_ENVIRONMENT_MACOS: >
CC=clang
CXX=clang++
PIP_VERBOSE=1
HICTK_CI=1
MACOSX_DEPLOYMENT_TARGET=10.15
HICTKPY_CONAN_INSTALL_ARGS="${{ env.HICTKPY_CONAN_INSTALL_ARGS }};-s:h os.version=${{ env.MACOSX_DEPLOYMENT_TARGET }}"
CIBW_ENVIRONMENT_WINDOWS: >
PIP_VERBOSE=1
HICTK_CI=1
CIBW_ENVIRONMENT_PASS_LINUX: >
CONAN_HOME
HICTKPY_CONAN_INSTALL_ARGS
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
- name: Verify clean directory
run: git diff --exit-code
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: "wheels-${{ matrix.wheel-config }}"
path: wheelhouse/*.whl
if-no-files-found: error
retention-days: 1
package-artifacts:
name: Package artifacts
runs-on: ubuntu-latest
needs:
- build-sdist
- build-wheels
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
if-no-files-found: error
retention-days: 7
pypi-publish:
name: Upload release to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
needs: [package-artifacts]
environment:
name: PyPI
url: https://pypi.org/p/hictkpy
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
merge-multiple: true
- name: Extract dist.tar
run: |
tar -xf dist.tar
rm dist.tar
- name: Upload wheels to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
print-hash: true
verbose: true
build-wheels-status-check:
name: Status Check (Build wheels)
if: ${{ always() }}
runs-on: ubuntu-latest
needs:
- build-sdist
- build-wheels
- package-artifacts
- pypi-publish
steps:
- name: Collect job results
if: |
needs.build-sdist.result != 'success' ||
needs.build-wheels.result != 'success' ||
needs.package-artifacts.result != 'success' ||
(
needs.pypi-publish.result != 'success' &&
needs.pypi-publish.result != 'skipped'
)
run: exit 1