Skip to content

Commit 46f52f2

Browse files
authored
add ci workflow (#34)
Resolves #5
1 parent ab0f75d commit 46f52f2

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
# trigger on change to this workflow
8+
pull_request:
9+
paths:
10+
- '.github/workflows/ci.yml'
11+
12+
# allow trigger manually from actions
13+
workflow_dispatch:
14+
15+
# Cancel jobs running if new commits are pushed
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
style:
22+
name: "style"
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: "Install uv"
30+
uses: astral-sh/setup-uv@v7
31+
with:
32+
enable-cache: true
33+
34+
- name: "Install project"
35+
run: |
36+
uv sync
37+
38+
- name: "pre-commit check"
39+
run: |
40+
uv run prek --all-files
41+
42+
test-backend:
43+
name: "test backend with pytest"
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
with:
48+
fetch-depth: 0
49+
50+
- name: "check for changes to python files"
51+
uses: dorny/paths-filter@v4
52+
id: changes
53+
with:
54+
filters: |
55+
python:
56+
- "**/*.py"
57+
58+
- name: "Install uv"
59+
if: steps.changes.outputs.python == 'true'
60+
uses: astral-sh/setup-uv@v7
61+
with:
62+
enable-cache: true
63+
64+
- name: "Install project"
65+
if: steps.changes.outputs.python == 'true'
66+
run: |
67+
uv sync
68+
69+
- name: "pytest"
70+
if: steps.changes.outputs.python == 'true'
71+
run: |
72+
uv run pytest -v tests/

0 commit comments

Comments
 (0)