Skip to content

Commit 637696a

Browse files
committed
Enable Github Actions
1 parent aefa4c7 commit 637696a

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

.github/workflows/python-ci.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Python CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
lint:
12+
name: Code Quality
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.11'
21+
22+
- name: Install Poetry
23+
uses: snok/install-poetry@v1
24+
with:
25+
version: latest
26+
virtualenvs-create: true
27+
virtualenvs-in-project: true
28+
29+
- name: Load cached venv
30+
id: cached-poetry-dependencies
31+
uses: actions/cache@v3
32+
with:
33+
path: .venv
34+
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
35+
36+
- name: Install dependencies
37+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
38+
run: poetry install --no-interaction --no-root
39+
40+
- name: Check imports with isort
41+
run: poetry run isort . --check-only --profile black
42+
43+
- name: Check formatting with Black
44+
run: poetry run black . --check
45+
46+
- name: Lint with flake8
47+
run: poetry run flake8 . --max-line-length=100
48+
49+
test:
50+
name: Tests
51+
needs: lint # This job will only run if lint job passes
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v3
55+
56+
- name: Set up Python
57+
uses: actions/setup-python@v4
58+
with:
59+
python-version: '3.11'
60+
61+
- name: Install Poetry
62+
uses: snok/install-poetry@v1
63+
with:
64+
version: latest
65+
virtualenvs-create: true
66+
virtualenvs-in-project: true
67+
68+
- name: Load cached venv
69+
id: cached-poetry-dependencies
70+
uses: actions/cache@v3
71+
with:
72+
path: .venv
73+
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
74+
75+
- name: Install dependencies
76+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
77+
run: poetry install --no-interaction --no-root
78+
79+
- name: Run tests
80+
run: poetry run pytest tests/

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ autopep8 = "^2.3.1"
2121
mypy = "^1.13.0"
2222
pytest = "^8.3.4"
2323

24+
[tool.isort]
25+
profile = "black"
26+
multi_line_output = 3
27+
2428
[build-system]
2529
requires = ["poetry-core"]
2630
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)