14cae0dcb5
The El repo only has a darwin arm64 elc binary. The v1.2.1 linux binary predates native HTML template syntax. Compile elc.c (the committed C source of the El compiler) on linux/amd64 in CI to get a native binary that supports the new syntax.
126 lines
4.1 KiB
YAML
126 lines
4.1 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'
|
|
|
|
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 (build linux elc from repo C source)
|
|
env:
|
|
CHECKOUT_TOKEN: ${{ secrets.CHECKOUT_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
# Ensure build tools are available (ci-base may not have gcc)
|
|
if ! command -v cc >/dev/null 2>&1; then
|
|
apt-get update -qq
|
|
apt-get install -y -qq gcc libcurl4-openssl-dev libssl-dev
|
|
fi
|
|
|
|
DEST="${{ github.workspace }}/../foundation-el"
|
|
|
|
# Clone El repo for source files, runtime, and JS runtime
|
|
git -c "http.extraheader=Authorization: token ${CHECKOUT_TOKEN}" clone \
|
|
--depth=1 \
|
|
"https://git.neuralplatform.ai/neuron-technologies/el.git" \
|
|
"$DEST"
|
|
|
|
# Compile elc.c (committed C source of the El compiler) for linux/amd64.
|
|
# The darwin arm64 binary at lang/dist/platform/elc can't run on linux.
|
|
# elc.c is the same compiler source but in C — compile it natively here.
|
|
cc -std=c11 -O2 \
|
|
-I "$DEST/lang/el-compiler/runtime" \
|
|
-lcurl -lpthread \
|
|
-o "$DEST/lang/dist/platform/elc" \
|
|
"$DEST/lang/dist/platform/elc.c" \
|
|
"$DEST/lang/el-compiler/runtime/el_runtime.c"
|
|
|
|
chmod +x "$DEST/lang/dist/platform/elc"
|
|
echo "EL_HOME=$DEST/lang" >> "$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 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
|