Repository navigation
67 lines (54 loc) · 1.51 KB
/
Copy pathtest-python.yml
File metadata and controls
67 lines (54 loc) · 1.51 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
name: Python
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre-commit:
name: Run pre-commit on Python code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/setup-python@v7.1.0
with:
python-version: "3.11"
# Use ruff-action so we get annotations in the Github UI
- uses: astral-sh/ruff-action@v4.1.0
- name: Cache pre-commit virtualenvs
uses: actions/cache@v6.1.0
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ hashFiles('.pre-commit-config.yaml') }}
- name: run pre-commit
run: |
python -m pip install pre-commit
pre-commit run --all-files
test-python:
name: Build and test Python
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v7.0.1
- name: Install uv
uses: astral-sh/setup-uv@v10.3.3
with:
enable-cache: true
version: "0.5.x"
- name: Set up Python
run: uv python install ${{ matrix.python-version }}
- name: Run python tests
run: |
uv run pytest tests
# Ensure docs build without warnings
- name: Check docs
if: "${{ matrix.python-version == 3.11 }}"
run: uv run mkdocs build --strict