Skip to content

Add prebuilt Packages #23

Add prebuilt Packages

Add prebuilt Packages #23

Workflow file for this run

name: CI
on:
push:
branches: [ "main" ]
tags:
- v*
pull_request:
branches: [ "main" ]
jobs:
check-python-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Setup UV
uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Install dependencies
run: |
uv pip install --system black==24.* flake8==7.* flake8-pyproject==1.* isort==5.*
- name: Check code format with Black
run: |
black --check ctc_forced_aligner/*.py
- name: Check imports order with isort
run: |
isort --check-only ctc_forced_aligner/*.py
- name: Check code style with Flake8
run: |
flake8 ctc_forced_aligner/*.py
build-python-wheels:
needs: [check-python-style]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macos-14]
arch: [auto64]
include:
- os: ubuntu-20.04
arch: aarch64
- os: windows-2019
arch: ARM64
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: docker/setup-qemu-action@v3
if: ${{ matrix.arch == 'aarch64' }}
name: Set up QEMU
- name: Setup UV
uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Build wheels
uses: pypa/cibuildwheel@v2.22
with:
output-dir: python/wheelhouse
env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_SKIP: pp* *-musllinux_*
CIBW_BUILD_FRONTEND: "build[uv]"
- name: Upload Python wheels
uses: actions/upload-artifact@v4
with:
name: python-wheels-${{ runner.os }}-${{ matrix.arch }}
path: python/wheelhouse
test-python-wheels:
# We could test the Python wheels using cibuildwheel but we prefer to run the tests outside
# the build environment to ensure wheels correctly embed all dependencies.
needs: [build-python-wheels]
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-20.04, windows-2019, macos-14]
arch: [auto64]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download Python wheels
uses: actions/download-artifact@v4
with:
pattern: python-wheels-${{ runner.os }}-${{ matrix.arch }}
merge-multiple: true
path: wheels
- name: Setup UV
uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Install wheel
shell: bash
run: |
wheel_name=$(find wheels -type f -name "*$(echo ${{ matrix.python-version }} | tr -d '.')*")
uv pip install --system "pytest-xdist" "$wheel_name[dev]" --extra-index-url https://download.pytorch.org/whl/cpu
- name: Run tests
shell: bash
run: |
pytest -v -n 2 tests/
publish-python-wheels-on-pypi:
needs: [test-python-wheels]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Download Python wheels
uses: actions/download-artifact@v4
with:
pattern: python-wheels-*
merge-multiple: true
path: .
- name: Publish Python wheels to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: .