name: Tests (Forks)


on:
  pull_request_target:
    types: [labeled]

concurrency: 
  group: test-forks-${{ github.ref }}
  cancel-in-progress: true

jobs:
  test:
    if: ${{ contains(github.event.pull_request.labels.*.name, 'safe to test') && github.event.pull_request.head.repo.fork }}
    
    strategy:
      fail-fast: false
      matrix:
        test_group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

    runs-on: windows-latest
    
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.pull_request.head.sha }}

      - uses: prefix-dev/setup-pixi@v0.8.7
        id: pixi
        continue-on-error: true
        with:
          environments: test
          cache: false
          activate-environment: test

              
      - name: Run AMMR tests
        run: |
          cd Tests
          pytest -n 5 --dist worksteal `
            --splits 10 --group ${{ matrix.test_group }} --splitting-algorithm=least_duration `
            --durations=10 `
            --runslow
        env:
          RLM_LICENSE: ${{ secrets.LICENSE_SERVER }}
          RLM_LICENSE_PASSWORD: ${{ secrets.LICENSE_PASSWORD }}
