Archived
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bc2e4c6e22 |
@@ -0,0 +1,121 @@
|
||||
name: Engram CI — dev
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get install -y gcc libcurl4-openssl-dev
|
||||
|
||||
# Install El SDK from dev artifact registry
|
||||
- name: Install El SDK from dev registry
|
||||
env:
|
||||
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
|
||||
run: |
|
||||
echo "${GCP_SA_KEY}" > /tmp/gcp-key.json
|
||||
apt-get install -y -qq apt-transport-https ca-certificates gnupg curl
|
||||
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
|
||||
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list
|
||||
apt-get update -qq && apt-get install -y google-cloud-cli
|
||||
gcloud auth activate-service-account --key-file=/tmp/gcp-key.json
|
||||
gcloud config set project neuron-785695
|
||||
|
||||
mkdir -p /usr/local/bin /usr/local/lib/el
|
||||
|
||||
# Download the latest-versioned elc from dev registry
|
||||
# Fall back to the Gitea latest release if no dev artifact exists yet
|
||||
LATEST_VERSION=$(gcloud artifacts versions list \
|
||||
--repository=foundation-dev \
|
||||
--location=us-central1 \
|
||||
--project=neuron-785695 \
|
||||
--package=el/elc \
|
||||
--format="value(name)" 2>/dev/null | sort | tail -1 | sed 's|.*/||' || true)
|
||||
|
||||
if [ -n "${LATEST_VERSION}" ]; then
|
||||
echo "Downloading elc ${LATEST_VERSION} from foundation-dev..."
|
||||
gcloud artifacts generic download \
|
||||
--repository=foundation-dev \
|
||||
--location=us-central1 \
|
||||
--project=neuron-785695 \
|
||||
--package=el/elc \
|
||||
--version="${LATEST_VERSION}" \
|
||||
--destination=/usr/local/bin/elc
|
||||
chmod +x /usr/local/bin/elc
|
||||
else
|
||||
echo "No dev artifact found, falling back to Gitea latest release..."
|
||||
RELEASE_BASE="https://git.neuralplatform.ai/neuron-technologies/el/releases/download/latest"
|
||||
curl -fsSL "${RELEASE_BASE}/elc" -o /usr/local/bin/elc
|
||||
chmod +x /usr/local/bin/elc
|
||||
fi
|
||||
|
||||
# Always get runtime from Gitea latest release
|
||||
RELEASE_BASE="https://git.neuralplatform.ai/neuron-technologies/el/releases/download/latest"
|
||||
curl -fsSL "${RELEASE_BASE}/el_runtime.c" -o /usr/local/lib/el/el_runtime.c
|
||||
curl -fsSL "${RELEASE_BASE}/el_runtime.h" -o /usr/local/lib/el/el_runtime.h
|
||||
|
||||
echo "El SDK installed:"
|
||||
elc --version || true
|
||||
rm -f /tmp/gcp-key.json
|
||||
|
||||
# Compile server.el → dist/engram.c
|
||||
- name: Compile server.el
|
||||
run: |
|
||||
mkdir -p dist
|
||||
elc src/server.el > dist/engram.c
|
||||
echo "Compiled src/server.el → dist/engram.c"
|
||||
|
||||
# Link to produce the engram binary
|
||||
- name: Link engram binary
|
||||
run: |
|
||||
cc -std=c11 -O2 \
|
||||
-I /usr/local/lib/el \
|
||||
-o dist/engram \
|
||||
dist/engram.c \
|
||||
/usr/local/lib/el/el_runtime.c \
|
||||
-lcurl -lpthread
|
||||
echo "Linked dist/engram"
|
||||
ls -lh dist/engram
|
||||
|
||||
# Run tests if spec directory contains runnable tests
|
||||
- name: Run tests
|
||||
run: |
|
||||
if [ -f spec/run.sh ]; then
|
||||
bash spec/run.sh
|
||||
else
|
||||
echo "No spec/run.sh found — skipping test run"
|
||||
fi
|
||||
|
||||
# Publish artifact to GCP Artifact Registry (dev)
|
||||
- name: Publish engram to Artifact Registry (dev)
|
||||
env:
|
||||
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
|
||||
run: |
|
||||
echo "${GCP_SA_KEY}" > /tmp/gcp-key.json
|
||||
gcloud auth activate-service-account --key-file=/tmp/gcp-key.json
|
||||
gcloud config set project neuron-785695
|
||||
|
||||
VERSION="${GITEA_SHA:0:8}"
|
||||
gcloud artifacts generic upload \
|
||||
--repository=foundation-dev \
|
||||
--location=us-central1 \
|
||||
--project=neuron-785695 \
|
||||
--package=engram/engram \
|
||||
--version="${VERSION}" \
|
||||
--source=dist/engram
|
||||
|
||||
echo "Published engram version=${VERSION} to foundation-dev/engram/engram"
|
||||
rm -f /tmp/gcp-key.json
|
||||
@@ -0,0 +1,118 @@
|
||||
name: Engram CI — stage
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- stage
|
||||
pull_request:
|
||||
branches:
|
||||
- stage
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get install -y gcc libcurl4-openssl-dev
|
||||
|
||||
# Install El SDK from stage artifact registry
|
||||
- name: Install El SDK from stage registry
|
||||
env:
|
||||
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
|
||||
run: |
|
||||
echo "${GCP_SA_KEY}" > /tmp/gcp-key.json
|
||||
apt-get install -y -qq apt-transport-https ca-certificates gnupg curl
|
||||
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
|
||||
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list
|
||||
apt-get update -qq && apt-get install -y google-cloud-cli
|
||||
gcloud auth activate-service-account --key-file=/tmp/gcp-key.json
|
||||
gcloud config set project neuron-785695
|
||||
|
||||
mkdir -p /usr/local/bin /usr/local/lib/el
|
||||
|
||||
LATEST_VERSION=$(gcloud artifacts versions list \
|
||||
--repository=foundation-stage \
|
||||
--location=us-central1 \
|
||||
--project=neuron-785695 \
|
||||
--package=el/elc \
|
||||
--format="value(name)" 2>/dev/null | sort | tail -1 | sed 's|.*/||' || true)
|
||||
|
||||
if [ -n "${LATEST_VERSION}" ]; then
|
||||
echo "Downloading elc ${LATEST_VERSION} from foundation-stage..."
|
||||
gcloud artifacts generic download \
|
||||
--repository=foundation-stage \
|
||||
--location=us-central1 \
|
||||
--project=neuron-785695 \
|
||||
--package=el/elc \
|
||||
--version="${LATEST_VERSION}" \
|
||||
--destination=/usr/local/bin/elc
|
||||
chmod +x /usr/local/bin/elc
|
||||
else
|
||||
echo "No stage artifact found, falling back to Gitea latest release..."
|
||||
RELEASE_BASE="https://git.neuralplatform.ai/neuron-technologies/el/releases/download/latest"
|
||||
curl -fsSL "${RELEASE_BASE}/elc" -o /usr/local/bin/elc
|
||||
chmod +x /usr/local/bin/elc
|
||||
fi
|
||||
|
||||
RELEASE_BASE="https://git.neuralplatform.ai/neuron-technologies/el/releases/download/latest"
|
||||
curl -fsSL "${RELEASE_BASE}/el_runtime.c" -o /usr/local/lib/el/el_runtime.c
|
||||
curl -fsSL "${RELEASE_BASE}/el_runtime.h" -o /usr/local/lib/el/el_runtime.h
|
||||
|
||||
echo "El SDK installed:"
|
||||
elc --version || true
|
||||
rm -f /tmp/gcp-key.json
|
||||
|
||||
# Compile server.el → dist/engram.c
|
||||
- name: Compile server.el
|
||||
run: |
|
||||
mkdir -p dist
|
||||
elc src/server.el > dist/engram.c
|
||||
echo "Compiled src/server.el → dist/engram.c"
|
||||
|
||||
# Link to produce the engram binary
|
||||
- name: Link engram binary
|
||||
run: |
|
||||
cc -std=c11 -O2 \
|
||||
-I /usr/local/lib/el \
|
||||
-o dist/engram \
|
||||
dist/engram.c \
|
||||
/usr/local/lib/el/el_runtime.c \
|
||||
-lcurl -lpthread
|
||||
echo "Linked dist/engram"
|
||||
ls -lh dist/engram
|
||||
|
||||
# Run tests if spec directory contains runnable tests
|
||||
- name: Run tests
|
||||
run: |
|
||||
if [ -f spec/run.sh ]; then
|
||||
bash spec/run.sh
|
||||
else
|
||||
echo "No spec/run.sh found — skipping test run"
|
||||
fi
|
||||
|
||||
# Publish artifact to GCP Artifact Registry (stage)
|
||||
- name: Publish engram to Artifact Registry (stage)
|
||||
env:
|
||||
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
|
||||
run: |
|
||||
echo "${GCP_SA_KEY}" > /tmp/gcp-key.json
|
||||
gcloud auth activate-service-account --key-file=/tmp/gcp-key.json
|
||||
gcloud config set project neuron-785695
|
||||
|
||||
VERSION="${GITEA_SHA:0:8}"
|
||||
gcloud artifacts generic upload \
|
||||
--repository=foundation-stage \
|
||||
--location=us-central1 \
|
||||
--project=neuron-785695 \
|
||||
--package=engram/engram \
|
||||
--version="${VERSION}" \
|
||||
--source=dist/engram
|
||||
|
||||
echo "Published engram version=${VERSION} to foundation-stage/engram/engram"
|
||||
rm -f /tmp/gcp-key.json
|
||||
@@ -110,6 +110,31 @@ jobs:
|
||||
|
||||
echo "Release published successfully"
|
||||
|
||||
# Publish artifact to GCP Artifact Registry (prod)
|
||||
- name: Publish engram to Artifact Registry (prod)
|
||||
env:
|
||||
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
|
||||
run: |
|
||||
echo "${GCP_SA_KEY}" > /tmp/gcp-key.json
|
||||
apt-get install -y -qq apt-transport-https ca-certificates gnupg curl
|
||||
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
|
||||
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list
|
||||
apt-get update -qq && apt-get install -y google-cloud-cli
|
||||
gcloud auth activate-service-account --key-file=/tmp/gcp-key.json
|
||||
gcloud config set project neuron-785695
|
||||
|
||||
VERSION="${GITEA_SHA:0:8}"
|
||||
gcloud artifacts generic upload \
|
||||
--repository=foundation-prod \
|
||||
--location=us-central1 \
|
||||
--project=neuron-785695 \
|
||||
--package=engram/engram \
|
||||
--version="${VERSION}" \
|
||||
--source=dist/engram
|
||||
|
||||
echo "Published engram version=${VERSION} to foundation-prod/engram/engram"
|
||||
rm -f /tmp/gcp-key.json
|
||||
|
||||
# Dispatch engram-updated to any downstream dependents
|
||||
- name: Dispatch engram-updated to dependents
|
||||
env:
|
||||
|
||||
Reference in New Issue
Block a user