Refactor CI #192
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: | |
name: Build Wheels | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, macos-12, macos-14, windows-2019] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
if: matrix.os == 'ubuntu-22.04' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: pypa/[email protected] | |
if: github.event_name == 'pull_request' | |
env: | |
CIBW_ARCHS_LINUX: "x86_64" | |
CIBW_ARCHS_WINDOWS: "AMD64" | |
- name: Build wheels | |
uses: pypa/[email protected] | |
if: github.event_name != 'pull_request' | |
env: | |
CIBW_ARCHS_LINUX: "x86_64 aarch64" | |
CIBW_ARCHS_WINDOWS: "AMD64" | |
- name: Verify clean directory | |
run: git diff --exit-code | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "wheels-${{ matrix.os }}" | |
path: wheelhouse/*.whl | |
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 |