Skip to content

Commit e564496

Browse files
author
Delega Bot
committed
ci: add GitHub Actions workflows
- CI: lint, type check, build on push/PR to main - Deploy/publish on tag push (vX.Y.Z) - Version verification (tag must match package version)
1 parent 68622b8 commit e564496

2 files changed

Lines changed: 69 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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.9', '3.10', '3.11', '3.12', '3.13']
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install -e ".[async]"
26+
pip install pytest
27+
28+
- name: Run tests
29+
run: pytest tests/ -v

.github/workflows/publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
environment: pypi
12+
permissions:
13+
contents: read
14+
id-token: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.12'
21+
22+
- name: Install build tools
23+
run: pip install build
24+
25+
- name: Verify version matches tag
26+
run: |
27+
PKG_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
28+
TAG_VERSION="${GITHUB_REF_NAME#v}"
29+
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
30+
echo "❌ pyproject.toml version ($PKG_VERSION) doesn't match tag ($TAG_VERSION)"
31+
exit 1
32+
fi
33+
34+
- name: Build package
35+
run: python -m build
36+
37+
- name: Publish to PyPI
38+
uses: pypa/gh-action-pypi-publish@release/v1
39+
with:
40+
attestations: true

0 commit comments

Comments
 (0)