Skip to content

ci(wasm): Build python tasks #1

ci(wasm): Build python tasks

ci(wasm): Build python tasks #1

name: Release Python
on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.event.number || github.run_id }}
cancel-in-progress: true
jobs:
build-js-worker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '21'
cache: 'npm'
cache-dependency-path: bindings/javascript/lyric-js-worker/package-lock.json
- name: Install JS dependencies
working-directory: bindings/javascript/lyric-js-worker
run: npm ci
- name: Build JS worker
working-directory: bindings/javascript/lyric-js-worker
run: npm run build
- name: Upload JS worker
uses: actions/upload-artifact@v4
with:
name: js-worker-wasm
path: bindings/javascript/lyric-js-worker/javascript_worker.wasm
linux:
needs: build-js-worker
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/download-artifact@v4
with:
name: js-worker-wasm
path: bindings/javascript/lyric-js-worker
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: bindings/python
command: build
args: --release --out dist
sccache: 'true'
manylinux: auto
- name: Build lyric-js-worker
run: |
cd bindings/python/lyric-js-worker
mkdir -p src/lyric_js_worker/
cp ../../javascript/lyric-js-worker/javascript_worker.wasm src/lyric_js_worker/
pip install build
python -m build
cp dist/*.whl ../../dist/
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: bindings/python/dist
musllinux:
needs: build-js-worker
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/download-artifact@v4
with:
name: js-worker-wasm
path: bindings/javascript/lyric-js-worker
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: bindings/python
command: build
args: --release --out dist
sccache: 'true'
manylinux: musllinux_1_2
- name: Build lyric-js-worker
run: |
cd bindings/python/lyric-js-worker
mkdir -p src/lyric_js_worker/
cp ../../javascript/lyric-js-worker/javascript_worker.wasm src/lyric_js_worker/
pip install build
python -m build
cp dist/*.whl ../../dist/
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: bindings/python/dist
windows:
needs: build-js-worker
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
architecture: ${{ matrix.platform.target }}
- uses: actions/download-artifact@v4
with:
name: js-worker-wasm
path: bindings/javascript/lyric-js-worker
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: bindings/python
command: build
args: --release --out dist
sccache: 'true'
- name: Build lyric-js-worker
shell: bash
run: |
cd bindings/python/lyric-js-worker
mkdir -p src/lyric_js_worker/
cp ../../javascript/lyric-js-worker/javascript_worker.wasm src/lyric_js_worker/
pip install build
python -m build
cp dist/*.whl ../../dist/
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: bindings/python/dist
macos:
needs: build-js-worker
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-12
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/download-artifact@v4
with:
name: js-worker-wasm
path: bindings/javascript/lyric-js-worker
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: bindings/python
command: build
args: --release --out dist
sccache: 'true'
- name: Build lyric-js-worker
run: |
cd bindings/python/lyric-js-worker
mkdir -p src/lyric_js_worker/
cp ../../javascript/lyric-js-worker/javascript_worker.wasm src/lyric_js_worker/
pip install build
python -m build
cp dist/*.whl ../../dist/
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: bindings/python/dist
sdist:
needs: build-js-worker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: js-worker-wasm
path: bindings/javascript/lyric-js-worker
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
working-directory: bindings/python
command: sdist
args: --out dist
- name: Build lyric-js-worker sdist
run: |
cd bindings/python/lyric-js-worker
mkdir -p src/lyric_js_worker/
cp ../../javascript/lyric-js-worker/javascript_worker.wasm src/lyric_js_worker/
pip install build
python -m build --sdist
cp dist/*.tar.gz ../../dist/
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: bindings/python/dist
#
# release:
# name: Release
# runs-on: ubuntu-latest
# if: startsWith(github.ref, 'refs/tags/')
# needs: [linux, musllinux, windows, macos, sdist]
# environment: release
# permissions:
# id-token: write
# steps:
# - uses: actions/download-artifact@v4
# with:
# pattern: wheels-*
# merge-multiple: true
# path: dist
# - name: Publish to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# packages-dir: dist/
# verbose: true
#
test-wheels:
name: Test Wheels
runs-on: ubuntu-latest
if: github.event_name != 'release'
needs: [linux, musllinux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install and test wheels
run: |
python -m pip install --find-links=dist lyric-js-worker