name: Run Tests

on:
  push:
    branches: ['main']
  pull_request:
    branches: ['main']

jobs:
  test:
    strategy:
      matrix:
        nvim-version: ['stable', 'nightly']
        os: [ubuntu-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    name: Run Tests
    steps:
      - uses: actions/checkout@v4

      - name: Install Neovim
        uses: rhysd/action-setup-vim@v1
        with:
          neovim: true
          version: ${{ matrix.nvim-version }}

      - name: Run tests
        run: nvim --clean --headless -u tests/minimal_init.lua -c "PlenaryBustedDirectory tests/ { minimal_init = 'tests/minimal_init.lua' }"
