forked from papicapital/hl-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (72 loc) · 2.15 KB
/
ci.yml
File metadata and controls
86 lines (72 loc) · 2.15 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
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
validate:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install Dependencies
shell: bash
run: uv sync --all-packages --all-extras --dev
- name: Load Cached Pre-Commit Dependencies
id: cached-pre-commit-dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit/
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Execute Pre-Commit
run: uv run pre-commit run --show-diff-on-failure --color=always --all-files
test:
strategy:
matrix:
python: ${{ github.event_name == 'pull_request' && fromJSON('["3.13"]') || fromJSON('["3.11", "3.12", "3.13"]') }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ matrix.python }}
- name: Cache Python Dependencies
id: python-cache
uses: actions/cache@v4
with:
path: |
~/.cache/uv
.venv
key: python-dependencies-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('uv.lock') }}
restore-keys: |
python-dependencies-${{ matrix.python }}-
- name: Install Dependencies
shell: bash
run: uv sync --all-packages --all-extras --dev --locked
- name: Cache Test Artifacts
uses: actions/cache@v4
with:
path: .pytest_cache/
key: pytest-cache-${{ matrix.python }}
- name: Run Tests
run: uv run pytest -s