Test multiple versions of python.
This commit is contained in:
parent
66bab3efda
commit
592357a35b
|
|
@ -1,13 +1,16 @@
|
|||
---
|
||||
image: "{{ gitlab_container }}"
|
||||
|
||||
variables:
|
||||
PY_COLORS: 1
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
molecule:
|
||||
image: $python
|
||||
script:
|
||||
- apt-get update -qq
|
||||
- apt-get -y -qq install yamllint docker.io
|
||||
- pip install --no-cache-dir tox
|
||||
- if [ -f tox.ini ] ; then tox ; fi
|
||||
- if [ ! -f tox.ini ] ; then molecule test ; fi
|
||||
- if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME == "master"
|
||||
parallel:
|
||||
|
|
@ -17,6 +20,7 @@ molecule:
|
|||
{% for tag in distribution_version_mapping[platform.name][version] %}
|
||||
- image: "{{ platform_image_mapping[platform.name] }}"
|
||||
tag: "{{ tag }}"
|
||||
python: {{ matrix_overrides[platform_image_mapping[platform.name] | lower ]["python"] | default(default_python_version) }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
|
|
|||
|
|
@ -19,38 +19,50 @@ jobs:
|
|||
uses: actions/checkout@v4
|
||||
- name: ansible-lint
|
||||
uses: ansible-community/ansible-lint-action@main
|
||||
test:
|
||||
{% for python_version in default_python_version %}
|
||||
|
||||
{{ python_version | replace('.', '-') | replace(':', '-') }}:
|
||||
needs:
|
||||
- lint
|
||||
runs-on: ubuntu-20.04
|
||||
container:
|
||||
image: {{ python_version }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
{% for platform in meta.galaxy_info.platforms %}
|
||||
{% for version in platform.versions %}
|
||||
{% if matrix_overrides is defined %}
|
||||
{% if matrix_overrides[platform_image_mapping[platform.name]] is defined %}
|
||||
{% for override_python_version in matrix_overrides[platform_image_mapping[platform.name]]["python"] %}
|
||||
{% if override_python_version == python_version %}
|
||||
{% for tag in distribution_version_mapping[platform.name][version] %}
|
||||
- image: "{{ platform_image_mapping[platform.name] }}"
|
||||
tag: "{{ tag }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for tag in distribution_version_mapping[platform.name][version] %}
|
||||
- image: "{{ platform_image_mapping[platform.name] }}"
|
||||
tag: "{{ tag }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python 3.
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: molecule
|
||||
run: molecule converge
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get -y -qq install yamllint docker.io
|
||||
pip install --no-cache-dir tox
|
||||
if [ -f tox.ini ] ; then tox ; fi
|
||||
if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
|
||||
env:
|
||||
image: {% raw %}${{ matrix.config.image }}{% endraw %}
|
||||
|
||||
|
|
@ -60,3 +72,4 @@ jobs:
|
|||
{{ item.variable }}: {% raw %}${{ {%endraw %}{{ item.name }} {% raw %}}}{% endraw %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
---
|
||||
# Setting to generate files.
|
||||
|
||||
# A list of python version to test.
|
||||
default_python_version:
|
||||
- "python:3.8"
|
||||
- "python:3.9"
|
||||
- "python:3.10"
|
||||
|
||||
# A map that relates the `meta/main.yml` - `galaxy_info.platforms.name` to a name of a container.
|
||||
platform_image_mapping:
|
||||
Alpine: alpine
|
||||
|
|
|
|||
Loading…
Reference in New Issue