Skip to content

CI

CI #3985

Workflow file for this run

name: CI
on: [push, pull_request]
env:
COLORTERM: 'yes'
TERM: 'xterm-256color'
PYTEST_ADDOPTS: '-vv --color=yes'
concurrency:
group: ${{ github.ref_name }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
sanity:
name: Sanity (Ⓐ${{ matrix.ansible }})
strategy:
matrix:
ansible:
- stable-2.15
- stable-2.16
- stable-2.17
- stable-2.18
- devel
runs-on: ubuntu-latest
steps:
# Run sanity tests inside a Docker container.
# The docker container has all the pinned dependencies that are
# required and all Python versions Ansible supports.
- name: Perform sanity testing
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: ${{ matrix.ansible }}
testing-type: sanity
pull-request-change-detection: false
pre-test-cmd: rm -rf tests/fixtures tests/test_playbooks/fixtures
build:
runs-on: ubuntu-20.04
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
python:
- "3.11"
ansible:
- stable-2.14
- stable-2.15
- stable-2.16
- stable-2.17
- stable-2.18
- devel
include:
- python: "3.8"
ansible: "v2.10.4"
- python: "3.6"
ansible: "stable-2.11"
- python: "3.7"
ansible: "stable-2.11"
- python: "3.9"
ansible: "stable-2.11"
- python: "3.10"
ansible: "stable-2.12"
- python: "3.10"
ansible: "stable-2.13"
- python: "3.12"
ansible: "devel"
- python: "3.13"
ansible: "devel"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
if: matrix.container == null
- name: Install sudo
run: apt-get update && apt-get install -y sudo
if: matrix.container != null
- name: Install system dependencies
# libyaml-dev for PyYAML, rpm for rpm-py-installer, python3-rpm for rpm-shim
run: sudo apt-get install -y libyaml-dev rpm python3-rpm
- name: Fix up Python RPM binding filenames so that other Pythons find it
run: |
for file in /usr/lib/python3/dist-packages/rpm/_rpm*.cpython-*.so; do
sudo ln -s ${file} $(echo ${file} | sed 's/\.cpython[^.]*//');
done
if: matrix.container == null
- name: Install Ansible
run: pip install --upgrade https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz
- name: Ensure Jinja version is old enough for Ansible 2.10
run: pip install --upgrade 'Jinja2<3.1'
if: matrix.ansible == 'v2.10.4'
- name: Install dependencies
run: make test-setup
- name: prepare a redhat-uep.pem, even if we run on Ubuntu
run: sudo mkdir -p /etc/rhsm/ca/ && sudo curl -o /etc/rhsm/ca/redhat-uep.pem https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem
- name: Install required collections
run: ansible-galaxy collection install https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-docker-3.12.0.tar.gz
if: matrix.ansible != 'v2.10.4'
- name: Install required collections for ansible 2.10
run: ansible-galaxy collection install https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-docker-2.7.12.tar.gz
if: matrix.ansible == 'v2.10.4'
- name: Run crud tests
run: make test-crud
- name: Run other tests
run: make test-other
- name: Run dist tests
run: make dist-test
checkmode:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install system dependencies
# libyaml-dev for PyYAML, rpm for rpm-py-installer, python3-rpm for rpm-shim
run: sudo apt-get install -y libyaml-dev rpm python3-rpm
- name: Fix up Python RPM binding filenames so that other Pythons find it
run: |
for file in /usr/lib/python3/dist-packages/rpm/_rpm*.cpython-*.so; do
sudo ln -s ${file} $(echo ${file} | sed 's/\.cpython[^.]*//');
done
- name: Install Ansible
run: pip install --upgrade ansible-core
- name: Install dependencies
run: make test-setup
- name: prepare a redhat-uep.pem, even if we run on Ubuntu
run: sudo mkdir -p /etc/rhsm/ca/ && sudo curl -o /etc/rhsm/ca/redhat-uep.pem https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem
- name: Run check_mode tests
run: make test-check-mode
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies
run: make doc-setup
- name: Generate changelog
run: antsibull-changelog release
- name: Build docs
run: make doc
- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: docs-html
path: docs/_build/html/
galaxy-importer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies
run: pip install --upgrade py galaxy-importer
- name: Run galaxy-importer
run: make galaxy-importer
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies
run: |
pip install --upgrade ansible-core
pip install --upgrade -r requirements-lint.txt
- name: Run lint
run: make lint
- name: Upload collection artifact
uses: actions/upload-artifact@v4
with:
name: collection
path: theforeman-foreman-*.tar.gz
execution_environment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies
run: pip install --upgrade ansible-core ansible-builder ansible-navigator
- name: Build EE
run: ansible-builder build -v 3 -t test-ee:latest -f meta/execution-environment.yml
- name: Test EE
run: |
ansible-navigator --execution-environment-image test-ee:latest --pull-policy never --mode stdout doc theforeman.foreman.host