ci: add pyodide build #94
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
name: Release | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- .github/workflows/release.yml | |
env: | |
# Latest Jupyter requires this to acknowledge deprecation | |
JUPYTER_PLATFORM_DIRS: 1 | |
jobs: | |
release_check: | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.tag.outputs.tag }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- if: ${{ github.ref == 'refs/heads/main' }} | |
run: python .ci/release_check.py | |
- id: tag | |
run: echo "tag=$(python version.py)" >> $GITHUB_OUTPUT | |
wheels: | |
needs: release_check | |
name: ${{ matrix.py }} ${{ matrix.os }} ${{ matrix.arch }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-13, macos-14] | |
arch: [auto, aarch64] | |
py: [cp38, cp39, cp310, cp311, cp312] | |
exclude: | |
- os: windows-latest | |
arch: aarch64 | |
- os: macos-13 | |
arch: aarch64 | |
- os: macos-14 | |
arch: aarch64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- if: ${{ matrix.arch == 'aarch64' }} | |
uses: docker/setup-qemu-action@v3 | |
- uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: ${{ matrix.py }}-* | |
CIBW_ARCHS: ${{ matrix.arch }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheel-${{ matrix.py }}-${{ matrix.os }}-${{ matrix.arch }} | |
path: ./wheelhouse/*.whl | |
pyodide: | |
needs: release_check | |
name: Pyodide | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- uses: pypa/cibuildwheel@main | |
env: | |
CIBW_PLATFORM: pyodide | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pyodide | |
path: ./wheelhouse/*.whl | |
sdist: | |
needs: release_check | |
name: source package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- run: pipx run build --sdist | |
- run: python -m pip install --upgrade pip setuptools | |
- run: python -m pip install -v $(echo dist/iminuit-*)[test] | |
- run: python -m pytest | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheel-sdist | |
path: dist/*.tar.gz | |
upload: | |
needs: [wheels, sdist] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
attestations: write | |
contents: read | |
if: ${{ github.ref == 'refs/heads/main' }} | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: "wheel-*" | |
merge-multiple: true | |
path: dist | |
- name: Generate artifact attestation for sdist and wheels | |
uses: actions/attest-build-provenance@173725a1209d09b31f9d30a3890cf2757ebbff0d # v1.1.2 | |
with: | |
subject-path: "dist/iminuit-*" | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{secrets.pypi_password}} | |
release: | |
needs: [release_check, upload] | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/main' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: softprops/action-gh-release@v2 | |
with: | |
name: v${{ needs.release_check.outputs.tag }} | |
tag_name: v${{ needs.release_check.outputs.tag }} | |
target_commitish: ${{ github.ref_name }} | |
generate_release_notes: true |