name: CI

on:
  push:
    branches: [master]
  pull_request:

jobs:
  test:
    name: coc-test (${{ matrix.editor }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        editor: [nvim, vim]
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm

      - name: Install dependencies
        run: npm ci

      - name: Install editors
        run: |
          sudo apt-get update
          sudo apt-get install -y neovim vim

      - name: Typecheck
        run: npm run lint

      - name: Integration tests (${{ matrix.editor }})
        run: npm run test:integration:${{ matrix.editor }}
