1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-02-04 07:11:49 +00:00

Refactor CI 2

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
Sagi Shnaidman 2025-08-13 17:11:44 +03:00
parent f721eafda3
commit 54c2200ca6
2 changed files with 71 additions and 90 deletions

View file

@ -0,0 +1,54 @@
name: Setup Ansible and install built collection
description: "Set up Python, install a specific Ansible version, download and install the built collection artifact"
inputs:
python-version:
description: Python version to install
required: true
ansible-version:
description: Ansible version spec to install (pip spec)
required: true
artifact-name:
description: Name of the uploaded artifact containing the built collection tarball(s)
required: true
default: collection
artifact-path:
description: Path to download artifact into
required: true
default: .cache/collection-tarballs
runs:
using: composite
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Upgrade pip
shell: bash
run: |
python -m pip install --upgrade pip
- name: Install Ansible
shell: bash
run: |
python -m pip install --user '${{ inputs.ansible-version }}'
- name: Ensure ~/.local/bin on PATH
shell: bash
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Download collection artifact
uses: actions/download-artifact@v5
with:
name: ${{ inputs.artifact-name }}
path: ${{ inputs.artifact-path }}
- name: Install the collection tarball(s)
shell: bash
run: |
~/.local/bin/ansible-galaxy collection install ${{ inputs.artifact-path }}/*.tar.gz

View file

@ -4,6 +4,7 @@ on:
push:
paths:
- '.github/workflows/connections_tests.yml'
- '.github/actions/setup-ansible-collection/action.yml'
- 'ci/*.yml'
- 'ci/playbooks/connections/**'
- 'ci/run_connection_test.sh'
@ -15,6 +16,7 @@ on:
pull_request:
paths:
- '.github/workflows/connections_tests.yml'
- '.github/actions/setup-ansible-collection/action.yml'
- 'ci/*.yml'
- 'ci/playbooks/connections/**'
- 'ci/run_connection_test.sh'
@ -95,38 +97,13 @@ jobs:
- name: Check out repository
uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
- name: Setup Python/Ansible and install built collection
uses: ./.github/actions/setup-ansible-collection
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and display Python and PIP versions
run: |
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: python -m pip install --user '${{ matrix.ansible-version }}'
- name: Download migrated collection artifacts
uses: actions/download-artifact@v5
with:
name: collection
path: .cache/collection-tarballs
- name: Install the collection tarball
run: >-
~/.local/bin/ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
ansible-version: ${{ matrix.ansible-version }}
artifact-name: collection
artifact-path: .cache/collection-tarballs
- name: Run collection tests for connection
run: |
@ -189,38 +166,13 @@ jobs:
- name: Check out repository
uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
- name: Setup Python/Ansible and install built collection
uses: ./.github/actions/setup-ansible-collection
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and display Python and PIP versions
run: |
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: python -m pip install --user '${{ matrix.ansible-version }}'
- name: Download migrated collection artifacts
uses: actions/download-artifact@v5
with:
name: collection
path: .cache/collection-tarballs
- name: Install the collection tarball
run: >-
~/.local/bin/ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
ansible-version: ${{ matrix.ansible-version }}
artifact-name: collection
artifact-path: .cache/collection-tarballs
- name: Run collection tests for connection
run: |
@ -289,38 +241,13 @@ jobs:
- name: Check out repository
uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Setup Python/Ansible and install built collection
uses: ./.github/actions/setup-ansible-collection
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and display Python and PIP versions
run: |
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: python -m pip install --user '${{ matrix.ansible-version }}'
- name: Download migrated collection artifacts
uses: actions/download-artifact@v5
with:
name: collection
path: .cache/collection-tarballs
- name: Install the collection tarball
run: >-
~/.local/bin/ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
ansible-version: ${{ matrix.ansible-version }}
artifact-name: collection
artifact-path: .cache/collection-tarballs
- name: Run example Node build
working-directory: playbooks/examples