-
Notifications
You must be signed in to change notification settings - Fork 0
172 lines (140 loc) · 5.87 KB
/
Copy pathci.yml
File metadata and controls
172 lines (140 loc) · 5.87 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: CI Pipeline
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
NODE_VERSION: '20'
jobs:
test:
name: Test BON Calculadora MCP Server
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run unit tests
run: |
echo "🔌 Testing unit tests..."
make test
echo "✅ Unit tests successful"
- name: Run build all servers
run: |
echo "🔌 Building all servers..."
make build-all
echo "✅ All servers built successfully"
- name: Test make pack and verify contents
run: |
echo "📦 Testing make pack..."
make pack
# Check that a DXT file was created (find any .dxt file)
DXT_FILE=$(ls *.dxt 2>/dev/null | head -1)
if [ -z "$DXT_FILE" ]; then
echo "❌ No .dxt file found"
echo "Files in directory:"
ls -la
exit 1
fi
echo "✅ Found DXT file: $DXT_FILE"
# Install unzip if not available (should be available in ubuntu-latest)
if ! command -v unzip &> /dev/null; then
echo "Installing unzip..."
sudo apt-get update && sudo apt-get install -y unzip
fi
# Extract the package using unzip
echo "📂 Extracting package with unzip..."
mkdir -p test-extract
unzip -q "$DXT_FILE" -d test-extract
# Show extracted contents for debugging
echo "📁 Extracted contents:"
find test-extract -type f | head -20
# Verify required files exist
echo "🔍 Verifying package contents..."
if [ ! -d test-extract/stdio_server ]; then
echo "❌ stdio_server missing"
ls -la test-extract/
exit 1
fi
echo "✅ stdio_server found"
if [ ! -d test-extract/manifest.json ]; then
echo "❌ manifest.json missing"
ls -la test-extract/
exit 1
fi
echo "✅ manifest.json found"
echo "✅ make pack successful - all required files present"
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Test image.sh build
run: |
echo "🐳 Testing image.sh build..."
# Make script executable
chmod +x image.sh
# Copy .env.sample to .env
cp .env.sample .env
echo "🐳 Using .env.sample as .env for build test"
# Check what container runtime is available (podman takes precedence)
echo "🔍 Checking available container runtimes..."
CONTAINER_RUNTIME=""
if command -v podman &> /dev/null; then
echo "✅ Podman available: $(podman --version)"
CONTAINER_RUNTIME="podman"
elif command -v docker &> /dev/null; then
echo "✅ Docker available: $(docker --version)"
CONTAINER_RUNTIME="docker"
else
echo "❌ Neither Podman nor Docker found"
exit 1
fi
echo "🎯 Will use: $CONTAINER_RUNTIME"
# Run the build
./image.sh build
# Check images with the detected runtime first, then fallback to the other
echo "🔍 Checking for created images..."
FOUND=false
# Check with primary runtime
echo "Checking with $CONTAINER_RUNTIME:"
$CONTAINER_RUNTIME images || echo "$CONTAINER_RUNTIME images command failed"
if $CONTAINER_RUNTIME images --format "table {{.Repository}}:{{.Tag}}" 2>/dev/null | grep -q "bon-calculadora-mcp"; then
echo "✅ Found image with $CONTAINER_RUNTIME"
FOUND=true
fi
# If not found and using podman, also check docker
if [ "$FOUND" = false ] && [ "$CONTAINER_RUNTIME" = "podman" ] && command -v docker &> /dev/null; then
echo "Checking with Docker as fallback:"
docker images || echo "Docker images command failed"
if docker images --format "table {{.Repository}}:{{.Tag}}" 2>/dev/null | grep -q "bon-calculadora-mcp"; then
echo "✅ Found image with Docker"
FOUND=true
fi
fi
# If not found and using docker, also check podman
if [ "$FOUND" = false ] && [ "$CONTAINER_RUNTIME" = "docker" ] && command -v podman &> /dev/null; then
echo "Checking with Podman as fallback:"
podman images || echo "Podman images command failed"
if podman images --format "table {{.Repository}}:{{.Tag}}" 2>/dev/null | grep -q "bon-calculadora-mcp"; then
echo "✅ Found image with Podman"
FOUND=true
fi
fi
if [ "$FOUND" = false ]; then
echo "❌ Container image not found with any runtime"
echo "Podman images:"
podman images --format "table {{.Repository}}:{{.Tag}}\t{{.ID}}\t{{.CreatedAt}}" 2>/dev/null || echo "Podman not available"
echo "Docker images:"
docker images --format "table {{.Repository}}:{{.Tag}}\t{{.ID}}\t{{.CreatedAt}}" 2>/dev/null || echo "Docker not available"
exit 1
fi
echo "✅ image.sh build successful"
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
*.dxt
target/release/stdio_server
target/release/sse_server
target/release/mcp_server
retention-days: 7