# Forgejo Actions — runs on Forgejo runners; GHA-compatible syntax.
name: Server Typecheck & Test

# Integration tests against real Postgres are out of scope for CI
# (they require credentials); only unit tests run here.

on:
  push:
    branches: [main]
    paths:
      - 'src/server/**'
      - '.forgejo/workflows/server.yml'
  pull_request:
    branches: [main]
    paths:
      - 'src/server/**'
      - '.forgejo/workflows/server.yml'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  typecheck-test:
    name: bun typecheck + test
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: src/server
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Bun
        uses: oven-sh/setup-bun@v2
        with:
          bun-version: 1.3.x

      - name: Install dependencies
        run: bun install

      - name: Typecheck
        run: bun run typecheck

      - name: Test (unit only)
        run: bun test
