Files
neuron-web/.gitea/workflows/dev.yaml
T
will.anderson 7aa993d193
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 17m6s
fix: PR CI works without secrets — use committed El runtime for pull_request builds
Gitea does not inject secrets for pull_request events. All push/workflow_dispatch
CI was already working. PR builds were failing at Clone el and Authenticate to GCP.

Fix: for pull_request events, skip El clone and GCP auth entirely. Instead build
EL_HOME from committed files: bin/elc-linux-amd64 + runtime/{el_runtime.c,.h,.js}.
build-stage.sh already knows about bin/elc-linux-amd64 for JS compilation; this
extends that pattern to the native compiler and JS runtime.

Docker --cache-from is skipped implicitly (no docker auth configured for PR builds)
— BuildKit handles unauthenticated cache-from gracefully, continuing without cache.
2026-05-07 01:18:47 -05:00

153 lines
5.3 KiB
YAML

name: Dev — Build & local smoke test
# Validates that the build compiles and the server starts cleanly.
# No GCP deployment — this is the inner dev loop gate.
# Merge to stage when you want a real environment.
on:
push:
branches: [dev]
paths:
- 'src/**'
- 'dist/**'
- 'runtime/**'
- 'Dockerfile.stage'
- 'build-stage.sh'
- '.gitea/workflows/dev.yaml'
- '.gitea/workflows/stage.yaml'
- '.gitea/workflows/deploy.yaml'
pull_request:
branches: [dev]
paths:
- 'src/**'
- 'dist/**'
- 'runtime/**'
- 'Dockerfile.stage'
- 'build-stage.sh'
- '.gitea/workflows/dev.yaml'
- '.gitea/workflows/stage.yaml'
- '.gitea/workflows/deploy.yaml'
workflow_dispatch:
jobs:
build-smoke:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Clone el (provides elc compiler)
# push/workflow_dispatch only — pull_request events don't get secrets injected
if: github.event_name != 'pull_request'
env:
CHECKOUT_TOKEN: ${{ secrets.CHECKOUT_TOKEN }}
run: |
set -euo pipefail
DEST="${{ github.workspace }}/../foundation-el"
rm -rf "$DEST"
git clone --depth 1 \
"https://will:${CHECKOUT_TOKEN}@git.neuralplatform.ai/neuron-technologies/el.git" \
"$DEST"
echo "EL_HOME=$DEST" >> "$GITHUB_ENV"
- name: Set up El SDK from committed runtime (PR builds)
# pull_request events have no secrets — build from committed bin/ and runtime/
if: github.event_name == 'pull_request'
run: |
set -euo pipefail
DEST="${{ github.workspace }}/../foundation-el"
mkdir -p "$DEST/dist/platform" "$DEST/el-compiler/runtime"
cp bin/elc-linux-amd64 "$DEST/dist/platform/elc"
cp bin/elc-linux-amd64 "$DEST/dist/platform/elc-linux-amd64"
chmod +x "$DEST/dist/platform/elc" "$DEST/dist/platform/elc-linux-amd64"
cp runtime/el_runtime.c "$DEST/el-compiler/runtime/"
cp runtime/el_runtime.h "$DEST/el-compiler/runtime/"
cp runtime/el_runtime.js "$DEST/el-compiler/runtime/"
echo "EL_HOME=$DEST" >> "$GITHUB_ENV"
echo "El SDK set up from committed runtime files (no CHECKOUT_TOKEN needed)"
- name: Authenticate to GCP
if: github.event_name != 'pull_request'
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Set up gcloud SDK
if: github.event_name != 'pull_request'
uses: google-github-actions/setup-gcloud@v2
with:
project_id: neuron-785695
- name: Configure docker auth for Artifact Registry
if: github.event_name != 'pull_request'
run: gcloud auth configure-docker us-central1-docker.pkg.dev --quiet
- name: Get elc (pre-built linux/amd64 from El repo)
# Only needed for push/workflow_dispatch — PR builds set up elc from committed bin/
if: github.event_name != 'pull_request'
run: |
set -euo pipefail
ELC_SRC="$EL_HOME/dist/platform/elc-linux-amd64"
if [ -f "$ELC_SRC" ]; then
cp "$ELC_SRC" "$EL_HOME/dist/platform/elc"
chmod +x "$EL_HOME/dist/platform/elc"
else
curl -fL -o "$EL_HOME/dist/platform/elc" \
https://git.neuralplatform.ai/neuron-technologies/el/releases/download/v1.2.1/elc-linux-amd64
chmod +x "$EL_HOME/dist/platform/elc"
fi
- name: Compute image tag
id: tag
run: echo "tag=dev-${GITHUB_SHA:0:8}" >> "$GITHUB_OUTPUT"
- name: Touch HTML placeholder files
# El binary regenerates these at startup via fs_write. They must exist
# in the build context for Dockerfile COPY to succeed. touch is
# idempotent if the files already exist from a prior run.
run: touch src/index.html src/about.html src/terms.html src/enterprise-terms.html
- name: Build image (local only — no push)
run: ./build-stage.sh "${{ steps.tag.outputs.tag }}"
- name: Local smoke test
run: |
set -euo pipefail
IMAGE="marketing:${{ steps.tag.outputs.tag }}"
docker run -d --name dev-smoke \
-p 8080:8080 \
-e PORT=8080 \
-e NODE_ENV=production \
-e LANDING_ROOT=/srv/landing \
"$IMAGE"
# entrypoint.sh sleeps 4s for soul-demo to load before starting neuron-web.
# Poll up to 45s total.
for i in $(seq 1 15); do
STATUS=$(curl -sSo /dev/null -w "%{http_code}" --max-time 5 http://localhost:8080/ || echo "000")
echo "Attempt $i/15: HTTP $STATUS"
if [ "$STATUS" = "200" ]; then
echo "Dev smoke test PASSED"
docker stop dev-smoke && docker rm dev-smoke
exit 0
fi
sleep 3
done
echo "--- container logs ---"
docker logs dev-smoke || true
docker stop dev-smoke && docker rm dev-smoke || true
echo "Dev smoke test FAILED"
exit 1