-
Notifications
You must be signed in to change notification settings - Fork 9
88 lines (75 loc) · 2.7 KB
/
ci.yml
File metadata and controls
88 lines (75 loc) · 2.7 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
DOCKER_REGISTRY: ghcr.io
IMAGE_NAME: ghcr.io/codealive-ai/codealive-mcp
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 .
pip install pytest pytest-asyncio pytest-mock pytest-cov 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
docker:
name: Build & Push Docker
needs: test
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 }}
# 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 with rolling tags
- name: Build and push Docker image
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