Skip to content

Commit 7839972

Browse files
committed
Update workflows
1 parent b800c42 commit 7839972

2 files changed

Lines changed: 57 additions & 10 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,36 @@
33

44
name: Python package
55

6+
permissions:
7+
contents: read
8+
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+
env:
31+
cache-name: cache-hf-models
32+
with:
33+
path: ${{ env.HF_HUB_CACHE }}
34+
key: build-${{ env.cache-name }}-${{ hashFiles('tests/**/*.py') }}
35+
2836
- name: Install dependencies
2937
run: pdm sync
3038
- name: Lint code with Ruff
@@ -35,3 +43,43 @@ jobs:
3543
run: pdm run mypy .
3644
- name: Test with pytest
3745
run: pdm run pytest
46+
- name: Build package dist
47+
run: pdm build
48+
49+
- uses: actions/upload-artifact@v4
50+
with:
51+
name: wheels
52+
path: ./dist/onnx_asr-*.whl
53+
retention-days: 3
54+
55+
test:
56+
name: Test package
57+
needs: build
58+
strategy:
59+
matrix:
60+
os: [ubuntu-latest]
61+
python-version: ["3.10"]
62+
#os: [ubuntu-latest, windows-latest, macos-latest]
63+
#python-version: ["3.10", "3.11", "3.12", "3.13"]
64+
runs-on: ${{ matrix.os }}
65+
steps:
66+
- uses: actions/checkout@v4
67+
- name: Set up Python ${{ matrix.python-version }}
68+
uses: actions/setup-python@v5
69+
with:
70+
python-version: ${{ matrix.python-version }}
71+
- uses: actions/download-artifact@v4
72+
with:
73+
name: wheels
74+
- name: Cache HF models
75+
uses: actions/cache@v4
76+
env:
77+
cache-name: cache-hf-models
78+
with:
79+
path: ${{ env.HF_HUB_CACHE }}
80+
key: build-${{ env.cache-name }}-${{ hashFiles('tests/**/*.py') }}
81+
82+
- name: Install package
83+
run: pip install pytest $(find . -iname onnx_asr-*.whl)[cpu,hub]
84+
- name: Test with pytest
85+
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)