name: integration

on:
  push:
    branches:
     - main
     - next
     - 'v*'
    paths-ignore:
      - 'docs/**'
      - '*.md'
  pull_request:
    paths-ignore:
      - 'docs/**'
      - '*.md'

permissions:
  contents: read

jobs:
  install-production:
    runs-on: ${{ matrix.os }}
    permissions:
      contents: read

    strategy:
      matrix:
        node-version: [24, 26]
        os: [ubuntu-latest]
        pnpm-version: [11]

    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          persist-credentials: false

      - name: Use Node.js
        uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
        with:
          node-version: ${{ matrix.node-version }}
          check-latest: true

      - name: Install Pnpm
        uses: pnpm/action-setup@26f6d4f2c533a43e6b5da0b4a5dd983f98f7b49a # v6.0.4
        with:
          version: ${{ matrix.pnpm-version }}

      - name: Install Production
        run: |
          pnpm install --ignore-scripts --prod

      - name: Run server
        run: |
          node integration/server.js &

      - name: Test
        if: ${{ success() }}
        run: |
          bash integration/test.sh