-
Notifications
You must be signed in to change notification settings - Fork 31
83 lines (74 loc) · 2.22 KB
/
python-package.yml
File metadata and controls
83 lines (74 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# 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
with:
path: ${{ env.HF_HUB_CACHE }}
key: cache-hf-models-${{ 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
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [Ubuntu, Windows, macOS]
python-version: ["3.10", "3.11", "3.12", "3.13"]
numpy-version: [numpy==1.*, numpy==2.*]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- uses: actions/download-artifact@v4
with:
name: wheels
path: ./dist
- name: Cache HF models
uses: actions/cache@v4
with:
path: ${{ env.HF_HUB_CACHE }}
key: cache-hf-models-${{ hashFiles('tests/**/*.py') }}
- name: Install package
shell: bash
run: pip install pytest ${{ matrix.numpy-version }} $(find ./dist -iname onnx_asr-*.whl)[cpu,hub]
- name: Test with pytest
run: pytest ./tests/onnx_asr