Skip to content

Commit 627f23e

Browse files
man4ishclaude
andcommitted
Add CI workflow with lint, tests, PyPI publish, and GHCR Docker push
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent aafce85 commit 627f23e

1 file changed

Lines changed: 94 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*.*.*"]
7+
pull_request:
8+
branches: [main]
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.11"
19+
cache: pip
20+
21+
- name: Install dependencies
22+
run: |
23+
pip install --upgrade pip
24+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
25+
pip install -e ".[dev]"
26+
27+
- name: Lint
28+
run: ruff check .
29+
30+
- name: Test
31+
run: pytest --tb=short -q
32+
33+
publish-pypi:
34+
if: startsWith(github.ref, 'refs/tags/v')
35+
needs: test
36+
runs-on: ubuntu-latest
37+
permissions:
38+
contents: read
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- uses: actions/setup-python@v5
43+
with:
44+
python-version: "3.11"
45+
cache: pip
46+
47+
- name: Build package
48+
run: |
49+
pip install build
50+
python -m build
51+
52+
- name: Publish to PyPI
53+
uses: pypa/gh-action-pypi-publish@release/v1
54+
with:
55+
password: ${{ secrets.PYPI_TOKEN }}
56+
57+
publish-docker:
58+
if: startsWith(github.ref, 'refs/tags/v')
59+
needs: test
60+
runs-on: ubuntu-latest
61+
permissions:
62+
contents: read
63+
packages: write
64+
steps:
65+
- uses: actions/checkout@v4
66+
67+
- name: Docker metadata
68+
id: meta
69+
uses: docker/metadata-action@v5
70+
with:
71+
images: ghcr.io/man4ish/omnibioai-sdk
72+
tags: |
73+
type=semver,pattern={{version}}
74+
type=semver,pattern={{major}}.{{minor}}
75+
type=raw,value=latest
76+
77+
- uses: docker/setup-buildx-action@v3
78+
79+
- name: Login to GHCR
80+
uses: docker/login-action@v3
81+
with:
82+
registry: ghcr.io
83+
username: ${{ github.actor }}
84+
password: ${{ secrets.GITHUB_TOKEN }}
85+
86+
- name: Build and push
87+
uses: docker/build-push-action@v6
88+
with:
89+
context: .
90+
push: true
91+
tags: ${{ steps.meta.outputs.tags }}
92+
labels: ${{ steps.meta.outputs.labels }}
93+
cache-from: type=gha
94+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)