Skip to content

Commit f7fde35

Browse files
committed
ci: add version consistency checker tool
- Add scripts/check-versions.sh to validate version alignment across: - Rust: Cargo.toml MSRV, Dockerfile, CI workflow - Go: go.mod, Dockerfile, CI workflow - Node/Bun: Dockerfile, CI workflow - Elixir/OTP: Dockerfile, CI workflow - Alpine: All service Dockerfiles - Integrate version check into CI pipeline as first gate - Add 'make check-versions' and 'make lint' targets - Fix web Dockerfile Alpine version syntax - Add wget for health checks in web and query-service - Align Rust toolchain version to 1.85 across Dockerfile and CI
1 parent 7fb42bf commit f7fde35

File tree

6 files changed

+547
-30
lines changed

6 files changed

+547
-30
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ env:
1717
FORCE_COLOR: 1
1818

1919
jobs:
20+
# ============================================================================
21+
# Version Consistency Check
22+
# ============================================================================
23+
version-check:
24+
name: Version Consistency
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Check version consistency
30+
run: |
31+
chmod +x scripts/check-versions.sh
32+
./scripts/check-versions.sh
33+
2034
# ============================================================================
2135
# Change Detection - Determine which services need to be tested
2236
# ============================================================================
@@ -72,7 +86,7 @@ jobs:
7286
- name: Install Rust toolchain
7387
uses: dtolnay/rust-toolchain@stable
7488
with:
75-
toolchain: "1.82"
89+
toolchain: "1.85"
7690
components: rustfmt, clippy
7791

7892
- name: Cache Rust dependencies
@@ -328,6 +342,7 @@ jobs:
328342
name: Quality Gate
329343
runs-on: ubuntu-latest
330344
needs:
345+
- version-check
331346
- changes
332347
- rust-quality
333348
- rust-msrv
@@ -362,6 +377,7 @@ jobs:
362377
fi
363378
}
364379
380+
check_job "Version Check" "${{ needs.version-check.result }}" "true"
365381
check_job "Rust Quality" "${{ needs.rust-quality.result }}" "${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}"
366382
check_job "Rust MSRV" "${{ needs.rust-msrv.result }}" "${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}"
367383
check_job "Go Quality" "${{ needs.go-quality.result }}" "${{ needs.changes.outputs.go == 'true' || needs.changes.outputs.workflows == 'true' }}"

Makefile

Lines changed: 128 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,53 @@
1-
.PHONY: help install dev build clean demo test
1+
.PHONY: help install dev build clean demo test lint check-versions \
2+
core control web mcp \
3+
docker-build docker-test docker-test-quick docker-clean \
4+
docker-core docker-web docker-query docker-mcp docker-control
5+
6+
# =============================================================================
7+
# General Commands
8+
# =============================================================================
29

310
help:
4-
@echo "AllSource - Available Commands"
11+
@echo "Chronos - Available Commands"
512
@echo "=============================="
6-
@echo "make install - Install all dependencies"
7-
@echo "make dev - Run all services in development mode"
8-
@echo "make build - Build all services"
9-
@echo "make clean - Clean all build artifacts"
10-
@echo "make demo - Quick demo setup (install + dev)"
11-
@echo "make test - Run tests"
13+
@echo ""
14+
@echo "Development:"
15+
@echo " make install - Install all dependencies"
16+
@echo " make dev - Run all services in development mode"
17+
@echo " make build - Build all services"
18+
@echo " make clean - Clean all build artifacts"
19+
@echo " make demo - Quick demo setup (install + dev)"
20+
@echo " make test - Run tests"
21+
@echo " make lint - Run linters across all services"
22+
@echo " make check-versions - Check version consistency across services"
1223
@echo ""
1324
@echo "Individual Services:"
14-
@echo "make core - Run Rust event store only"
15-
@echo "make control - Run Go control plane only"
16-
@echo "make web - Run Next.js web UI only"
17-
@echo "make mcp - Run MCP server only"
25+
@echo " make core - Run Rust event store only"
26+
@echo " make control - Run Go control plane only"
27+
@echo " make web - Run Next.js web UI only"
28+
@echo " make mcp - Run MCP server only"
29+
@echo ""
30+
@echo "Container Testing:"
31+
@echo " make docker-test - Full container test suite (all services)"
32+
@echo " make docker-test-quick - Quick build-only test"
33+
@echo " make docker-build - Build all containers"
34+
@echo " make docker-clean - Remove test images"
35+
@echo ""
36+
@echo "Individual Container Builds:"
37+
@echo " make docker-core - Build core container"
38+
@echo " make docker-web - Build web container"
39+
@echo " make docker-query - Build query-service container"
40+
@echo " make docker-mcp - Build mcp-server container"
41+
@echo " make docker-control - Build control-plane container"
42+
43+
# =============================================================================
44+
# Development Commands
45+
# =============================================================================
1846

1947
install:
2048
@echo "📦 Installing dependencies..."
2149
bun install
22-
cd services/control-plane && go mod download
50+
cd apps/control-plane && go mod download
2351

2452
dev:
2553
@echo "🚀 Starting all services..."
@@ -33,11 +61,12 @@ build:
3361
clean:
3462
@echo "🧹 Cleaning build artifacts..."
3563
bun clean
36-
cd services/core && cargo clean
37-
cd services/control-plane && rm -rf bin
64+
-cd apps/core && cargo clean
65+
-cd apps/control-plane && rm -rf bin
66+
-rm -rf .container-test-logs
3867

3968
demo: install
40-
@echo "🎪 Starting AllSource demo..."
69+
@echo "🎪 Starting Chronos demo..."
4170
@echo "Dashboard will be available at http://localhost:3000"
4271
@echo ""
4372
bun dev
@@ -46,19 +75,96 @@ test:
4675
@echo "🧪 Running tests..."
4776
bun test
4877

49-
# Individual service commands
78+
lint:
79+
@echo "🔍 Running linters..."
80+
bun run lint
81+
cd apps/core && cargo fmt --check && cargo clippy --all-targets -- -D warnings
82+
cd apps/control-plane && go fmt ./... && go vet ./...
83+
84+
check-versions:
85+
@echo "🔢 Checking version consistency..."
86+
./scripts/check-versions.sh
87+
88+
# =============================================================================
89+
# Individual Service Commands
90+
# =============================================================================
91+
5092
core:
51-
@echo "⚡ Starting Rust event store on :8080"
52-
cd services/core && cargo run --release
93+
@echo "⚡ Starting Rust event store on :3900"
94+
cd apps/core && cargo run --release
5395

5496
control:
55-
@echo "🎯 Starting Go control plane on :8081"
56-
cd services/control-plane && go run main.go
97+
@echo "🎯 Starting Go control plane on :8080"
98+
cd apps/control-plane && go run main.go
5799

58100
web:
59101
@echo "🌐 Starting Next.js web UI on :3000"
60102
cd apps/web && bun dev
61103

62104
mcp:
63105
@echo "🤖 Starting MCP server"
64-
cd packages/mcp-server && bun dev
106+
cd apps/mcp-server-elixir && mix phx.server
107+
108+
# =============================================================================
109+
# Container Testing Commands
110+
# =============================================================================
111+
112+
docker-test:
113+
@echo "🐳 Running full container test suite..."
114+
./scripts/container-test.sh
115+
116+
docker-test-quick:
117+
@echo "🐳 Running quick container build test..."
118+
./scripts/container-test.sh --quick
119+
120+
docker-build:
121+
@echo "🐳 Building all containers..."
122+
./scripts/container-test.sh --build-only
123+
124+
docker-clean:
125+
@echo "🧹 Cleaning test containers..."
126+
-docker rmi chronos-core:test 2>/dev/null
127+
-docker rmi chronos-web:test 2>/dev/null
128+
-docker rmi chronos-query-service:test 2>/dev/null
129+
-docker rmi chronos-mcp-server:test 2>/dev/null
130+
-docker rmi chronos-control-plane:test 2>/dev/null
131+
@echo "✅ Test images cleaned"
132+
133+
# Individual container builds
134+
docker-core:
135+
@echo "🐳 Building core container..."
136+
docker build -t chronos-core:test apps/core
137+
138+
docker-web:
139+
@echo "🐳 Building web container..."
140+
docker build -f apps/web/Dockerfile -t chronos-web:test .
141+
142+
docker-query:
143+
@echo "🐳 Building query-service container..."
144+
docker build -t chronos-query-service:test apps/query-service
145+
146+
docker-mcp:
147+
@echo "🐳 Building mcp-server container..."
148+
docker build -t chronos-mcp-server:test apps/mcp-server-elixir
149+
150+
docker-control:
151+
@echo "🐳 Building control-plane container..."
152+
docker build -t chronos-control-plane:test apps/control-plane
153+
154+
# =============================================================================
155+
# Docker Compose Commands
156+
# =============================================================================
157+
158+
up:
159+
@echo "🚀 Starting all services with Docker Compose..."
160+
docker compose up -d
161+
162+
down:
163+
@echo "🛑 Stopping all services..."
164+
docker compose down
165+
166+
logs:
167+
docker compose logs -f
168+
169+
ps:
170+
docker compose ps

apps/core/Dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ WORKDIR /app
2727
# =============================================================================
2828
FROM chef AS planner
2929

30+
# Copy all source files needed by Cargo.toml
3031
COPY Cargo.toml Cargo.lock ./
3132
COPY src ./src
33+
COPY benches ./benches
34+
COPY examples ./examples
35+
COPY tests ./tests
3236

3337
RUN cargo chef prepare --recipe-path recipe.json
3438

@@ -45,13 +49,16 @@ ARG BUILDTIME=unknown
4549
COPY --from=planner /app/recipe.json recipe.json
4650
RUN cargo chef cook --release --recipe-path recipe.json
4751

48-
# Copy source and build application
52+
# Copy all source files
4953
COPY Cargo.toml Cargo.lock ./
5054
COPY src ./src
55+
COPY benches ./benches
56+
COPY examples ./examples
57+
COPY tests ./tests
5158

5259
# Build with version info embedded
5360
ENV CARGO_BUILD_JOBS=4
54-
RUN cargo build --release --locked --bin allsource-core && \
61+
RUN cargo build --release --bin allsource-core && \
5562
strip /app/target/release/allsource-core
5663

5764
# =============================================================================

apps/query-service/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Chronos Query Service - Production-Optimized Multi-Stage Dockerfile
44
# =============================================================================
55

6-
ARG ELIXIR_VERSION=1.18
6+
ARG ELIXIR_VERSION=1.17
77
ARG OTP_VERSION=27
88
ARG ALPINE_VERSION=3.20
99

@@ -70,7 +70,8 @@ RUN apk add --no-cache \
7070
ncurses-libs \
7171
libstdc++ \
7272
libgcc \
73-
tini && \
73+
tini \
74+
wget && \
7475
rm -rf /var/cache/apk/* /tmp/*
7576

7677
# Create non-root user

apps/web/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ RUN bun run build
7070
# =============================================================================
7171
# Stage 3: Runtime
7272
# =============================================================================
73-
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION:+${ALPINE_VERSION}} AS runner
73+
FROM node:${NODE_VERSION}-alpine3.20 AS runner
7474

7575
ARG VERSION=dev
7676
ARG REVISION=unknown
@@ -94,8 +94,8 @@ ENV NODE_ENV=production \
9494
PORT=3000 \
9595
HOSTNAME="0.0.0.0"
9696

97-
# Install tini and create non-root user
98-
RUN apk add --no-cache tini && \
97+
# Install tini, wget for healthcheck, and create non-root user
98+
RUN apk add --no-cache tini wget && \
9999
rm -rf /var/cache/apk/* && \
100100
addgroup --system --gid 1001 nodejs && \
101101
adduser --system --uid 1001 nextjs

0 commit comments

Comments
 (0)