Skip to content

feat: port codeiq from Java/Spring Boot to Go single-binary (Phases 1-4) #3

feat: port codeiq from Java/Spring Boot to Go single-binary (Phases 1-4)

feat: port codeiq from Java/Spring Boot to Go single-binary (Phases 1-4) #3

Workflow file for this run

name: go-parity
on:
pull_request:
branches: [main]
paths:
- 'go/**'
- 'src/**'
- 'pom.xml'
- '.github/workflows/go-parity.yml'
permissions:
contents: read
jobs:
parity:
name: Java vs Go parity (fixture-minimal)
runs-on: ubuntu-latest
env:
CGO_ENABLED: "1"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '25'
cache: maven
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: true
cache-dependency-path: go/go.sum
- name: Install C toolchain
run: sudo apt-get update -y && sudo apt-get install -y build-essential
- name: Build Java jar
run: mvn -B -q -DskipTests package
- name: Build Go binary
working-directory: go
run: go build -o codeiq ./cmd/codeiq
- name: Stage Java fixture (separate copy so caches don't collide)
run: |
cp -r go/testdata/fixture-minimal /tmp/fm-java
- name: Run Java index on fixture
run: java -jar target/code-iq-*-cli.jar index /tmp/fm-java
- name: Run Java enrich on fixture
run: |
# `graph -f json` reads from Neo4j (serving profile), not H2. Need
# to enrich the H2 cache into Neo4j first or the export prints
# "No graph data found. Run 'codeiq analyze' first."
java -Dspring.profiles.active=serving -jar target/code-iq-*-cli.jar enrich /tmp/fm-java
- name: Normalize Java output via Java helper
run: |
# The Java cache is H2, not SQLite — parity-normalize (Go-side)
# cannot read it directly. Instead, use the Java side's `graph`
# command to emit JSON (requires serving profile to access Neo4j),
# then a small jq filter to produce the same canonical shape the
# Go normalizer emits. The jq script lives at
# parity/java-normalize.jq (committed in this PR).
# Run from the fixture dir so the Neo4j path is resolved relative
# to where `enrich` wrote it.
cd /tmp/fm-java
java -Dspring.profiles.active=serving \
-jar "$GITHUB_WORKSPACE"/target/code-iq-*-cli.jar graph . -f json \
> /tmp/java-raw.json
jq -f "$GITHUB_WORKSPACE"/go/parity/java-normalize.jq /tmp/java-raw.json \
> /tmp/java-normalized.json
- name: Run Go parity test
working-directory: go
env:
TEST_JAVA_NORMALIZED: /tmp/java-normalized.json
run: go test -tags=parity ./parity/... -v
- name: Upload diff on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: parity-diff
path: /tmp/java-normalized.json