Skip to content
This repository was archived by the owner on Jun 9, 2026. It is now read-only.

Commit 4e3fb1d

Browse files
mdrokon-devclaude
andcommitted
ci: add test job + fix deploy service name
- Added test job (ruff check/format, pytest, node --test) that must pass before deploy - Fixed deploy SSH command: nanobanana not toggl (copy-paste bug) - deploy job now depends on test job Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9402efe commit 4e3fb1d

1 file changed

Lines changed: 108 additions & 0 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
push:
7+
branches: [master]
8+
9+
jobs:
10+
11+
test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.11"
20+
21+
- name: Install uv
22+
run: pip install uv
23+
24+
- name: Install Python deps
25+
run: uv pip install --system ".[dev]"
26+
27+
- name: Lint
28+
run: ruff check .
29+
30+
- name: Format check
31+
run: ruff format --check .
32+
33+
- name: Python tests
34+
run: pytest -x -q
35+
36+
- name: Set up Node
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: "22"
40+
41+
- name: Node tests
42+
run: node --test tests/*.test.js
43+
44+
deploy:
45+
runs-on: ubuntu-latest
46+
needs: test
47+
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
48+
permissions:
49+
contents: read
50+
packages: write
51+
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- name: Set up Docker Buildx
56+
uses: docker/setup-buildx-action@v3
57+
58+
- name: Login to GHCR
59+
uses: docker/login-action@v3
60+
with:
61+
registry: ghcr.io
62+
username: ${{ github.actor }}
63+
password: ${{ secrets.GITHUB_TOKEN }}
64+
65+
- name: Tag previous image for rollback
66+
run: |
67+
docker pull ghcr.io/pmlabs-org/mcp-nanobanana:latest || true
68+
docker tag ghcr.io/pmlabs-org/mcp-nanobanana:latest \
69+
ghcr.io/pmlabs-org/mcp-nanobanana:previous || true
70+
docker push ghcr.io/pmlabs-org/mcp-nanobanana:previous || true
71+
72+
- name: Build and push
73+
uses: docker/build-push-action@v6
74+
with:
75+
context: .
76+
push: true
77+
tags: |
78+
ghcr.io/pmlabs-org/mcp-nanobanana:latest
79+
ghcr.io/pmlabs-org/mcp-nanobanana:${{ github.sha }}
80+
cache-from: type=gha
81+
cache-to: type=gha,mode=max
82+
83+
- name: Setup SSH agent
84+
uses: webfactory/ssh-agent@v0.9.0
85+
with:
86+
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
87+
88+
- name: Add droplet to known hosts
89+
run: ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
90+
91+
- name: Deploy to droplet
92+
run: |
93+
ssh ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} \
94+
"echo '${{ secrets.GHCR_TOKEN }}' | docker login ghcr.io -u '${{ github.actor }}' --password-stdin \
95+
&& cd /opt/pmin-mcpinfrastructure \
96+
&& docker compose pull nanobanana \
97+
&& docker compose up -d --force-recreate nanobanana \
98+
&& docker logout ghcr.io"
99+
100+
- name: Health check
101+
run: |
102+
for i in 1 2 3 4 5; do
103+
if curl -sf https://nanobanana.mcp.pathfindermarketing.com.au/.well-known/oauth-authorization-server > /dev/null; then
104+
echo "Health check passed"; exit 0
105+
fi
106+
echo "Attempt $i/5 — retrying in 15s..."; sleep 15
107+
done
108+
echo "Health check failed"; exit 1

0 commit comments

Comments
 (0)