Skip to content

Commit d80bf3f

Browse files
committed
Initial GitHub workflows for Python library
1 parent 65a7091 commit d80bf3f

File tree

4 files changed

+121
-0
lines changed

4 files changed

+121
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Check uv.lock
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "pyproject.toml"
7+
- "uv.lock"
8+
push:
9+
paths:
10+
- "pyproject.toml"
11+
- "uv.lock"
12+
13+
jobs:
14+
check-lock:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install uv
20+
run: |
21+
curl -LsSf https://astral.sh/uv/install.sh | sh
22+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
23+
24+
- name: Check uv.lock is up to date
25+
run: uv lock --check

.github/workflows/checks.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Main branch checks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- "v*.*.*"
8+
tags:
9+
- "v*.*.*"
10+
11+
jobs:
12+
checks:
13+
uses: ./.github/workflows/python-checks.yml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Pull request checks
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
checks:
8+
uses: ./.github/workflows/python-checks.yml
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Python Checks
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
format:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v3
14+
with:
15+
enable-cache: true
16+
17+
- name: "Set up Python"
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version-file: "src/python/.python-version"
21+
22+
- name: Install the project
23+
run: uv sync --frozen --all-extras --dev
24+
working-directory: ./src/python
25+
26+
- name: Run ruff format check
27+
run: uv run --frozen ruff check .
28+
working-directory: ./src/python
29+
30+
typecheck:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Install uv
36+
uses: astral-sh/setup-uv@v3
37+
with:
38+
enable-cache: true
39+
40+
- name: "Set up Python"
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version-file: "src/python/.python-version"
44+
45+
- name: Install the project
46+
run: uv sync --frozen --all-extras --dev
47+
working-directory: ./src/python
48+
49+
- name: Run pyright
50+
run: uv run --frozen pyright
51+
working-directory: ./src/python
52+
53+
build:
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- uses: actions/checkout@v4
58+
59+
- name: Install uv
60+
uses: astral-sh/setup-uv@v3
61+
with:
62+
enable-cache: true
63+
64+
- name: "Set up Python"
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version-file: "src/python/.python-version"
68+
69+
- name: Install the project
70+
run: uv sync --frozen --all-extras --dev
71+
working-directory: ./src/python
72+
73+
- name: Run pytest
74+
run: uv run --frozen pytest
75+
working-directory: ./src/python

0 commit comments

Comments
 (0)