Skip to content

Commit 5e98c40

Browse files
callmeiksclaude
andcommitted
ci: add GitHub Actions workflows (CI, docs, PyPI release)
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 06710d8 commit 5e98c40

3 files changed

Lines changed: 166 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: ci-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.12"
21+
- name: Install dev deps
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -e ".[dev]"
25+
- name: Ruff
26+
run: ruff check src tests scripts
27+
- name: Mypy
28+
run: mypy src/tikhub
29+
30+
test:
31+
runs-on: ubuntu-latest
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-python@v5
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
- name: Install
42+
run: |
43+
python -m pip install --upgrade pip
44+
pip install -e ".[dev]"
45+
- name: Test
46+
run: pytest -q
47+
48+
coverage-gate:
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v4
52+
- uses: actions/setup-python@v5
53+
with:
54+
python-version: "3.12"
55+
- name: Install
56+
run: |
57+
python -m pip install --upgrade pip
58+
pip install -e ".[dev]"
59+
- name: Verify endpoint coverage against snapshotted spec
60+
run: python scripts/verify_coverage.py

.github/workflows/docs.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "docs/**"
8+
- "mkdocs.yml"
9+
- "scripts/generate_docs.py"
10+
- "src/tikhub/**"
11+
- "spec/openapi.json"
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
19+
concurrency:
20+
group: docs-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.12"
31+
- name: Install
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install -e ".[docs,cli]"
35+
- name: Regenerate API reference
36+
run: python scripts/generate_docs.py
37+
- name: Build site
38+
run: mkdocs build --strict
39+
- uses: actions/upload-pages-artifact@v3
40+
with:
41+
path: site
42+
43+
deploy:
44+
needs: build
45+
runs-on: ubuntu-latest
46+
environment:
47+
name: github-pages
48+
url: ${{ steps.deployment.outputs.page_url }}
49+
steps:
50+
- id: deployment
51+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags: ["v*.*.*", "v*.*.*a*", "v*.*.*b*", "v*.*.*rc*"]
6+
7+
permissions:
8+
contents: read
9+
id-token: write
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.12"
19+
- name: Verify version matches tag
20+
run: |
21+
TAG="${GITHUB_REF#refs/tags/v}"
22+
PKG_VERSION=$(python -c "from src.tikhub._version import __version__; print(__version__)")
23+
if [ "$TAG" != "$PKG_VERSION" ]; then
24+
echo "::error::tag $TAG does not match package version $PKG_VERSION"
25+
exit 1
26+
fi
27+
- name: Install build tools
28+
run: python -m pip install --upgrade pip build
29+
- name: Run full test suite first
30+
run: |
31+
pip install -e ".[dev]"
32+
ruff check src tests scripts
33+
mypy src/tikhub
34+
pytest -q
35+
python scripts/verify_coverage.py
36+
- name: Build sdist + wheel
37+
run: python -m build
38+
- uses: actions/upload-artifact@v4
39+
with:
40+
name: dist
41+
path: dist/
42+
43+
publish:
44+
needs: build
45+
runs-on: ubuntu-latest
46+
environment:
47+
name: pypi
48+
url: https://pypi.org/p/tikhub
49+
steps:
50+
- uses: actions/download-artifact@v4
51+
with:
52+
name: dist
53+
path: dist/
54+
- name: Publish to PyPI (OIDC trusted publishing)
55+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)