Skip to content

Release

Release #3

Workflow file for this run

name: Release
# This workflow builds the wheels "on tag".
# If run from the hyperspy/rosettasciio repository, the wheels will be uploaded to pypi ;
# otherwise, the wheels will be available as a github artifact.
# Can also run on "workflow dispatch" to test building wheels
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch:
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }} ${{ matrix.CIBW_ARCHS }}
runs-on: ${{ matrix.os }}-latest
env:
CIBW_TEST_COMMAND: "pytest --pyargs rsciio"
CIBW_TEST_EXTRAS: "tests"
# No need to build wheels for pypy because the pure python wheels can be used
# PyPy documentation recommends no to build the C extension
CIBW_SKIP: "{pp*,*-musllinux*,*win32,*-manylinux_i686}"
strategy:
fail-fast: false
matrix:
include:
- os: "ubuntu"
CIBW_ARCHS: "x86_64"
- os: "ubuntu"
CIBW_ARCHS: "aarch64"
- os: "windows"
CIBW_ARCHS: "AMD64"
- os: "macos"
CIBW_ARCHS: "x86_64 universal2 arm64"
steps:
- name: Set up QEMU
if: contains(matrix.CIBW_ARCHS, 'aarch64')
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: actions/checkout@v4
- name: Build wheels for CPython
uses: pypa/[email protected]
env:
CIBW_ARCHS: ${{ matrix.CIBW_ARCHS }}
- name: List wheels
run: |
ls ./wheelhouse
- uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse/*.whl
if-no-files-found: error
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
pure_python_wheel:
# Build pure python without C extention to be used by pyodide
name: Make pure python wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build pure python wheel
run: DISABLE_C_EXTENTIONS=1 pipx run build --wheel
- uses: actions/upload-artifact@v3
with:
path: dist/*.whl
upload_to_pypi:
needs: [build_wheels, make_sdist]
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Download dist
uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- name: Display structure of downloaded files
run: ls -R
working-directory: dist
- uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'hyperspy' }}
# See https://docs.pypi.org/trusted-publishers/using-a-publisher/
create_release:
# TODO: once we are happy with the workflow
# setup zenodo to create a DOI automatically
needs: upload_to_pypi
permissions:
contents: write
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844