Skip to content

Commit 4284b32

Browse files
author
Martin Kirchgessner
committed
cherry-pick github workflow from #18 (without mypy)
1 parent bc25f78 commit 4284b32

1 file changed

Lines changed: 101 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- '**.py'
8+
- 'pyproject.toml'
9+
- 'poetry.lock'
10+
- '.github/workflows/ci.yml'
11+
pull_request:
12+
branches: [master]
13+
paths:
14+
- '**.py'
15+
- 'pyproject.toml'
16+
- 'poetry.lock'
17+
- '.github/workflows/ci.yml'
18+
19+
jobs:
20+
lint:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.14"
29+
30+
- name: Install Poetry
31+
uses: snok/install-poetry@v1
32+
with:
33+
virtualenvs-create: true
34+
virtualenvs-in-project: true
35+
36+
- name: Cache Poetry dependencies
37+
uses: actions/cache@v4
38+
with:
39+
path: .venv
40+
key: ${{ runner.os }}-python-3.14-poetry-${{ hashFiles('poetry.lock') }}
41+
42+
- name: Check for poetry file changes
43+
id: filter
44+
uses: dorny/paths-filter@v3
45+
with:
46+
filters: |
47+
poetry:
48+
- 'pyproject.toml'
49+
- 'poetry.lock'
50+
51+
- name: Run poetry check
52+
if: steps.filter.outputs.poetry == 'true'
53+
run: poetry check --lock --strict
54+
55+
- name: Install dependencies
56+
run: poetry install
57+
58+
- name: Run ruff check
59+
run: poetry run ruff check .
60+
61+
- name: Run ruff format check
62+
run: poetry run ruff format --check .
63+
64+
test:
65+
runs-on: ubuntu-latest
66+
strategy:
67+
matrix:
68+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
69+
steps:
70+
- uses: actions/checkout@v4
71+
with:
72+
fetch-depth: 0 # Required for diff-cover
73+
74+
- name: Set up Python ${{ matrix.python-version }}
75+
uses: actions/setup-python@v5
76+
with:
77+
python-version: ${{ matrix.python-version }}
78+
79+
- name: Install Poetry
80+
uses: snok/install-poetry@v1
81+
with:
82+
virtualenvs-create: true
83+
virtualenvs-in-project: true
84+
85+
- name: Cache Poetry dependencies
86+
uses: actions/cache@v4
87+
with:
88+
path: .venv
89+
key: ${{ runner.os }}-python-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }}
90+
91+
- name: Install dependencies
92+
run: poetry install
93+
94+
- name: Run tests with coverage
95+
run: poetry run pytest
96+
97+
- name: Check coverage for new code
98+
if: matrix.python-version == '3.14'
99+
run: |
100+
poetry run pip install diff-cover
101+
poetry run diff-cover .reports/coverage.xml --compare-branch=origin/master --fail-under=100

0 commit comments

Comments
 (0)