workon 0.24.5

Development workspace launcher with Zellij, Claude CLI, and branchdiff
Documentation
name: CI

on:
  push:
    branches: ["**"]
  pull_request:

env:
  CARGO_TERM_COLOR: always

jobs:
  ci:
    name: Check, Test, Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7

      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt

      - uses: Swatinem/rust-cache@v2

      - name: cargo fmt
        run: |
          cargo fmt --all --check
          cargo fmt --all --check --manifest-path fuzz/Cargo.toml

      - name: cargo check
        run: cargo check --locked

      - name: cargo test
        run: cargo test --locked

      - name: cargo clippy
        run: cargo clippy --locked -- -D warnings

      - uses: taiki-e/install-action@cargo-deny

      - name: cargo deny (advisories, bans, licenses, sources)
        run: cargo deny check

  # DB-backed provisioner tests. Their cycles self-skip when no server is
  # reachable (like the jj tests gate on jj_available), so they run for real
  # here and are no-ops in the main job. One job per ecosystem will grow here as
  # provisioners land (Ruby/Rails, Node, Python) — see
  # specs/workspace-provisioners.md.
  provisioners:
    name: Provisioner tests (Postgres)
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:16
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: postgres
        ports: ["5432:5432"]
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
      mysql:
        image: mysql:8
        env:
          MYSQL_ROOT_PASSWORD: root
        ports: ["3306:3306"]
        options: >-
          --health-cmd "mysqladmin ping -h 127.0.0.1 -uroot -proot"
          --health-interval 10s
          --health-timeout 5s
          --health-retries 10
    env:
      PGHOST: localhost
      PGUSER: postgres
      PGPASSWORD: postgres
      MYSQL_HOST: 127.0.0.1
      MYSQL_TCP_PORT: "3306"
      MYSQL_USER: root
      MYSQL_PWD: root
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - name: install db clients (createdb/dropdb, mysqladmin)
        run: sudo apt-get update && sudo apt-get install -y postgresql-client default-mysql-client
      # The fixtures' runtimes, from mise.toml: the setup actions below cannot read TOML.
      - name: runtime versions from mise.toml
        id: pin
        run: |
          for tool in ruby node php dotnet erlang elixir; do
            echo "$tool=$(sed -nE "s/^$tool = \"([^\"]+)\".*/\1/p" mise.toml)" >> "$GITHUB_OUTPUT"
          done
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ steps.pin.outputs.ruby }}
      - name: install the Rails fixture's gems (so the cycle test runs)
        working-directory: tests/fixtures/rails
        run: bundle install --jobs 4
      - uses: actions/setup-node@v7
        with:
          node-version: ${{ steps.pin.outputs.node }}
      - name: install the Prisma fixture's deps (so the cycle test runs)
        working-directory: tests/fixtures/prisma
        run: npm install --no-audit --no-fund
      - name: set up the Alembic fixture's venv (so the cycle test runs)
        working-directory: tests/fixtures/alembic
        run: python3 -m venv .venv && ./.venv/bin/pip install -q -r requirements.txt
      - name: set up the Django fixture's venv (so the cycle test runs)
        working-directory: tests/fixtures/django
        run: python3 -m venv .venv && ./.venv/bin/pip install -q -r requirements.txt
      - uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ steps.pin.outputs.php }}
      - name: set up the Laravel fixture (so the cycle test runs)
        working-directory: tests/fixtures/laravel
        run: composer install --no-interaction --quiet && cp .env.example .env && php artisan key:generate --force
      - uses: actions/setup-dotnet@v6
        with:
          dotnet-version: ${{ steps.pin.outputs.dotnet }}.x
      - name: restore the EF Core fixture (so the cycle test runs)
        working-directory: tests/fixtures/efcore
        run: dotnet restore && dotnet tool restore
      - uses: erlef/setup-beam@v1
        with:
          otp-version: ${{ steps.pin.outputs.erlang }}
          elixir-version: ${{ steps.pin.outputs.elixir }}
      - name: set up the Phoenix fixture's deps (so the cycle test runs)
        working-directory: tests/fixtures/phoenix
        run: mix local.hex --force && mix deps.get && mix compile
      - name: cargo test (DB-gated cycles run here)
        run: cargo test --locked