Skip to content

Commit f41aed4

Browse files
jdrumgooleclaude
andcommitted
Add GitHub Actions CI: ruff, mypy, pytest with mongo:7 service
The `services:` block runs MongoDB 7 inside the runner so the DB-backed tests actually execute in CI instead of skipping. The conftest's per-worker DB naming (`solis_test_<gw>`) keeps xdist concurrency safe against the single mongod, and `pytest_sessionfinish` drops the test DB at the end of each worker. SolisCloud creds are unset because the client/poller tests mock the upstream via `httpx.MockTransport`; only `SESSION_SECRET` and `SOLIS_MONGODB_URI` need real values. Uses `astral-sh/setup-uv@v6` with `enable-cache: true` so dependency installs are reused across runs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6fd1f1c commit f41aed4

4 files changed

Lines changed: 63 additions & 3 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+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
16+
services:
17+
mongo:
18+
image: mongo:7
19+
ports:
20+
- 27017:27017
21+
# Wait until mongo is ready before the job tries to connect.
22+
options: >-
23+
--health-cmd "mongosh --quiet --eval 'db.runCommand({ ping: 1 }).ok'"
24+
--health-interval 5s
25+
--health-timeout 5s
26+
--health-retries 12
27+
28+
env:
29+
# The DB-backed tests need this; SolisCloud creds are not needed because
30+
# tests mock the upstream via httpx.MockTransport.
31+
SOLIS_MONGODB_URI: mongodb://localhost:27017
32+
SOLIS_MONGODB_DB: solis_ci
33+
SESSION_SECRET: ci-only-session-secret
34+
# Stop the scheduler from starting (it never would in tests, but make
35+
# the intent explicit).
36+
RUN_SCHEDULER: "false"
37+
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Install uv
42+
uses: astral-sh/setup-uv@v6
43+
with:
44+
enable-cache: true
45+
cache-dependency-glob: "uv.lock"
46+
47+
- name: Set up Python
48+
run: uv python install
49+
50+
- name: Install dependencies
51+
run: uv sync --extra dev
52+
53+
- name: Ruff
54+
run: uv run python -m ruff check .
55+
56+
- name: Mypy
57+
run: uv run python -m mypy
58+
59+
- name: Pytest
60+
run: uv run python -m pytest -n auto -v

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "solisdash"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
description = "Self-hosted dashboard for the SolisCloud platform"
55
readme = "README.md"
66
requires-python = ">=3.12"

‎src/solisdash/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.2.0"
1+
__version__ = "0.2.1"

‎uv.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)