ludic/.forgejo/workflows/ci.yml
Orkuncakilkaya e175619543 refactor(cli)!: split the contributor tool out of the ludic CLI
`ludic help` ended with a section titled "contributing to the toolchain itself",
listing bootstrap, reseed, docs-gen and release tasks. None of that is available
to someone who installed the language — those tasks need the repository — so the
shipped tool was advertising work its user cannot do, in a namespace they have to
read past to find `new` and `run`.

The tasks move to a second program, dev.ludic -> bin/ludic-dev, built from a
checkout and excluded from every release artifact. `ludic` keeps the project and
package commands and nothing else; `ludic dev …` now explains where the tasks
went instead of failing as an unknown command.

What this shook out: the two programs share prelude/build/project/pkg, so the
helpers each had accreted in whichever file first needed them — cc(),
ensure_ludicc, the string functions, title_case, cmd_version — moved to where
both can see them. The argument-shift indirection added for the `dev` namespace
is gone with the namespace, so commands read argv directly again.

`ludic-dev test` asserts the split rather than trusting it: the staged install
must build a project, and `ludic dev build` there must fail while naming
ludic-dev. install.sh keeps building older tags, whose bootstrap goes through
main.ludic.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-05 23:15:12 +03:00

89 lines
4.2 KiB
YAML

name: ci
# Build the language toolchain from its IR seed and run the regression suites on
# every push to main and every pull request. Until this landed the only workflow
# was docs.yml, so nothing gated a change on `ludic-dev test` / `ludic-dev test-tools` or on the
# compiler even building from the seed. See also bootstrap.yml, which proves the
# C-free self-rebuild reproduces the seed byte-for-byte.
on:
push:
branches: [main]
pull_request:
workflow_dispatch: {}
jobs:
build-and-test:
# Same runner label the docs workflow uses — the self-hosted Forgejo runner
# advertises `docker`, not the GitHub-ism `ubuntu-latest`.
runs-on: docker
# Reuse the runner's own base image (Debian bookworm with git + node already
# present) and add just the one thing the toolchain needs: a modern clang
# (LLVM 16 — the IR uses opaque pointers, so clang 15+ is required). The docs
# generator and its guards are now Ludic, so the job carries no Python. A
# prebuilt image with clang baked in is the obvious future speed-up (see
# issue #33's packaging work).
container: node:20-bookworm
steps:
- name: Install clang-16
run: |
set -eu
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq
apt-get install -y -qq --no-install-recommends clang-16 git ca-certificates
clang-16 --version | head -1
- name: Check out the triggering commit
env:
# the repository that triggered the run, so a fork or a mirror tests itself
REPO_URL: ${{ github.server_url }}/${{ github.repository }}.git
run: |
set -eu
git config --global --add safe.directory '*'
git clone "$REPO_URL" .
git checkout "${GITHUB_SHA}" 2>/dev/null || git checkout "${GITHUB_REF_NAME:-main}"
git log --oneline -1
# The toolchain is macOS-first; on this Linux runner it links against a
# tiny C-free IR shim that supplies the Darwin standard-stream globals
# (__stdoutp/__stderrp) over glibc's stdout/stderr. Injected through
# LUDIC_CC so every clang invocation — the seed bootstrap, `ludic-dev build`,
# and each compiled test program — picks it up. Absolute path so it
# still resolves if a step changes directory.
echo "LUDIC_CC=clang-16 $(pwd)/tools/ci/linux_stdio_shim.ll" >> "$GITHUB_ENV"
echo "LUDIC_HOME=$(pwd)" >> "$GITHUB_ENV"
- name: Bootstrap the toolchain from the IR seed (clang only)
run: |
set -eu
# clang assembles + links the compiler's own checked-in IR seed (plus
# the Linux stdio shim), then that seed builds the whole toolchain into
# bin/ — ludicc, ludic, x, ludic-fmt, ludic-lsp. No C compiler, no
# pre-built binaries: the language builds itself from source + seed.
mkdir -p bin
clang-16 tools/ci/linux_stdio_shim.ll selfhost/ludicc.seed.ll -o bin/ludicc
bin/ludicc tools/ludic-cli/dev.ludic -o bin/ludic-dev
bin/ludic-dev build
- name: Regression suite (ludic-dev test)
run: bin/ludic-dev test
- name: Editor-toolchain suite (ludic-dev test-tools)
# Grammar/lexer/vocabulary sync, ludic-fmt idempotence (the project's
# formatting contract — hand alignment is deliberately preserved, so the
# gate is fmt(fmt(x)) == fmt(x), not fmt(x) == x), and the JSON/XML editor
# assets. Cross-file LSP behaviour and the golden renders are macOS-ABI
# bound and skip here — visibly — until the runtime's directory walk and
# windowing are portable.
run: bin/ludic-dev test-tools
- name: Docs cover the implementation
run: |
set -eu
# The whole docs toolchain is written in Ludic and runs through x —
# no Python anywhere. check-impl / check-vocabulary / check-docs guard
# the sources; docs-gen builds the site and docs-check is its coverage
# + integrity guard. (check-vocabulary also runs in `ludic-dev test-tools`.)
bin/ludic-dev check-impl
bin/ludic-dev check-vocabulary
bin/ludic-dev check-docs
bin/ludic-dev docs-gen --out build/pages
bin/ludic-dev docs-check build/pages