-
Notifications
You must be signed in to change notification settings - Fork 9
143 lines (122 loc) · 4.59 KB
/
ci.yml
File metadata and controls
143 lines (122 loc) · 4.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
DOCKER_REGISTRY: ghcr.io
IMAGE_NAME: ghcr.io/codealive-ai/codealive-mcp
DOCKERHUB_IMAGE: ivanbirukcodealive/codealive_ai
permissions:
contents: read
packages: write
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"
pip install jsonschema
- name: Run tests
run: |
python -m pytest src/tests/ -v --cov=src --cov-report=term-missing --cov-report=xml --junitxml=junit/test-results.xml
- name: Upload test results
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: always()
with:
name: pytest-results
path: |
junit/test-results.xml
coverage.xml
package:
name: Package Extension
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
- uses: actions/setup-node@v4
with:
node-version: '22'
- name: Build MCPB bundle
run: |
mkdir -p dist
npx -y @anthropic-ai/mcpb pack . dist/codealive-mcp.mcpb
- name: Verify MCPB bundle contents
run: |
python scripts/verify_mcpb.py dist/codealive-mcp.mcpb
- name: Upload MCPB artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: codealive-mcpb
path: dist/codealive-mcp.mcpb
docker:
name: Build & Push Docker
needs: [test, package]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Login to GitHub Container Registry
if: github.event_name == 'push'
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
id: dockerhub_login
if: github.event_name == 'push'
continue-on-error: true
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# PR: build only (no push) to validate Dockerfile — single platform for speed
- name: Build Docker image (PR validation)
if: github.event_name == 'pull_request'
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
push: false
load: true
file: ./Dockerfile
tags: ${{ env.IMAGE_NAME }}:pr-${{ github.event.number }}
cache-from: type=gha
# Push to main: build multi-platform and push the production GHCR tag.
- name: Build and push Docker image (GHCR)
if: github.event_name == 'push'
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
push: true
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
tags: ${{ env.IMAGE_NAME }}:main
labels: |
io.modelcontextprotocol.server.name=io.github.CodeAlive-AI/codealive-mcp
cache-from: type=gha
cache-to: type=gha
# Docker Hub is a secondary self-hosted distribution channel. Missing
# credentials must not block GHCR, because production pulls from GHCR.
- name: Build and push Docker image (Docker Hub)
if: github.event_name == 'push' && steps.dockerhub_login.outcome == 'success'
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
push: true
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
tags: ${{ env.DOCKERHUB_IMAGE }}:mcp-dev
labels: |
io.modelcontextprotocol.server.name=io.github.CodeAlive-AI/codealive-mcp
cache-from: type=gha
cache-to: type=gha