-
Notifications
You must be signed in to change notification settings - Fork 52
55 lines (47 loc) · 1.4 KB
/
run_pytest.yml
File metadata and controls
55 lines (47 loc) · 1.4 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
name: pytest
on:
push:
branches: [main, dev/*] # 触发分支
tags: ["v*"]
pull_request:
branches: [main, dev/*]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.13"]
steps:
- uses: actions/checkout@v4 # 检出代码
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
else
curl -LsSf https://astral.sh/uv/install.sh | sh
fi
shell: bash
- name: Setup uv cache
uses: actions/cache@v4
with:
path: |
~/.cache/uv
~/AppData/Local/uv/cache
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock', 'pyproject.toml')}}
restore-keys: |
${{ runner.os }}-uv-
- name: Install dependencies with uv
run: |
uv sync -v
- name: Run tests with pytest
run: uv run pytest -v --cov=zsim --cov-report=html
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report-html-${{ matrix.os }}
path: htmlcov