Skip to content

Commit 537a681

Browse files
committed
Update workflows
1 parent 50ec38e commit 537a681

2 files changed

Lines changed: 56 additions & 11 deletions

File tree

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
33

4-
name: Python package
4+
name: CI
5+
6+
permissions:
7+
contents: read
58

69
on:
710
push:
811
branches: [ "main" ]
912
pull_request:
1013
branches: [ "main" ]
1114

15+
env:
16+
HF_HUB_CACHE: hub_cache
17+
1218
jobs:
1319
build:
14-
20+
name: Build package
1521
runs-on: ubuntu-latest
16-
strategy:
17-
fail-fast: false
18-
matrix:
19-
python-version: ["3.10", "3.11", "3.12"]
20-
2122
steps:
2223
- uses: actions/checkout@v4
2324
- uses: pdm-project/setup-pdm@v4
24-
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v3
2625
with:
27-
python-version: ${{ matrix.python-version }}
26+
cache: true
27+
python-version: "3.12"
28+
- name: Cache HF models
29+
uses: actions/cache@v4
30+
with:
31+
path: ${{ env.HF_HUB_CACHE }}
32+
key: cache-hf-models-${{ hashFiles('tests/**/*.py') }}
33+
2834
- name: Install dependencies
2935
run: pdm sync
3036
- name: Lint code with Ruff
@@ -35,3 +41,43 @@ jobs:
3541
run: pdm run mypy .
3642
- name: Test with pytest
3743
run: pdm run pytest
44+
- name: Build package dist
45+
run: pdm build
46+
47+
- uses: actions/upload-artifact@v4
48+
with:
49+
name: wheels
50+
path: ./dist/onnx_asr-*.whl
51+
retention-days: 3
52+
53+
test:
54+
name: Test package
55+
needs: build
56+
runs-on: ${{ matrix.os }}-latest
57+
strategy:
58+
matrix:
59+
os: [Ubuntu, Windows, macOS]
60+
python-version: ["3.10", "3.11", "3.12", "3.13"]
61+
numpy-version: [numpy==1.*, numpy==2.*]
62+
steps:
63+
- uses: actions/checkout@v4
64+
- name: Set up Python ${{ matrix.python-version }}
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version: ${{ matrix.python-version }}
68+
cache: 'pip'
69+
- uses: actions/download-artifact@v4
70+
with:
71+
name: wheels
72+
path: ./dist
73+
- name: Cache HF models
74+
uses: actions/cache@v4
75+
with:
76+
path: ${{ env.HF_HUB_CACHE }}
77+
key: cache-hf-models-${{ hashFiles('tests/**/*.py') }}
78+
79+
- name: Install package
80+
shell: bash
81+
run: pip install pytest ${{ matrix.numpy-version }} $(find ./dist -iname onnx_asr-*.whl)[cpu,hub]
82+
- name: Test with pytest
83+
run: pytest ./tests/onnx_asr

.github/workflows/python-publish.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v4
2323
- uses: pdm-project/setup-pdm@v4
24-
- uses: actions/setup-python@v5
2524
with:
2625
python-version: "3.12"
2726

0 commit comments

Comments
 (0)