move Docker builds to GitHub Actions, Woodpecker becomes deploy-only
- GHA ci.yml: add build + deploy jobs (push to DockerHub, trigger Woodpecker) - Drop test matrix to single Python 3.12, preserve mypy step - Build/deploy gated on push to main (PRs still run tests only) - Woodpecker: deploy.yml (manual event, kubectl set image + slack notify) - Old pipeline preserved as build-fallback.yml (manual trigger)
This commit is contained in:
parent
44e1b84a5a
commit
bfc20d2ce9
3 changed files with 63 additions and 9 deletions
51
.github/workflows/ci.yml
vendored
51
.github/workflows/ci.yml
vendored
|
|
@ -6,31 +6,68 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: claude-memory-mcp
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
python-version: ["3.11", "3.12", "3.13"]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: "3.12"
|
||||||
- run: pip install -e ".[api,dev]"
|
- run: pip install -e ".[api,dev]"
|
||||||
- run: ruff check src/ tests/
|
- run: ruff check src/ tests/
|
||||||
- run: mypy src/claude_memory/
|
- run: mypy src/claude_memory/
|
||||||
- run: pytest tests/ -v --tb=short
|
- run: pytest tests/ -v --tb=short
|
||||||
|
|
||||||
docker:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: test
|
needs: test
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
outputs:
|
||||||
|
image_tag: ${{ steps.meta.outputs.sha }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: docker/setup-buildx-action@v3
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
- uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- id: meta
|
||||||
|
run: echo "sha=$(echo ${{ github.sha }} | cut -c1-8)" >> $GITHUB_OUTPUT
|
||||||
- uses: docker/build-push-action@v6
|
- uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: docker/Dockerfile
|
file: docker/Dockerfile
|
||||||
push: false
|
push: true
|
||||||
tags: claude-memory-mcp:test
|
platforms: linux/amd64
|
||||||
|
tags: |
|
||||||
|
viktorbarzin/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.sha }}
|
||||||
|
viktorbarzin/${{ env.IMAGE_NAME }}:latest
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
needs: build
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Trigger Woodpecker deploy
|
||||||
|
run: |
|
||||||
|
for attempt in 1 2 3; do
|
||||||
|
STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
|
||||||
|
"https://ci.viktorbarzin.me/api/repos/ViktorBarzin/claude-memory-mcp/pipelines" \
|
||||||
|
-H "Authorization: Bearer ${{ secrets.WOODPECKER_TOKEN }}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{"branch":"main","variables":{"IMAGE_TAG":"${{ needs.build.outputs.image_tag }}","IMAGE_NAME":"viktorbarzin/${{ env.IMAGE_NAME }}"}}')
|
||||||
|
if [ "$STATUS" -ge 200 ] && [ "$STATUS" -lt 300 ]; then
|
||||||
|
echo "Woodpecker deploy triggered (HTTP $STATUS)"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "Attempt $attempt failed (HTTP $STATUS), retrying in 30s..."
|
||||||
|
sleep 30
|
||||||
|
done
|
||||||
|
echo "Failed to trigger Woodpecker deploy after 3 attempts"
|
||||||
|
exit 1
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
when:
|
when:
|
||||||
- event: push
|
- event: manual
|
||||||
branch: main
|
|
||||||
|
|
||||||
clone:
|
clone:
|
||||||
git:
|
git:
|
||||||
18
.woodpecker/deploy.yml
Normal file
18
.woodpecker/deploy.yml
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
when:
|
||||||
|
- event: manual
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: deploy
|
||||||
|
image: bitnami/kubectl:1.32
|
||||||
|
commands:
|
||||||
|
- kubectl set image deployment/claude-memory claude-memory=${IMAGE_NAME}:${IMAGE_TAG} -n claude-memory
|
||||||
|
- kubectl rollout status deployment/claude-memory -n claude-memory --timeout=300s
|
||||||
|
|
||||||
|
- name: notify
|
||||||
|
image: woodpeckerci/plugin-slack
|
||||||
|
settings:
|
||||||
|
webhook:
|
||||||
|
from_secret: slack-webhook-url
|
||||||
|
channel: general
|
||||||
|
when:
|
||||||
|
- status: [success, failure]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue