name: Node.js CI

on:
  push:
    branches: [main, next, patch]
  pull_request:
    branches: [main, next, patch]

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: ["lts/*"]

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup environment
        run: mv .env.example .env

      - name: Setup node
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}

      - name: Setup pnpm
        uses: pnpm/action-setup@v3
        with:
          version: 8
          run_install: true

      - name: Run tests
        run: pnpm test
