Publish WASM codecs #26
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: Publish WASM codecs | |
on: | |
workflow_dispatch: | |
inputs: | |
codecs: | |
description: 'Regular expression for the codecs to be published, e.g. "log|round"' | |
required: true | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
wasm-codecs: | |
name: Build the WASM codecs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the Repository | |
uses: actions/checkout@v2 | |
- name: Install nix | |
uses: cachix/install-nix-action@v27 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
- name: Install the Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
- name: Build the selected codecs | |
run: | | |
cd py/numcodecs-wasm-materialize | |
uv sync && uv pip install . | |
uv run python3 -m numcodecs_wasm_materialize ${{ github.event.inputs.codecs }} | |
- name: Test importing the WASM codecs | |
run: | | |
mkdir -p py/test | |
cd py/test | |
uv venv | |
uv pip install ../numcodecs-wasm-materialize/dist/*.whl | |
uv run python3 -c "import importlib; from pathlib import Path; [print(importlib.import_module(p.name.split('-')[0])) for p in sorted((Path('..') / 'numcodecs-wasm-materialize' / 'dist').glob('*.whl'))]" | |
- name: Upload the WASM codec artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wasm-codecs | |
path: py/numcodecs-wasm-materialize/dist | |
PyPi: | |
name: Publish the sdist and wheels | |
runs-on: ubuntu-latest | |
needs: wasm-codecs | |
environment: publish | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Download the WASM codec artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: wasm-codecs | |
path: dist | |
- name: List the built dist files | |
run: ls -lh dist/ | |
- name: Publish the package | |
uses: pypa/gh-action-pypi-publish@release/v1 |