name: Test
on:
  push:
    branches:
      - main
  pull_request:
permissions:
  contents: read
jobs:
  full:
    name: Node.js Latest Full
    runs-on: ubuntu-latest
    steps:
      - name: Checkout the repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - name: Install Node.js & pnpm
        uses: pnpm/setup@5d160c5bc68a09337ad0d5654e237e03253b5879 # v1.0.0
        with:
          version: 11
          runtime: node@26
      - name: Install dependencies
        run: pnpm ci
      - name: Run tests
        run: pnpm test
  short:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node:
          - 24
          - 22
    name: Node.js ${{ matrix.node }} Quick
    steps:
      - name: Checkout the repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - name: Install Node.js & pnpm
        uses: pnpm/setup@5d160c5bc68a09337ad0d5654e237e03253b5879 # v1.0.0
        with:
          version: 11
          runtime: node@${{ matrix.node }}
      - name: Install dependencies
        run: pnpm ci
      - name: Install dependencies
        run: pnpm ci --ignore-scripts
      - name: Run unit tests
        run: pnpm run unit
  old:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node:
          - 20
          - 18
          - 16
          - 14
          - 12
          - 10
    name: Node.js ${{ matrix.node }} Quick
    steps:
      - name: Checkout the repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - name: Install pnpm
        uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
        with:
          version: 3
        env:
          ACTIONS_ALLOW_UNSECURE_COMMANDS: true
      - name: Install Node.js ${{ matrix.node }}
        uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
        with:
          node-version: ${{ matrix.node }}
      - name: Install dependencies
        run: pnpm install --ignore-scripts
      - name: Downgrade TypeScript
        run: pnpm install typescript@4 --ignore-scripts
      - name: Run unit tests
        run: pnpm run old
  windows:
    runs-on: windows-latest
    name: Windows Quick
    steps:
      - name: Checkout the repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - name: Install pnpm
        uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
        with:
          version: 11
      - name: Install Node.js LTS
        uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
        with:
          node-version: 26
          cache: pnpm
      - name: Install dependencies
        run: pnpm install --ignore-scripts
      - name: Run unit tests
        run: pnpm run unit
