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' - 'manifest.el' - '.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: Set up El SDK run: echo "EL_HOME=/opt/el" >> "$GITHUB_ENV" - name: Authenticate to GCP uses: google-github-actions/auth@v2 with: credentials_json: ${{ secrets.GCP_SA_KEY }} - name: Set up gcloud SDK uses: google-github-actions/setup-gcloud@v2 with: project_id: neuron-785695 - name: Configure docker auth for Artifact Registry run: gcloud auth configure-docker us-central1-docker.pkg.dev --quiet - 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 El binary (elb) # elb compiles each .el source independently (no combined mega-file), # then links via cc. Output: dist/neuron-landing (linux/amd64 binary). # This avoids the exponential memory growth that hits elc on the # concatenated main-combined.el approach. run: | set -euo pipefail export EL_HOME=/opt/el /opt/el/dist/bin/elb build --runtime=/opt/el/el-compiler/runtime echo "Binary: $(ls -lh dist/neuron-landing)" - name: Compile JS El sources run: | set -euo pipefail ELC=/opt/el/dist/platform/elc mkdir -p dist/js for f in src/js/*.el; do [ -f "$f" ] || continue name=$(basename "$f" .el) "$ELC" --target=js --bundle --minify --obfuscate "$f" > "dist/js/${name}.js" echo " compiled: $f → dist/js/${name}.js" done - name: Build Docker image (local only — no push) run: | set -euo pipefail TAG="${{ steps.tag.outputs.tag }}" docker build \ --cache-from us-central1-docker.pkg.dev/neuron-785695/neuron-marketing/marketing:latest \ -f Dockerfile.stage \ -t "marketing:${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