Skip to content

Commit f464364

Browse files
aksOpsclaude
andcommitted
feat: add Phase 6 — CI/CD pipelines, Docker image, Helm chart, and release setup
Add GitHub Actions workflows (CI, release to Maven Central, SonarCloud), multi-stage Dockerfile with ZGC, docker-compose for local dev, Helm chart with HPA and health probes, and Maven Central publishing profile in pom.xml. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a720d7b commit f464364

13 files changed

Lines changed: 402 additions & 0 deletions

File tree

.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.git
2+
target
3+
node_modules
4+
*.md
5+
docs/
6+
tests/
7+
.github/
8+
helm/
9+
src/osscodeiq/

.github/workflows/ci-java.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Java CI
2+
on:
3+
push:
4+
branches: [java]
5+
paths: ['src/**', 'pom.xml']
6+
pull_request:
7+
branches: [java]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
java: ['25']
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-java@v4
18+
with:
19+
distribution: 'temurin'
20+
java-version: ${{ matrix.java }}
21+
cache: 'maven'
22+
- run: mvn clean verify -B
23+
- uses: actions/upload-artifact@v4
24+
with:
25+
name: test-results
26+
path: target/surefire-reports/
27+
- uses: actions/upload-artifact@v4
28+
with:
29+
name: coverage-report
30+
path: target/site/jacoco/

.github/workflows/release-java.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release to Maven Central
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: 'Release version (e.g., 0.1.0)'
7+
required: true
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-java@v4
15+
with:
16+
distribution: 'temurin'
17+
java-version: '25'
18+
cache: 'maven'
19+
server-id: central
20+
server-username: MAVEN_USERNAME
21+
server-password: MAVEN_PASSWORD
22+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
23+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
24+
- name: Set release version
25+
env:
26+
RELEASE_VERSION: ${{ inputs.version }}
27+
run: mvn versions:set -DnewVersion="$RELEASE_VERSION"
28+
- name: Deploy to Maven Central
29+
env:
30+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
31+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
32+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
33+
run: mvn clean deploy -P release -B
34+
- name: Tag release
35+
env:
36+
RELEASE_VERSION: ${{ inputs.version }}
37+
run: |
38+
git tag "v${RELEASE_VERSION}"
39+
git push origin "v${RELEASE_VERSION}"
40+
- uses: softprops/action-gh-release@v2
41+
with:
42+
tag_name: v${{ inputs.version }}
43+
generate_release_notes: true
44+
files: target/code-iq-*.jar
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: SonarCloud Java
2+
on:
3+
push:
4+
branches: [java]
5+
paths: ['src/**', 'pom.xml']
6+
pull_request:
7+
branches: [java]
8+
9+
jobs:
10+
sonar:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- uses: actions/setup-java@v4
17+
with:
18+
distribution: 'temurin'
19+
java-version: '25'
20+
cache: 'maven'
21+
- name: Build and analyze
22+
env:
23+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
24+
run: >
25+
mvn clean verify sonar:sonar -B
26+
-Dsonar.projectKey=RandomCodeSpace_code-iq-java
27+
-Dsonar.organization=randomcodespace
28+
-Dsonar.host.url=https://sonarcloud.io

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Multi-stage build
2+
FROM eclipse-temurin:25-jdk AS builder
3+
WORKDIR /build
4+
COPY pom.xml .
5+
COPY src ./src
6+
RUN --mount=type=cache,target=/root/.m2 \
7+
mvn clean package -DskipTests -B
8+
9+
# Runtime
10+
FROM eclipse-temurin:25-jre
11+
WORKDIR /app
12+
COPY --from=builder /build/target/code-iq-*.jar app.jar
13+
14+
# AOT cache training (optional, for faster startup)
15+
# RUN java -XX:AOTCacheOutput=app.aot -Dspring.context.exit=onRefresh -jar app.jar || true
16+
17+
EXPOSE 8080
18+
ENTRYPOINT ["java", "-XX:+UseZGC", "-jar", "app.jar"]

docker-compose.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: '3.8'
2+
services:
3+
code-iq:
4+
build: .
5+
ports:
6+
- "8080:8080"
7+
volumes:
8+
- ./data:/app/data
9+
environment:
10+
- SPRING_PROFILES_ACTIVE=serving
11+
- CODEIQ_GRAPH_PATH=/app/data/graph.db

helm/code-iq/Chart.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v2
2+
name: code-iq
3+
description: OSSCodeIQ — deterministic code knowledge graph server
4+
type: application
5+
version: 0.1.0
6+
appVersion: "0.1.0"
7+
maintainers:
8+
- name: RandomCodeSpace
9+
url: https://github.com/RandomCodeSpace
10+
sources:
11+
- https://github.com/RandomCodeSpace/code-iq
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ .Release.Name }}-code-iq-config
5+
labels:
6+
app: {{ .Release.Name }}-code-iq
7+
data:
8+
application.yml: |
9+
spring:
10+
profiles:
11+
active: serving
12+
codeiq:
13+
graph:
14+
path: /app/data/graph.db
15+
management:
16+
endpoints:
17+
web:
18+
exposure:
19+
include: health,info,metrics
20+
endpoint:
21+
health:
22+
probes:
23+
enabled: true
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ .Release.Name }}-code-iq
5+
labels:
6+
app: {{ .Release.Name }}-code-iq
7+
spec:
8+
{{- if not .Values.autoscaling.enabled }}
9+
replicas: {{ .Values.replicaCount }}
10+
{{- end }}
11+
selector:
12+
matchLabels:
13+
app: {{ .Release.Name }}-code-iq
14+
template:
15+
metadata:
16+
labels:
17+
app: {{ .Release.Name }}-code-iq
18+
spec:
19+
containers:
20+
- name: code-iq
21+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
22+
imagePullPolicy: {{ .Values.image.pullPolicy }}
23+
ports:
24+
- name: http
25+
containerPort: {{ .Values.service.port }}
26+
protocol: TCP
27+
env:
28+
{{- range $key, $value := .Values.env }}
29+
- name: {{ $key }}
30+
value: {{ $value | quote }}
31+
{{- end }}
32+
- name: HAZELCAST_CLUSTER_NAME
33+
value: {{ .Values.hazelcast.clusterName | quote }}
34+
- name: HAZELCAST_SERVICE_NAME
35+
value: {{ .Values.hazelcast.serviceName | quote }}
36+
readinessProbe:
37+
httpGet:
38+
path: {{ .Values.probes.readiness.path }}
39+
port: http
40+
initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }}
41+
periodSeconds: {{ .Values.probes.readiness.periodSeconds }}
42+
livenessProbe:
43+
httpGet:
44+
path: {{ .Values.probes.liveness.path }}
45+
port: http
46+
initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }}
47+
periodSeconds: {{ .Values.probes.liveness.periodSeconds }}
48+
resources:
49+
{{- toYaml .Values.resources | nindent 12 }}
50+
volumeMounts:
51+
- name: data
52+
mountPath: /app/data
53+
volumes:
54+
- name: data
55+
emptyDir: {}

helm/code-iq/templates/hpa.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- if .Values.autoscaling.enabled }}
2+
apiVersion: autoscaling/v2
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
name: {{ .Release.Name }}-code-iq
6+
labels:
7+
app: {{ .Release.Name }}-code-iq
8+
spec:
9+
scaleTargetRef:
10+
apiVersion: apps/v1
11+
kind: Deployment
12+
name: {{ .Release.Name }}-code-iq
13+
minReplicas: {{ .Values.autoscaling.minReplicas }}
14+
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
15+
metrics:
16+
- type: Resource
17+
resource:
18+
name: cpu
19+
target:
20+
type: Utilization
21+
averageUtilization: {{ .Values.autoscaling.targetCPU }}
22+
{{- end }}

0 commit comments

Comments
 (0)