Repository navigation
166 lines (141 loc) · 4.94 KB
/
Copy pathunit_test.yml
File metadata and controls
166 lines (141 loc) · 4.94 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Unit Tests
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
jobs:
current:
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, 'docs:')) }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# ubuntu-latest (26.04) ships no CPython 3.9 build, so pin the
# still-supported 3.9 leg to 24.04 and keep the rest on latest.
include:
- os: ubuntu-24.04
python-version: '3.9'
- os: ubuntu-latest
python-version: '3.10'
- os: ubuntu-latest
python-version: '3.11'
- os: ubuntu-latest
python-version: '3.12'
- os: ubuntu-latest
python-version: '3.13'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Update setuptools
run: |
pip install --upgrade pip
pip install setuptools==68.2.2 wheel==0.41.2
- name: Set PYTHONPATH
run: |
echo "PYTHONPATH=$PYTHONPATH:${{ github.workspace }}/src" >> $GITHUB_ENV
- name: Install dependencies
run: |
export PIP_DEFAULT_TIMEOUT=300
pip install -r requirements.txt
pip install -r requirements-test.txt
- name: Show installed pip packages (versions)
run: |
python -m pip list --format=columns
- name: Cache Qwen tokenizer vocab
uses: actions/cache@v4
with:
path: ~/.cache/dashscope/tokenizers
key: qwen-tokenizer-vocab-v1
# ModelScope downloads from GitHub runners time out intermittently;
# pre-fetch with retries so network blips don't fail the test matrix.
- name: Pre-download Qwen tokenizer vocab
run: |
python - <<'EOF'
import time
from dashscope.legacy_1x.tokenizers import tokenizer as t
for attempt in range(1, 6):
try:
print("vocab ready:", t._resolve_vocab_path())
break
except RuntimeError as exc:
print(f"attempt {attempt}/5 failed: {exc}")
if attempt == 5:
raise SystemExit(1)
time.sleep(5 * attempt)
EOF
- name: Run current tests with coverage
run: |
coverage run -m pytest tests --ignore=tests/legacy_1x
- name: Generate coverage report
run: |
coverage report -m
legacy:
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, 'docs:')) }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Update setuptools
run: |
pip install --upgrade pip
pip install setuptools==68.2.2 wheel==0.41.2
- name: Set PYTHONPATH
run: |
echo "PYTHONPATH=$PYTHONPATH:${{ github.workspace }}/src" >> $GITHUB_ENV
- name: Install dependencies
run: |
export PIP_DEFAULT_TIMEOUT=300
pip install -r requirements.txt
pip install -r requirements-test.txt
- name: Cache Qwen tokenizer vocab
uses: actions/cache@v4
with:
path: ~/.cache/dashscope/tokenizers
key: qwen-tokenizer-vocab-v1
# ModelScope downloads from GitHub runners time out intermittently;
# pre-fetch with retries so network blips don't fail the test matrix.
- name: Pre-download Qwen tokenizer vocab
run: |
python - <<'EOF'
import time
from dashscope.legacy_1x.tokenizers import tokenizer as t
for attempt in range(1, 6):
try:
print("vocab ready:", t._resolve_vocab_path())
break
except RuntimeError as exc:
print(f"attempt {attempt}/5 failed: {exc}")
if attempt == 5:
raise SystemExit(1)
time.sleep(5 * attempt)
EOF
- name: Run archived legacy tests
run: |
python -m pytest tests/legacy_1x