Skip to content

Commit e4cbac4

Browse files
committed
ci: add GitHub Actions workflow and Dependabot config
Two-job CI workflow that runs on push to main and on PRs: 1. lint-and-unit: ruff check + ruff format --check + 278 unit tests. Pure Python, no infrastructure, completes in under a minute. 2. integration: spins up Redis 7-alpine + NATS 2-alpine (with --jetstream + --http_port 8222 matching docker-compose.yml) as bare docker containers (services: block cannot pass a command override to NATS), waits for both health probes, installs deps, runs the 21 fast integration tests. Service logs dumped on failure for debugging. The 3 slow integration tests are not run in CI — they need a local Ollama model. Concurrency group cancels in-progress runs on the same ref so rapid pushes do not queue up. Dependabot configured for three ecosystems on a weekly Monday schedule: - pip (requirements.txt) — minor+patch updates batched into one PR - github-actions (workflow files) - docker (Dockerfile base image) Commit prefixes configured per ecosystem: chore(deps), chore(ci), chore(docker). Co-Authored-By: Rooty
1 parent b8122df commit e4cbac4

2 files changed

Lines changed: 133 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: 2
2+
updates:
3+
# Python dependencies from requirements.txt
4+
- package-ecosystem: pip
5+
directory: /
6+
schedule:
7+
interval: weekly
8+
day: monday
9+
open-pull-requests-limit: 5
10+
commit-message:
11+
prefix: "chore(deps)"
12+
groups:
13+
# Batch minor/patch updates of all Python deps into a single PR
14+
python-minor-patch:
15+
update-types:
16+
- minor
17+
- patch
18+
19+
# GitHub Actions versions in .github/workflows
20+
- package-ecosystem: github-actions
21+
directory: /
22+
schedule:
23+
interval: weekly
24+
day: monday
25+
open-pull-requests-limit: 5
26+
commit-message:
27+
prefix: "chore(ci)"
28+
29+
# Docker base image in Dockerfile
30+
- package-ecosystem: docker
31+
directory: /
32+
schedule:
33+
interval: weekly
34+
day: monday
35+
open-pull-requests-limit: 5
36+
commit-message:
37+
prefix: "chore(docker)"

.github/workflows/ci.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
lint-and-unit:
15+
name: Lint + unit tests
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python 3.12
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.12"
25+
cache: pip
26+
cache-dependency-path: requirements.txt
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install -r requirements.txt
32+
pip install ruff
33+
34+
- name: Ruff check
35+
run: ruff check .
36+
37+
- name: Ruff format check
38+
run: ruff format --check .
39+
40+
- name: Run unit tests
41+
run: pytest tests/ --ignore=tests/integration -v
42+
43+
integration:
44+
name: Fast integration tests
45+
runs-on: ubuntu-latest
46+
needs: lint-and-unit
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v4
50+
51+
- name: Set up Python 3.12
52+
uses: actions/setup-python@v5
53+
with:
54+
python-version: "3.12"
55+
cache: pip
56+
cache-dependency-path: requirements.txt
57+
58+
- name: Start Redis
59+
run: |
60+
docker run -d --name redis -p 6379:6379 redis:7-alpine
61+
62+
- name: Start NATS with JetStream
63+
run: |
64+
docker run -d --name nats -p 4222:4222 -p 8222:8222 \
65+
nats:2-alpine --jetstream --http_port 8222
66+
67+
- name: Wait for services to become healthy
68+
run: |
69+
for i in $(seq 1 30); do
70+
if docker exec redis redis-cli ping 2>/dev/null | grep -q PONG \
71+
&& curl -sf http://localhost:8222/healthz > /dev/null 2>&1; then
72+
echo "Services ready"
73+
exit 0
74+
fi
75+
sleep 1
76+
done
77+
echo "Services failed to become ready within 30 seconds"
78+
docker logs redis || true
79+
docker logs nats || true
80+
exit 1
81+
82+
- name: Install dependencies
83+
run: |
84+
python -m pip install --upgrade pip
85+
pip install -r requirements.txt
86+
87+
- name: Run fast integration tests
88+
run: pytest tests/integration/ -m "not slow" -v
89+
90+
- name: Dump service logs on failure
91+
if: failure()
92+
run: |
93+
echo "=== Redis logs ==="
94+
docker logs redis || true
95+
echo "=== NATS logs ==="
96+
docker logs nats || true

0 commit comments

Comments
 (0)