{#-
  Full test runs. Each chunk should never take more than 2 hours. We allow 3, and on windows we add 30 more minutes.
  Partial test runs(no chunk parallelization), 6 Hours
#}
<%- set full_testrun_timeout_value = 180 %>
<%- set partial_testrun_timeout_value = 360 %>
<%- set windows_full_testrun_timeout_value = full_testrun_timeout_value + 30 %>

  <%- for os in test_salt_listing["windows"] %>

  <{ os.slug.replace(".", "") }>:
    <%- do test_salt_needs.append(os.slug.replace(".", "")) %>
    name: <{ os.display_name }> Test
    <%- if workflow_slug != "ci" or os.slug in mandatory_os_slugs %>
    if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['test'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
    <%- else %>
    if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['test'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] && contains(fromJSON(needs.prepare-workflow.outputs.os-labels), '<{ os.slug }>') }}
    <%- endif %>
    needs:
      - prepare-workflow
      - build-ci-deps
    uses: ./.github/workflows/test-action-windows.yml
    with:
      distro-slug: <{ os.slug }>
      nox-session: ci-test-onedir
      platform: windows
      arch: amd64
      nox-version: <{ nox_version  }>
      gh-actions-python-version: "<{ gh_actions_workflows_python_version }>"
      testrun: ${{ needs.prepare-workflow.outputs.testrun }}
      salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
      cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}|<{ python_version }>
      skip-code-coverage: <{ skip_test_coverage_check }>
      workflow-slug: <{ workflow_slug }>
      timeout-minutes: ${{ fromJSON(needs.prepare-workflow.outputs.testrun)['type'] == 'full' && <{ windows_full_testrun_timeout_value }> || <{ partial_testrun_timeout_value }> }}

  <%- endfor %>


  <%- for os in test_salt_listing["macos"] %>

  <{ os.slug.replace(".", "") }>:
    <%- do test_salt_needs.append(os.slug.replace(".", "")) %>
    name: <{ os.display_name }> Test
    <%- if workflow_slug != "ci" or os.slug in mandatory_os_slugs %>
    if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['test'] && fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
    <%- else %>
    if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['test'] && fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] && contains(fromJSON(needs.prepare-workflow.outputs.os-labels), '<{ os.slug }>') }}
    <%- endif %>
    needs:
      - prepare-workflow
      - build-ci-deps
    uses: ./.github/workflows/test-action-macos.yml
    with:
      distro-slug: <{ os.slug }>
      runner: <{ os.runner }>
      nox-session: ci-test-onedir
      platform: macos
      arch: <{ os.arch }>
      nox-version: <{ nox_version  }>
      gh-actions-python-version: "<{ gh_actions_workflows_python_version }>"
      testrun: ${{ needs.prepare-workflow.outputs.testrun }}
      salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
      cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}|<{ python_version }>
      skip-code-coverage: <{ skip_test_coverage_check }>
      workflow-slug: <{ workflow_slug }>
      timeout-minutes: ${{ fromJSON(needs.prepare-workflow.outputs.testrun)['type'] == 'full' && <{ full_testrun_timeout_value }> || <{ partial_testrun_timeout_value }> }}

  <%- endfor %>

  <%- for os in test_salt_listing["linux"] %>

  <{ os.slug.replace(".", "") }>:
    <%- do test_salt_needs.append(os.slug.replace(".", "")) %>
    name: <{ os.display_name }> Test
    <%- if workflow_slug != "ci" or os.slug in mandatory_os_slugs %>
    if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['test'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
    <%- else %>
    if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['test'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] && contains(fromJSON(needs.prepare-workflow.outputs.os-labels), '<{ os.slug }>') }}
    <%- endif %>
    needs:
      - prepare-workflow
      - build-ci-deps
    uses: ./.github/workflows/test-action-linux.yml
    with:
      distro-slug: <{ os.slug }>
      nox-session: ci-test-onedir
      platform: linux
      arch: <{ os.arch }>
      nox-version: <{ nox_version  }>
      gh-actions-python-version: "<{ gh_actions_workflows_python_version }>"
      testrun: ${{ needs.prepare-workflow.outputs.testrun }}
      salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
      cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}|<{ python_version }>
      skip-code-coverage: <{ skip_test_coverage_check }>
      workflow-slug: <{ workflow_slug }>
      timeout-minutes: ${{ fromJSON(needs.prepare-workflow.outputs.testrun)['type'] == 'full' && <{ full_testrun_timeout_value }> || <{ partial_testrun_timeout_value }> }}
    <%- if os.fips %>
      fips: true
    <%- endif %>

  <%- endfor %>
