rustclamp 1.0.0

A minimal synchronous entrypoint for Clamp applications.
name: CI

on:
  pull_request:
  push:
    branches: [main]

permissions:
  contents: read

jobs:
  test:
    runs-on: ubuntu-24.04
    # Real servers: Redis for rustclamp::redis's live test, Postgres for the db tests
    # (each test gets a schema of its own); the other tests use fakes.
    services:
      redis:
        image: redis:8-alpine
        ports: ["6379:6379"]
      postgres:
        image: postgres:17-alpine
        env:
          POSTGRES_PASSWORD: test
        ports: ["5432:5432"]
        options: >-
          --health-cmd "pg_isready -U postgres"
          --health-interval 5s
          --health-timeout 5s
          --health-retries 10
    env:
      RUSTCLAMP_TEST_REDIS_URL: redis://127.0.0.1:6379/1
      RUSTCLAMP_TEST_DATABASE_URL: postgres://postgres:test@127.0.0.1:5432/postgres?sslmode=disable
    steps:
      # tooling depends on ../../core and ../../kernel: check the repos out side by side.
      - uses: actions/checkout@v7
        with:
          path: rustclamp
      - uses: actions/checkout@v7
        with:
          repository: rustclamp/core
          path: core
      - uses: actions/checkout@v7
        with:
          repository: rustclamp/kernel
          path: kernel
      # rust-toolchain.toml pins 1.96.1 with clippy and rustfmt; rustup installs it on first use.
      # facade and tooling only; the examples job below runs the full coordinated checkout
      - name: Facade
        working-directory: rustclamp
        run: |
          cargo fmt --check
          # boundaries.py reads offline metadata for every target, wasm-only crates included
          cargo fetch
          cargo clippy --all-features --all-targets -- -D warnings
          cargo test --all-features
          RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
      - name: Tooling
        working-directory: rustclamp/tooling
        run: |
          cargo fmt --check
          cargo clippy --locked --all-targets -- -D warnings
          cargo test --locked
      # Every web starter kit must install from its lockfile and build: plain, Vue and React.
      - uses: actions/setup-node@v5
        with:
          node-version: 24
      - name: Web kits
        working-directory: rustclamp/tooling
        run: |
          cargo build --locked --bin clamp
          for kit in web vue react; do
            ./target/debug/clamp init "$RUNNER_TEMP/kit-$kit" --$kit
            (cd "$RUNNER_TEMP/kit-$kit" && npm ci --no-audit --no-fund && npm run build)
          done

  # The full coordinated checkout: every sibling side by side, then tools/check.py
  # (examples, isolated packages, external consumers). check.py runs offline, so fetch first.
  examples:
    runs-on: ubuntu-24.04
    env:
      RUSTCLAMP_TEST_MQTT_URL: mqtt://127.0.0.1:1883
    steps:
      # A real broker for rustclamp-worker's live MQTT test. A step, not a service:
      # Mosquitto 2 needs its bundled anonymous-listener config passed as the command.
      - name: Mosquitto
        run: docker run -d -p 1883:1883 eclipse-mosquitto:2 mosquitto -c /mosquitto-no-auth.conf
      - uses: actions/checkout@v7
        with:
          path: rustclamp
      - name: Siblings
        run: |
          for repo in core kernel runtime http postgres messaging worker scheduler; do
            git clone --depth 1 "https://github.com/rustclamp/$repo" "$repo"
          done
      - name: Fetch
        # Each repo's own lock first: the isolated package checks use them, and once
        # the coordination workspace exists, a member's fetch reads the root lock instead.
        run: |
          find . -name Cargo.lock -not -path '*/target/*' -print0 |
            xargs -0 -n1 dirname | xargs -I{} cargo fetch --manifest-path {}/Cargo.toml
          python3 rustclamp/tools/workspace.py --root .
          cargo generate-lockfile
          cargo fetch
      - name: tools/check.py
        run: python3 rustclamp/tools/check.py --root .