name: El SDK CI - dev on: push: branches: - dev pull_request: branches: - dev jobs: build-and-test: runs-on: ubuntu-latest defaults: run: working-directory: lang steps: - name: Checkout uses: actions/checkout@v4 - name: Install build dependencies run: | apt-get update -qq apt-get install -y gcc libcurl4-openssl-dev # Gen2: compile the bootstrap C source into a working elc binary - name: Build elc from bootstrap (gen2) run: | # -Wl,--allow-multiple-definition: elc-bootstrap.c and el_runtime.c both define # is_digit/is_whitespace; bootstrap predates the text-processing primitives commit gcc -O2 \ -I el-compiler/runtime \ dist/elc-bootstrap.c \ el-compiler/runtime/el_runtime.c \ -lcurl -lpthread -lm \ -Wl,--allow-multiple-definition \ -o dist/elc-gen2 chmod +x dist/elc-gen2 echo "gen2 elc built" dist/elc-gen2 --version || true # Gen3: use gen2 to compile the El compiler from its own El source (self-host) - name: Self-host compile El compiler with gen2 (gen3) run: | mkdir -p dist/platform dist/elc-gen2 el-compiler/src/compiler.el > dist/elc-gen3.c gcc -O2 \ -I el-compiler/runtime \ dist/elc-gen3.c \ el-compiler/runtime/el_runtime.c \ -lcurl -lpthread -lm \ -o dist/platform/elc chmod +x dist/platform/elc echo "gen3 (self-hosted) elc built" dist/platform/elc --version || true - name: Run tests - text run: | ELC="$(pwd)/dist/platform/elc" \ EL_HOME="$(pwd)" \ bash tests/text/run.sh - name: Run tests - calendar run: | ELC="$(pwd)/dist/platform/elc" \ EL_HOME="$(pwd)" \ bash tests/calendar/run.sh - name: Run tests - time run: | ELC="$(pwd)/dist/platform/elc" \ EL_HOME="$(pwd)" \ bash tests/time/run.sh - name: Run tests - html_sanitizer run: | ELC="$(pwd)/dist/platform/elc" \ EL_HOME="$(pwd)" \ bash tests/html_sanitizer/run.sh # Native El test suites (elc --test, compile-link-run) - name: Run tests - native (core) run: | set -euo pipefail ELC="$(pwd)/dist/platform/elc" RUNTIME="$(pwd)/el-compiler/runtime" "$ELC" --test tests/native/test_core.el > /tmp/el_native_core.c gcc -O2 -I "$RUNTIME" /tmp/el_native_core.c "$RUNTIME/el_runtime.c" \ -lcurl -lpthread -lm -o /tmp/el_native_core /tmp/el_native_core - name: Run tests - native (text) run: | set -euo pipefail ELC="$(pwd)/dist/platform/elc" RUNTIME="$(pwd)/el-compiler/runtime" "$ELC" --test tests/native/test_text.el > /tmp/el_native_text.c gcc -O2 -I "$RUNTIME" /tmp/el_native_text.c "$RUNTIME/el_runtime.c" \ -lcurl -lpthread -lm -o /tmp/el_native_text /tmp/el_native_text - name: Run tests - native (string) run: | set -euo pipefail ELC="$(pwd)/dist/platform/elc" RUNTIME="$(pwd)/el-compiler/runtime" "$ELC" --test tests/native/test_string.el > /tmp/el_native_string.c gcc -O2 -I "$RUNTIME" /tmp/el_native_string.c "$RUNTIME/el_runtime.c" \ -lcurl -lpthread -lm -o /tmp/el_native_string /tmp/el_native_string - name: Run tests - native (math) run: | set -euo pipefail ELC="$(pwd)/dist/platform/elc" RUNTIME="$(pwd)/el-compiler/runtime" "$ELC" --test tests/native/test_math.el > /tmp/el_native_math.c gcc -O2 -I "$RUNTIME" /tmp/el_native_math.c "$RUNTIME/el_runtime.c" \ -lcurl -lpthread -lm -o /tmp/el_native_math /tmp/el_native_math - name: Run tests - native (state) run: | set -euo pipefail ELC="$(pwd)/dist/platform/elc" RUNTIME="$(pwd)/el-compiler/runtime" "$ELC" --test tests/native/test_state.el > /tmp/el_native_state.c gcc -O2 -I "$RUNTIME" /tmp/el_native_state.c "$RUNTIME/el_runtime.c" \ -lcurl -lpthread -lm -o /tmp/el_native_state /tmp/el_native_state - name: Run tests - native (time) run: | set -euo pipefail ELC="$(pwd)/dist/platform/elc" RUNTIME="$(pwd)/el-compiler/runtime" "$ELC" --test tests/native/test_time.el > /tmp/el_native_time.c gcc -O2 -I "$RUNTIME" /tmp/el_native_time.c "$RUNTIME/el_runtime.c" \ -lcurl -lpthread -lm -o /tmp/el_native_time /tmp/el_native_time - name: Run tests - native (json) run: | set -euo pipefail ELC="$(pwd)/dist/platform/elc" RUNTIME="$(pwd)/el-compiler/runtime" "$ELC" --test tests/native/test_json.el > /tmp/el_native_json.c gcc -O2 -I "$RUNTIME" /tmp/el_native_json.c "$RUNTIME/el_runtime.c" \ -lcurl -lpthread -lm -o /tmp/el_native_json /tmp/el_native_json - name: Run tests - native (env) run: | set -euo pipefail ELC="$(pwd)/dist/platform/elc" RUNTIME="$(pwd)/el-compiler/runtime" "$ELC" --test tests/native/test_env.el > /tmp/el_native_env.c gcc -O2 -I "$RUNTIME" /tmp/el_native_env.c "$RUNTIME/el_runtime.c" \ -lcurl -lpthread -lm -o /tmp/el_native_env /tmp/el_native_env - name: Run tests - native (fs) run: | set -euo pipefail ELC="$(pwd)/dist/platform/elc" RUNTIME="$(pwd)/el-compiler/runtime" "$ELC" --test tests/native/test_fs.el > /tmp/el_native_fs.c gcc -O2 -I "$RUNTIME" /tmp/el_native_fs.c "$RUNTIME/el_runtime.c" \ -lcurl -lpthread -lm -o /tmp/el_native_fs /tmp/el_native_fs # Publish only after merge (push event), not on PR validation runs - name: Publish El SDK to Artifact Registry (dev) if: github.event_name == 'push' 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-dev \ --location=us-central1 \ --project=neuron-785695 \ --package=el/elc \ --version="${VERSION}" \ --source=dist/platform/elc gcloud artifacts generic upload \ --repository=foundation-dev \ --location=us-central1 \ --project=neuron-785695 \ --package=el/el_runtime.c \ --version="${VERSION}" \ --source=el-compiler/runtime/el_runtime.c gcloud artifacts generic upload \ --repository=foundation-dev \ --location=us-central1 \ --project=neuron-785695 \ --package=el/el_runtime.h \ --version="${VERSION}" \ --source=el-compiler/runtime/el_runtime.h echo "Published El SDK version=${VERSION} to foundation-dev" rm -f /tmp/gcp-key.json