|
| 1 | +# Continuous-integration gates — run on every PR + every push to |
| 2 | +# main. Catches frontend type errors, Go vet/test regressions, and |
| 3 | +# the "I forgot to run `make web-build` before committing" class of |
| 4 | +# bug that silently shipped pre-v1.6.0. |
| 5 | +# |
| 6 | +# Tagged-release builds are handled by npm-release.yml; this file is |
| 7 | +# the pre-merge / pre-tag safety net. |
| 8 | + |
| 9 | +name: ci |
| 10 | + |
| 11 | +on: |
| 12 | + pull_request: |
| 13 | + push: |
| 14 | + branches: [main] |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: read |
| 18 | + |
| 19 | +jobs: |
| 20 | + # ---------------------------------------------------------------- |
| 21 | + # React frontend gates: install, typecheck, build. Also asserts the |
| 22 | + # committed embedded dist matches what a fresh build produces — if |
| 23 | + # `web/src/` was edited without rerunning `make web-build`, this |
| 24 | + # job fails with a clear actionable message. Without this gate the |
| 25 | + # embedded bundle silently drifted from the React source. |
| 26 | + # ---------------------------------------------------------------- |
| 27 | + frontend: |
| 28 | + name: frontend |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v5 |
| 32 | + |
| 33 | + - uses: actions/setup-node@v5 |
| 34 | + with: |
| 35 | + node-version: '22' |
| 36 | + cache: 'npm' |
| 37 | + cache-dependency-path: web/package-lock.json |
| 38 | + |
| 39 | + - name: npm ci |
| 40 | + run: | |
| 41 | + cd web |
| 42 | + npm ci |
| 43 | +
|
| 44 | + - name: typecheck |
| 45 | + run: | |
| 46 | + cd web |
| 47 | + npm run typecheck |
| 48 | +
|
| 49 | + - name: build |
| 50 | + run: | |
| 51 | + cd web |
| 52 | + npm run build |
| 53 | +
|
| 54 | + - name: dist consistency check |
| 55 | + # Mirrors `make web-build`'s second half: regenerates the |
| 56 | + # embedded dir from web/dist and asserts it matches what's |
| 57 | + # committed. If it doesn't, the dev edited web/src/ but |
| 58 | + # forgot to commit the rebuilt bundle — a stale embed would |
| 59 | + # ship on the next release. |
| 60 | + run: | |
| 61 | + set -euo pipefail |
| 62 | + rm -rf internal/intelligence/dashboard/webapp/dist |
| 63 | + mkdir -p internal/intelligence/dashboard/webapp/dist |
| 64 | + cp -R web/dist/. internal/intelligence/dashboard/webapp/dist/ |
| 65 | + if ! git diff --quiet --exit-code internal/intelligence/dashboard/webapp/dist; then |
| 66 | + echo "::error::Committed webapp/dist drifted from web/dist. Run \`make web-build\` and commit the result." |
| 67 | + git diff --stat internal/intelligence/dashboard/webapp/dist | head -40 |
| 68 | + exit 1 |
| 69 | + fi |
| 70 | + echo "embedded dist matches fresh build ✓" |
| 71 | +
|
| 72 | + # ---------------------------------------------------------------- |
| 73 | + # Go gates — vet, test, build. Pure-Go so no special toolchain |
| 74 | + # beyond setup-go. Frontend build is independent (this job doesn't |
| 75 | + # need a fresh dist to compile; the committed embed satisfies the |
| 76 | + # //go:embed directive at compile time, even if it's stale for the |
| 77 | + # purposes of the runtime UI). |
| 78 | + # ---------------------------------------------------------------- |
| 79 | + go: |
| 80 | + name: go |
| 81 | + runs-on: ubuntu-latest |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v5 |
| 84 | + |
| 85 | + - uses: actions/setup-go@v6 |
| 86 | + with: |
| 87 | + go-version-file: 'go.mod' |
| 88 | + cache: true |
| 89 | + |
| 90 | + - name: vet |
| 91 | + run: go vet ./... |
| 92 | + |
| 93 | + - name: lint |
| 94 | + # golangci-lint enforces the full .golangci.yml set — including |
| 95 | + # gofumpt + goimports formatting, errorlint, gosec, gocritic, and |
| 96 | + # gocyclo (threshold 30; see .golangci.yml for the documented |
| 97 | + # pre-existing exclusions). Joined CI in Teams M5; the tree is clean. |
| 98 | + uses: golangci/golangci-lint-action@v6 |
| 99 | + with: |
| 100 | + version: v1.64.8 |
| 101 | + # Build golangci-lint from source with the runner's Go (1.25 via |
| 102 | + # setup-go/go.mod). The prebuilt v1.64.8 binary is compiled with |
| 103 | + # go1.24 and refuses to run against a go.mod that targets 1.25 |
| 104 | + # ("language version used to build golangci-lint is lower than the |
| 105 | + # targeted Go version"). goinstall sidesteps that mismatch. |
| 106 | + install-mode: goinstall |
| 107 | + |
| 108 | + - name: test |
| 109 | + # -race catches the watcher / proxy concurrency bugs that |
| 110 | + # otherwise slip past until live use. |
| 111 | + run: go test -race ./... |
| 112 | + |
| 113 | + - name: build |
| 114 | + # `make build` skipped here — that target requires Node for |
| 115 | + # web-build, which the frontend job already verified. This |
| 116 | + # step exercises the Go compile path against the committed |
| 117 | + # embedded dist. |
| 118 | + run: | |
| 119 | + mkdir -p bin |
| 120 | + go build -trimpath -o bin/observer ./cmd/observer |
| 121 | + GOOS=windows GOARCH=amd64 go build -trimpath -o bin/antigravity-bridge.exe ./cmd/antigravity-bridge |
| 122 | + ls -l bin/ |
| 123 | +
|
| 124 | + # ---------------------------------------------------------------- |
| 125 | + # Helm chart smoke (Teams M5). Lint + template the observer-org chart, |
| 126 | + # then `helm install` it into an ephemeral kind cluster to prove the |
| 127 | + # rendered manifests are accepted by a real API server and the release |
| 128 | + # deploys. Pod readiness is NOT asserted: the server fetches its SAML |
| 129 | + # IdP metadata at startup, so a Ready pod needs real secrets + a |
| 130 | + # reachable IdP that the operator supplies. Here we verify the chart |
| 131 | + # installs cleanly and the core objects are created. |
| 132 | + # ---------------------------------------------------------------- |
| 133 | + helm: |
| 134 | + name: helm chart |
| 135 | + runs-on: ubuntu-latest |
| 136 | + steps: |
| 137 | + - uses: actions/checkout@v5 |
| 138 | + |
| 139 | + - uses: azure/setup-helm@v4 |
| 140 | + with: |
| 141 | + version: v3.21.0 |
| 142 | + |
| 143 | + - name: Lint + template |
| 144 | + run: | |
| 145 | + set -euo pipefail |
| 146 | + helm lint charts/observer-org -f charts/observer-org/ci/test-values.yaml |
| 147 | + helm template obs charts/observer-org -f charts/observer-org/ci/test-values.yaml > /dev/null |
| 148 | +
|
| 149 | + - name: Create kind cluster |
| 150 | + uses: helm/kind-action@v1 |
| 151 | + |
| 152 | + - name: Install into kind |
| 153 | + run: | |
| 154 | + set -euo pipefail |
| 155 | + kubectl create namespace obs |
| 156 | + # Placeholder secret so the required secrets.existingSecret |
| 157 | + # resolves. Not valid key material — the pod won't reach Ready |
| 158 | + # (no live IdP), but the release installs and every manifest is |
| 159 | + # validated by the real API server. |
| 160 | + kubectl create secret generic observer-org-secrets -n obs \ |
| 161 | + --from-literal=bearer-signing.key=placeholder \ |
| 162 | + --from-literal=session.key=placeholder \ |
| 163 | + --from-literal=sp.crt=placeholder \ |
| 164 | + --from-literal=sp.key=placeholder \ |
| 165 | + --from-literal=scim-token=placeholder |
| 166 | + helm install obs charts/observer-org -n obs \ |
| 167 | + -f charts/observer-org/ci/test-values.yaml |
| 168 | + echo "=== release status ===" |
| 169 | + helm status obs -n obs |
| 170 | + echo "=== objects ===" |
| 171 | + kubectl get deploy,svc,pvc,cm,sa -n obs |
| 172 | + kubectl get deploy/obs-observer-org -n obs |
| 173 | + kubectl get svc/obs-observer-org -n obs |
| 174 | + kubectl get pvc -n obs | grep -q obs-observer-org-data |
| 175 | + echo "Helm chart installs cleanly ✓" |
0 commit comments