Update workflows #41
This file contains hidden or 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
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
| name: CI | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| env: | |
| HF_HUB_CACHE: hub_cache | |
| jobs: | |
| build: | |
| name: Build package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pdm-project/setup-pdm@v4 | |
| with: | |
| cache: true | |
| python-version: "3.12" | |
| - name: Cache HF models | |
| uses: actions/cache@v4 | |
| env: | |
| cache-name: cache-hf-models | |
| with: | |
| path: ${{ env.HF_HUB_CACHE }} | |
| key: build-${{ env.cache-name }}-${{ hashFiles('tests/**/*.py') }} | |
| - name: Install dependencies | |
| run: pdm sync | |
| - name: Lint code with Ruff | |
| run: pdm run ruff check --output-format=github | |
| - name: Check code formatting with Ruff | |
| run: pdm run ruff format --diff | |
| - name: Check types with MyPy | |
| run: pdm run mypy . | |
| - name: Test with pytest | |
| run: pdm run pytest | |
| - name: Build package dist | |
| run: pdm build | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels | |
| path: ./dist/onnx_asr-*.whl | |
| retention-days: 3 | |
| test: | |
| name: Test package | |
| needs: build | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: wheels | |
| path: ./dist | |
| - name: Cache HF models | |
| uses: actions/cache@v4 | |
| env: | |
| cache-name: cache-hf-models | |
| with: | |
| path: ${{ env.HF_HUB_CACHE }} | |
| key: build-${{ env.cache-name }}-${{ hashFiles('tests/**/*.py') }} | |
| - name: Install package | |
| shell: bash | |
| run: pip install pytest $(find ./dist -iname onnx_asr-*.whl)[cpu,hub] | |
| - name: Test with pytest | |
| run: pytest ./tests/onnx_asr |