Skip to content

Commit 46b220e

Browse files
committed
chore: add test action
1 parent 543e0c1 commit 46b220e

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/check.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches: [dev]
6+
paths:
7+
- "**.py"
8+
- ".github/workflows/check.yaml"
9+
- "pyproject.toml"
10+
pull_request:
11+
branches: [dev, main]
12+
paths:
13+
- "**.py"
14+
- ".github/workflows/check.yaml"
15+
- "pyproject.toml"
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
env:
21+
UV_CACHE_DIR: /tmp/.uv-cache
22+
strategy:
23+
matrix:
24+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
25+
26+
name: check ${{ matrix.python-version }}
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Set up uv
31+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
32+
33+
- name: Set up Python ${{ matrix.python-version }}
34+
id: setup-python
35+
run: |
36+
uv python install ${{ matrix.python-version }}
37+
uv python pin ${{ matrix.python-version }}
38+
uv lock
39+
PY=$(uv run python -VV | shasum -a 256 | cut -d' ' -f1)
40+
echo PY: $PY
41+
echo "PY=$PY" >> "$GITHUB_OUTPUT"
42+
43+
- name: Restore uv cache
44+
uses: actions/cache@v4
45+
id: uv-cache
46+
with:
47+
path: ${{ env.UV_CACHE_DIR }}
48+
key: uv-${{ steps.setup-python.outputs.PY }}-${{ hashFiles('uv.lock') }}
49+
restore-keys: |
50+
uv-${{ steps.setup-python.outputs.PY }}-${{ hashFiles('uv.lock') }}
51+
uv-${{ steps.setup-python.outputs.PY }}
52+
53+
- name: Install dependencies
54+
if: steps.uv-cache.outputs.cache-hit != 'true'
55+
run: uv sync
56+
57+
- name: Test with pytest
58+
run: |
59+
uv run pytest
60+
61+
- name: Minimize uv cache
62+
run: uv cache prune --ci

0 commit comments

Comments
 (0)