name: integration-node-latest
permissions:
  contents: read

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

env:
  REFLEX_TELEMETRY_ENABLED: false

jobs:
  check_latest_node:
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        split_index: [1, 2]
        node-version: ["node"]
      fail-fast: false

    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          fetch-tags: true
          fetch-depth: 0
          persist-credentials: false
      - uses: ./.github/actions/setup_build_env
        with:
          python-version: "3.13"
          run-uv-sync: true

      - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: ${{ matrix.node-version }}
      - run: uv run playwright install --with-deps
      - run: |
          uv run pytest tests/test_node_version.py -v
          uv run pytest tests/integration --splits 2 -v --group ${{matrix.split_index}}
