mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-03 23:01:48 +00:00
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
118 lines
3.9 KiB
YAML
118 lines
3.9 KiB
YAML
name: Reusable Module Test
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
module_name:
|
|
description: 'The name of the Podman module to test (e.g., podman_export)'
|
|
required: true
|
|
type: string
|
|
display_name:
|
|
description: 'Display name for the module (e.g., Podman export)'
|
|
required: false
|
|
type: string
|
|
default: ''
|
|
python_version:
|
|
description: 'Python version to use for testing'
|
|
required: false
|
|
type: string
|
|
default: '3.12'
|
|
os_matrix:
|
|
description: 'OS matrix as JSON string'
|
|
required: false
|
|
type: string
|
|
default: '["ubuntu-22.04"]'
|
|
ansible_versions:
|
|
description: 'Ansible versions matrix as JSON string'
|
|
required: false
|
|
type: string
|
|
default: '["git+https://github.com/ansible/ansible.git@stable-2.18", "git+https://github.com/ansible/ansible.git@devel"]'
|
|
extra_collections:
|
|
description: 'Space-separated list of extra Ansible collections to install before running tests (e.g., "ansible.posix community.general")'
|
|
required: false
|
|
type: string
|
|
default: ''
|
|
|
|
jobs:
|
|
test_module:
|
|
name: ${{ inputs.display_name || inputs.module_name }} ${{ matrix.ansible-version }}-${{ matrix.os || 'ubuntu-22.04' }}
|
|
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
ansible-version: ${{ fromJSON(inputs.ansible_versions) }}
|
|
os: ${{ fromJSON(inputs.os_matrix) }}
|
|
python-version:
|
|
- ${{ inputs.python_version }}
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Upgrade pip and display Python and PIP versions
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y python*-wheel python*-yaml
|
|
python -m pip install --upgrade pip
|
|
python -V
|
|
pip --version
|
|
|
|
- name: Set up pip cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ github.ref }}-units-VMs
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
${{ runner.os }}-
|
|
|
|
- name: Install Ansible ${{ matrix.ansible-version }}
|
|
run: python3 -m pip install --user --force-reinstall --upgrade '${{ matrix.ansible-version }}'
|
|
|
|
- name: Build and install the collection tarball
|
|
run: |
|
|
rm -rf /tmp/just_new_collection
|
|
~/.local/bin/ansible-galaxy collection build --output-path /tmp/just_new_collection --force
|
|
~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz
|
|
|
|
- name: Install extra Ansible collections (optional)
|
|
if: ${{ inputs.extra_collections != '' }}
|
|
run: |
|
|
echo "Installing extra collections: ${{ inputs.extra_collections }}"
|
|
~/.local/bin/ansible-galaxy collection install -vvv --force ${{ inputs.extra_collections }}
|
|
|
|
- name: Run collection tests for ${{ inputs.module_name }}
|
|
run: |
|
|
export PATH=~/.local/bin:$PATH
|
|
|
|
echo "Run ansible version"
|
|
command -v ansible
|
|
ansible --version
|
|
|
|
export ANSIBLE_CONFIG=$(pwd)/ci/ansible-dev.cfg
|
|
if [[ '${{ matrix.ansible-version }}' == 'ansible<2.10' ]]; then
|
|
export ANSIBLE_CONFIG=$(pwd)/ci/ansible-2.9.cfg
|
|
fi
|
|
|
|
echo $ANSIBLE_CONFIG
|
|
command -v ansible-playbook
|
|
pip --version
|
|
python --version
|
|
ansible-playbook --version
|
|
|
|
ansible-playbook -vv ci/playbooks/pre.yml \
|
|
-e host=localhost \
|
|
-i localhost, \
|
|
-e ansible_connection=local \
|
|
-e setup_python=false
|
|
|
|
TEST2RUN=${{ inputs.module_name }} ./ci/run_containers_tests.sh
|
|
shell: bash
|