Skip to content

ci(test): Test build python tasks #2

ci(test): Test build python tasks

ci(test): Test build python tasks #2

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: '18'
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: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Rye
run: |
curl -sSf https://rye-up.com/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
- uses: actions/download-artifact@v4
with:
name: js-worker-wasm
path: bindings/javascript/lyric-js-worker
- name: Build packages
run: |
cd bindings/python
rye sync
# Build lyric-task
cd lyric-task
rye build
cp dist/*.whl ../dist/
cd ..
# Build lyric-py-worker
cd lyric-py-worker
rye build
cp dist/*.whl ../dist/
cd ..
# Build lyric-js-worker
cd lyric-js-worker
mkdir -p src/lyric_js_worker/
cp ../../javascript/lyric-js-worker/javascript_worker.wasm src/lyric_js_worker/
rye build
cp dist/*.whl ../dist/
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux
path: bindings/python/dist
musllinux:
needs: build-js-worker
runs-on: ubuntu-latest
container:
image: quay.io/pypa/musllinux_1_1_x86_64
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: js-worker-wasm
path: bindings/javascript/lyric-js-worker
- name: Install build dependencies
run: |
pip3 install rye
- name: Build packages
run: |
cd bindings/python
rye sync
# Build lyric-task
cd lyric-task
rye build
cp dist/*.whl ../dist/
cd ..
# Build lyric-py-worker
cd lyric-py-worker
rye build
cp dist/*.whl ../dist/
cd ..
# Build lyric-js-worker
cd lyric-js-worker
mkdir -p src/lyric_js_worker/
cp ../../javascript/lyric-js-worker/javascript_worker.wasm src/lyric_js_worker/
rye build
cp dist/*.whl ../dist/
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux
path: bindings/python/dist
windows:
needs: build-js-worker
strategy:
matrix:
arch: [x64, x86]
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
architecture: ${{ matrix.arch }}
- name: Install Rye
shell: bash
run: |
curl -sSf https://rye-up.com/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
- uses: actions/download-artifact@v4
with:
name: js-worker-wasm
path: bindings/javascript/lyric-js-worker
- name: Build packages
shell: bash
run: |
cd bindings/python
rye sync
# Build lyric-task
cd lyric-task
rye build
cp dist/*.whl ../dist/
cd ..
# Build lyric-py-worker
cd lyric-py-worker
rye build
cp dist/*.whl ../dist/
cd ..
# Build lyric-js-worker
cd lyric-js-worker
mkdir -p src/lyric_js_worker/
cp ../../javascript/lyric-js-worker/javascript_worker.wasm src/lyric_js_worker/
rye build
cp dist/*.whl ../dist/
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.arch }}
path: bindings/python/dist
macos:
needs: build-js-worker
strategy:
matrix:
include:
- runner: macos-12
target: x86_64
- runner: macos-14
target: aarch64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Rye
run: |
brew install rye
- uses: actions/download-artifact@v4
with:
name: js-worker-wasm
path: bindings/javascript/lyric-js-worker
- name: Build packages
run: |
cd bindings/python
rye sync
# Build lyric-task
cd lyric-task
rye build
cp dist/*.whl ../dist/
cd ..
# Build lyric-py-worker
cd lyric-py-worker
rye build
cp dist/*.whl ../dist/
cd ..
# Build lyric-js-worker
cd lyric-js-worker
mkdir -p src/lyric_js_worker/
cp ../../javascript/lyric-js-worker/javascript_worker.wasm src/lyric_js_worker/
rye build
cp dist/*.whl ../dist/
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.target }}
path: bindings/python/dist
sdist:
needs: build-js-worker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Rye
run: |
curl -sSf https://rye-up.com/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
- uses: actions/download-artifact@v4
with:
name: js-worker-wasm
path: bindings/javascript/lyric-js-worker
- name: Build sdist
run: |
cd bindings/python
rye sync
# Build lyric-task
cd lyric-task
rye build --sdist
cp dist/*.tar.gz ../dist/
cd ..
# Build lyric-py-worker
cd lyric-py-worker
rye build --sdist
cp dist/*.tar.gz ../dist/
cd ..
# Build lyric-js-worker
cd lyric-js-worker
mkdir -p src/lyric_js_worker/
cp ../../javascript/lyric-js-worker/javascript_worker.wasm src/lyric_js_worker/
rye 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: |
pip install --find-links=dist lyric-js-worker