Skip to content

Commit 69b7c4e

Browse files
committed
Update workflows
1 parent b800c42 commit 69b7c4e

2 files changed

Lines changed: 58 additions & 11 deletions

File tree

Lines changed: 58 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,38 @@
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+
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, windows-latest, macos-latest]
61+
python-version: ["3.10", "3.11", "3.12", "3.13"]
62+
runs-on: ${{ matrix.os }}
63+
steps:
64+
- uses: actions/checkout@v4
65+
- name: Set up Python ${{ matrix.python-version }}
66+
uses: actions/setup-python@v5
67+
with:
68+
python-version: ${{ matrix.python-version }}
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+
env:
76+
cache-name: cache-hf-models
77+
with:
78+
path: ${{ env.HF_HUB_CACHE }}
79+
key: build-${{ env.cache-name }}-${{ hashFiles('tests/**/*.py') }}
80+
81+
- name: Install package
82+
shell: bash
83+
run: pip install pytest $(find ./dist -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)