{#- OZI
# ozi/templates/.github/workflows/checkpoint.yml.j2
# SPDX-License-Identifier: MIT-0
-#}
{%- set endpoints %}
        allowed-endpoints: >
        {%- for endpoint in spec.python.ci.github.harden_runner.endpoints.checkpoint.split(' ') %}
            {{ endpoint }}
        {%- endfor %}
{% endset %}
{%- set python_version=spec.python.support.security2 %}
  checkpoint-{{ python_version|wheel_repr|replace('py', 'cp') }}-ubuntu-latest:
    name: checkpoint (Python {{ python_version }} on ubuntu-latest)
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
    permissions:
        id-token: write
    steps:
{%- if project.github_harden_runner %}
{% include ".github/workflows/harden_runner.yml.j2" %}
{{- endpoints }}
{%- endif %}
      - uses: OZI-Project/checkpoint@{{ spec.python.ci.github.checkpoint.version }}
        with:
          python-version: "{{ python_version }}"

{%- set python_version=spec.python.support.security1 %}
  checkpoint-{{ python_version|wheel_repr|replace('py', 'cp') }}-ubuntu-latest:
    name: checkpoint (Python {{ python_version }} on ubuntu-latest)
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
    permissions:
        id-token: write
    steps:
{%- if project.github_harden_runner %}
{% include ".github/workflows/harden_runner.yml.j2" %}
{{- endpoints }}
{%- endif %}
      - uses: OZI-Project/checkpoint@{{ spec.python.ci.github.checkpoint.version }}
        with:
          python-version: "{{ python_version }}"

{%- set python_version=spec.python.support.bugfix %}
  checkpoint-{{ python_version|wheel_repr|replace('py', 'cp') }}-ubuntu-latest:
    name: checkpoint (Python {{ python_version }} on ubuntu-latest)
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
    permissions:
        id-token: write
    steps:
{%- if project.github_harden_runner %}
{% include ".github/workflows/harden_runner.yml.j2" %}
{{- endpoints }}
{%- endif %}
      - uses: OZI-Project/checkpoint@{{ spec.python.ci.github.checkpoint.version }}
        with:
          python-version: "{{ python_version }}"

  checkpoint:
    runs-on: ubuntu-latest
    needs: [{%- for python_version in [spec.python.support.security2, spec.python.support.security1, spec.python.support.bugfix] %}checkpoint-{{ python_version|wheel_repr|replace('py', 'cp') }}-ubuntu-latest, {%- endfor %}]
    steps:
{%- if project.github_harden_runner %}
{% include ".github/workflows/harden_runner.yml.j2" %}
{%- else %}
      - run: echo "checkpoint success" 
{%- endif %}