parameters:
  name: ''
  vmImage: ''

jobs:
- job: ${{ parameters.name }}
  pool:
    vmImage: ${{ parameters.vmImage }}
  strategy:
    matrix:
      py310_np124:
        PYTHON: '3.10'
        NUMPY: '1.24'
        CONDA_ENV: 'testenv'
        TEST_START_INDEX: 17
      py312_np20:
        PYTHON: '3.12'
        NUMPY: '2.0'
        CONDA_ENV: 'testenv'
        TEST_START_INDEX: 18
      py313_np23:
        PYTHON: '3.13'
        NUMPY: '2.3'
        CONDA_ENV: 'testenv'
        TEST_START_INDEX: 19
      py314_np24:
        PYTHON: '3.14'
        NUMPY: '2.4'
        CONDA_ENV: 'testenv'
        TEST_START_INDEX: 20

  steps:
    - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
      displayName: Add conda to PATH

    - script: |
        buildscripts\\incremental\\setup_conda_environment.cmd
      displayName: 'Before Install'

    - script: |
        buildscripts\\incremental\\build.cmd
      displayName: 'Build'

    - script: |
        call activate %CONDA_ENV%
        python -m numba -s
      displayName: 'Display numba system information'

    - script: |
        call activate %CONDA_ENV%
        python -m numba.misc.POST
      displayName: 'Power-On-Self-Test to make sure testing will likely work'

    - script: |
        call activate %CONDA_ENV%
        set NUMBA_ENABLE_CUDASIM=1
        set _NUMBA_REDUCED_TESTING=1

        python -m numba.runtests -l
      displayName: 'List discovered tests'

    - script: |
        call activate %CONDA_ENV%
        set NUMBA_ENABLE_CUDASIM=1
        set NUMBA_CPU_NAME=generic
        set _NUMBA_REDUCED_TESTING=1
        echo "Running shard of discovered tests: %TEST_START_INDEX%,None,%TEST_COUNT%"
        python -m numba.runtests -b -v -g -m 1 -- numba.tests
      displayName: 'Test modified test files'


    - script: |
        call activate %CONDA_ENV%
        set NUMBA_ENABLE_CUDASIM=1
        set NUMBA_CPU_NAME=generic
        set _NUMBA_REDUCED_TESTING=1

        echo "Running shard of discovered tests: %TEST_START_INDEX%:%TEST_COUNT%"
        python runtests.py -m 1 -b -j "%TEST_START_INDEX%:%TEST_COUNT%"  --exclude-tags='long_running'  -- numba.tests
      displayName: 'Test shard of test files'
