Skip to content

Commit 9b31ae3

Browse files
ci: add github actions workflow
Add CI/CD pipeline with GitHub Actions that: - Runs tests with pytest - Performs linting with flake8, black, and isort - Uploads coverage reports - Automatically creates releases based on semantic versioning 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8329ca9 commit 9b31ae3

1 file changed

Lines changed: 78 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.12"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
cache: 'pip'
24+
25+
- name: Install Poetry
26+
uses: snok/install-poetry@v1
27+
with:
28+
version: 1.8.3
29+
virtualenvs-create: true
30+
virtualenvs-in-project: true
31+
32+
- name: Cache Poetry dependencies
33+
uses: actions/cache@v4
34+
with:
35+
path: .venv
36+
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
37+
38+
- name: Install dependencies
39+
run: poetry install
40+
41+
- name: Lint with flake8
42+
run: |
43+
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
44+
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
45+
46+
- name: Format check with black
47+
run: poetry run black --check .
48+
49+
- name: Import sorting check with isort
50+
run: poetry run isort --check .
51+
52+
- name: Test with pytest
53+
run: poetry run pytest --cov=src
54+
55+
- name: Upload coverage to Codecov
56+
uses: codecov/codecov-action@v4
57+
with:
58+
token: ${{ secrets.CODECOV_TOKEN }}
59+
fail_ci_if_error: false
60+
61+
release:
62+
needs: test
63+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
64+
runs-on: ubuntu-latest
65+
concurrency: release
66+
permissions:
67+
id-token: write
68+
contents: write
69+
70+
steps:
71+
- uses: actions/checkout@v4
72+
with:
73+
fetch-depth: 0
74+
75+
- name: Python Semantic Release
76+
uses: python-semantic-release/python-semantic-release@master
77+
with:
78+
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)