-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (53 loc) · 1.78 KB
/
Copy pathci.yml
File metadata and controls
66 lines (53 loc) · 1.78 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
name: CI
on:
push:
branches: [master, main]
pull_request:
permissions:
contents: write
jobs:
check:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-extras
- name: Auto-format code
run: uv run ruff format src/
- name: Check for formatting changes
id: format-check
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "changes=true" >> $GITHUB_OUTPUT
echo "::warning::Code was auto-formatted. Changes will be committed."
else
echo "changes=false" >> $GITHUB_OUTPUT
fi
- name: Commit formatting changes
if: steps.format-check.outputs.changes == 'true' && github.event_name == 'pull_request'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add -A
git commit -m "style: auto-format code with ruff"
- name: Push formatting changes
if: steps.format-check.outputs.changes == 'true' && github.event_name == 'pull_request'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
- name: Lint
run: uv run ruff check src/
- name: Type check
run: uv run mypy src/myapp/
- name: Tests
run: uv run pytest -v