# Gitea Actions: линт, unit-тесты (Vitest/jsdom), production build.
# Нужны: включённые Actions в репозитории и зарегистрированный act_runner.
# Если шаги с `uses:` не резолвятся, в настройках Gitea укажите прокси GitHub Actions
# или замените на полные URL, например: https://github.com/actions/checkout@v4

name: CI

on:
  push:
    branches:
      - '**'
  pull_request:
    branches:
      - '**'
  workflow_dispatch:

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

jobs:
  checks:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '22'
          cache: npm

      - name: Install dependencies
        run: npm ci

      - name: Lint
        run: npm run lint

      - name: Unit tests
        run: npm run test -- --watch=false

      - name: Production build
        run: npm run build
