108 lines
3.6 KiB
YAML
108 lines
3.6 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 from release
|
|
env:
|
|
CHECKOUT_TOKEN: ${{ secrets.CHECKOUT_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
EL_HOME="${{ github.workspace }}/../foundation-el"
|
|
mkdir -p "$EL_HOME/dist/platform" "$EL_HOME/el-compiler/runtime"
|
|
BASE_URL="https://git.neuralplatform.ai/neuron-technologies/el/releases/download/v1.2.1"
|
|
curl -fL -H "Authorization: token ${CHECKOUT_TOKEN}" -o "$EL_HOME/dist/platform/elc" "$BASE_URL/elc-linux-amd64"
|
|
curl -fL -H "Authorization: token ${CHECKOUT_TOKEN}" -o "$EL_HOME/el-compiler/runtime/el_runtime.c" "$BASE_URL/el_runtime.c"
|
|
curl -fL -H "Authorization: token ${CHECKOUT_TOKEN}" -o "$EL_HOME/el-compiler/runtime/el_runtime.h" "$BASE_URL/el_runtime.h"
|
|
chmod +x "$EL_HOME/dist/platform/elc"
|
|
echo "EL_HOME=$EL_HOME" >> "$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
|
|
|