Merge pull request #20 from mafalb/f-dev #980
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: set ft=yaml ts=2 expandtab: | |
# | |
# Copyright (c) Markus Falb <markus.falb@mafalb.at> | |
# GNU General Public License v3.0+ | |
# see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt | |
--- | |
name: CI | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- '*' | |
schedule: | |
- cron: '40 12 * * 6' | |
jobs: | |
ansible-test: | |
# don't run on pull request from ourselves | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- ansible_version: '2.14' | |
python_version: '3.9' | |
- ansible_version: '2.14' | |
python_version: '3.10' | |
- ansible_version: '2.14' | |
python_version: '3.11' | |
- ansible_version: '2.15' | |
python_version: '3.9' | |
- ansible_version: '2.15' | |
python_version: '3.10' | |
- ansible_version: '2.15' | |
python_version: '3.11' | |
- ansible_version: '2.16' | |
python_version: '3.10' | |
- ansible_version: '2.16' | |
python_version: '3.11' | |
- ansible_version: '2.16' | |
python_version: '3.12' | |
env: | |
PY_COLORS: 1 | |
ANSIBLE_FORCE_COLOR: 1 | |
# necessary ? | |
ANSIBLE_PYTHON_INTERPRETER: python${{ matrix.python_version }} | |
defaults: | |
run: | |
working-directory: ansible_collections/mafalb/ansible | |
steps: | |
- name: setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: checkout collection mafalb.ansible | |
uses: actions/checkout@v4 | |
with: | |
path: ansible_collections/mafalb/ansible | |
- name: install ansible | |
run: | | |
ansible-playbook -D playbooks/install-ansible.yml -e '{"virtualenv_packages":["_ansible==${{ matrix.ansible_version }}", "ansible-lint${{ matrix.ansible_lint_specifier }}", "_ansible_test", "flake8", "antsibull-docs", "rstcheck-core"]}' -e virtualenv_python=python${{ matrix.python_version }} -t all,debug | |
env: | |
ANSIBLE_COLLECTIONS_PATHS: ../../.. | |
- name: install shellcheck | |
run: sudo apt-get install shellcheck | |
- name: check ansible version | |
run: | | |
source ~/.virtualenvs/ansible/bin/activate | |
ansible --version | |
ansible --version | grep "^ansible.* ${{ matrix.ansible_version }}" | |
- name: check python version | |
run: | | |
source ~/.virtualenvs/ansible/bin/activate | |
ansible --version | grep "^\s*python.* ${{ matrix.python_version }}" | |
- name: lint | |
run: | | |
source ~/.virtualenvs/ansible/bin/activate | |
. tests/lint.sh requirements ${{ matrix.python_version }} | |
- name: docs | |
if: matrix.ansible_version != '2.12' | |
run: | | |
source ~/.virtualenvs/ansible/bin/activate | |
mkdir /tmp/collections | |
ansible-galaxy -vvvv collection list -p /tmp/collections | |
ansible-galaxy -vvvv collection install community.general -p /tmp/collections | |
bash tests/docs.sh requirements | |
- name: sanity | |
run: | | |
source ~/.virtualenvs/ansible/bin/activate | |
if test "${{ matrix.ansible_version }}" = "2.12" | |
then | |
# I dont know how to set collections path for ansible-doc | |
# so i skip ansible-doc test | |
# | |
ansible-test sanity --skip-test ansible-doc --requirements --python ${{ matrix.python_version }} | |
else | |
ansible-test sanity --requirements --python ${{ matrix.python_version }} | |
fi | |
- name: unit tests | |
run: | | |
source ~/.virtualenvs/ansible/bin/activate | |
ansible-test units --coverage --requirements --python ${{ matrix.python_version }} | |
- name: integration tests | |
run: | | |
source ~/.virtualenvs/ansible/bin/activate | |
ansible-test integration --requirements --python ${{ matrix.python_version }} | |
node: | |
# don't run on pull request from ourselves | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
runs-on: ubuntu-22.04 | |
needs: | |
- ansible-test | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: debian12 | |
- os: ubuntu22 | |
- os: ubuntu24 | |
- os: centos7 | |
- os: c9s | |
- os: fedora39 | |
- os: fedora40 | |
env: | |
CI_IMAGE: ${{ matrix.image }} | |
CI_HOSTNAME: ci-${{ matrix.os }} | |
CI_DRIVER: podman | |
PY_COLORS: 1 | |
ANSIBLE_FORCE_COLOR: 1 | |
defaults: | |
run: | |
working-directory: ansible_collections/mafalb/ansible | |
steps: | |
- name: checkout collection ansible | |
uses: actions/checkout@v4 | |
with: | |
path: ansible_collections/mafalb/ansible | |
- name: install molecule | |
run: ansible-playbook -D playbooks/install-molecule.yml -t all,debug | |
env: | |
ANSIBLE_COLLECTIONS_PATHS: '../../..' | |
- name: molecule node scenario | |
run: | | |
source ~/.virtualenvs/molecule/bin/activate | |
molecule -e .env-${{ matrix.os }}.yml test -s node | |
controlnode: | |
# don't run on pull request from ourselves | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
runs-on: ubuntu-22.04 | |
needs: | |
- ansible-test | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: debian12 | |
ansible_version: '2.14' | |
# The ansible provided by ubuntu 22 is a joke | |
# | |
#- os: ubuntu22 | |
# ansible_version: '2.12' | |
- os: ubuntu24 | |
ansible_version: '2.16' | |
- os: alma9 | |
ansible_version: '2.14' | |
- os: rocky9 | |
ansible_version: '2.14' | |
- os: fedora39 | |
ansible_version: '2.16' | |
- os: fedora40 | |
ansible_version: '2.16' | |
env: | |
ANSIBLE_VERSION: ${{ matrix.ansible_version }} | |
CI_IMAGE: ${{ matrix.image }} | |
CI_HOSTNAME: ci-${{ matrix.os }} | |
CI_DRIVER: podman | |
PY_COLORS: 1 | |
ANSIBLE_FORCE_COLOR: 1 | |
defaults: | |
run: | |
working-directory: ansible_collections/mafalb/ansible | |
steps: | |
- name: checkout collection ansible | |
uses: actions/checkout@v4 | |
with: | |
path: ansible_collections/mafalb/ansible | |
- name: install molecule | |
run: ansible-playbook -e ansible_python_interpreter=python3 -D playbooks/install-molecule.yml -t all,debug -e molecule_ansible_version=${{ matrix.ansible_version }} | |
env: | |
ANSIBLE_COLLECTIONS_PATHS: '../../..' | |
# why? | |
# | |
- name: install community.docker | |
if: false | |
run: | | |
source ~/.virtualenvs/molecule/bin/activate | |
ansible-galaxy collection install community.docker | |
# necessary for molecule and for mafalb.ansible | |
ansible-galaxy collection install community.general | |
- name: check ansible version | |
run: | | |
source ~/.virtualenvs/molecule/bin/activate | |
ansible --version | grep "^ansible.* ${{ matrix.ansible_version }}" | |
- name: molecule controlnode scenario | |
run: | | |
source ~/.virtualenvs/molecule/bin/activate | |
# dont destroy, next task needs it | |
molecule -e .env-${{ matrix.os }}.yml test -s controlnode --destroy never | |
# why does this exist? | |
- name: run install-ansible.sh | |
if: false | |
run: | | |
source ~/.virtualenvs/molecule/bin/activate | |
# this finds some errors when dependendencies differ from ansible-test's | |
podman exec -t ci-${{ matrix.os }} ansible-playbook /root/install-ansible.yml | |
virtualenv: | |
runs-on: ubuntu-22.04 | |
needs: ansible-test | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
#- arch | |
- debian12 | |
- ubuntu22 | |
- ubuntu24 | |
- fedora38 | |
- fedora39 | |
- fedora40 | |
- c9s | |
- rocky9 | |
- alma9 | |
ansible_version: | |
- '2.14' | |
- '2.15' | |
- '2.16' | |
python_version: | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
exclude: | |
- ansible_version: '2.14' | |
python_version: '3.12' | |
- ansible_version: '2.15' | |
python_version: '3.12' | |
- ansible_version: '2.16' | |
python_version: '3.9' | |
- os: fedora38 | |
python_version: '3.12' | |
# c9s has 3.9, 3.11 | |
- os: c9s | |
python_version: '3.10' | |
- os: c9s | |
python_version: '3.12' | |
- os: c9s | |
ansible_version: '2.16' | |
# alma9 has 3.9, 3.11 | |
- os: alma9 | |
python_version: '3.10' | |
- os: alma9 | |
python_version: '3.12' | |
- os: alma9 | |
ansible_version: '2.16' | |
# rocky9 has 3.9, 3.11 | |
- os: rocky9 | |
python_version: '3.10' | |
- os: rocky9 | |
python_version: '3.12' | |
- os: rocky9 | |
ansible_version: '2.16' | |
# arch has 2.7 and 3.9 | |
#- os: arch | |
# python_version: '3.5' | |
#- os: arch | |
# python_version: '3.6' | |
#- os: arch | |
# python_version: '3.7' | |
#- os: arch | |
# python_version: '3.8' | |
#- os: arch | |
# python_version: '3.10' | |
# debian12 has only 3.11 | |
- os: debian12 | |
python_version: '3.9' | |
- os: debian12 | |
python_version: '3.10' | |
- os: debian12 | |
python_version: '3.12' | |
# ubuntu22 has 3.10, 3.11 | |
- os: ubuntu22 | |
python_version: '3.9' | |
- os: ubuntu22 | |
python_version: '3.12' | |
# ubuntu24 has 3.11, 3.12 | |
- os: ubuntu24 | |
python_version: '3.9' | |
- os: ubuntu24 | |
python_version: '3.10' | |
- os: ubuntu24 | |
python_version: '3.11' | |
env: | |
ANSIBLE_VERSION: ${{ matrix.ansible_version }} | |
PYTHON_VERSION: ${{ matrix.python_version }} | |
CI_IMAGE: ${{ matrix.image }} | |
CI_HOSTNAME: ci-${{ matrix.os }} | |
CI_DRIVER: podman | |
PY_COLORS: 1 | |
ANSIBLE_FORCE_COLOR: 1 | |
defaults: | |
run: | |
working-directory: ansible_collections/mafalb/ansible | |
steps: | |
- name: setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: checkout collection ansible | |
uses: actions/checkout@v4 | |
with: | |
path: ansible_collections/mafalb/ansible | |
- name: install molecule | |
run: | | |
ansible-playbook -D playbooks/install-molecule.yml -e molecule_python_version=python${{ matrix.python_version }} -e molecule_ansible_version=${{ matrix.ansible_version }} -t all,debug | |
env: | |
ANSIBLE_COLLECTIONS_PATHS: ../../.. | |
- name: check ansible version | |
run: | | |
source ~/.virtualenvs/molecule/bin/activate | |
ansible --version | grep "^ansible.* ${{ matrix.ansible_version }}" | |
- name: check python version | |
run: | | |
source ~/.virtualenvs/molecule/bin/activate | |
ansible --version | grep "^\s*python.* ${{ matrix.python_version }}" | |
- name: molecule scenario virtualenv | |
run: | | |
source ~/.virtualenvs/molecule/bin/activate | |
molecule -e .env-${{ matrix.os }}.yml test -s virtualenv -- -e ansible_python_interpreter=/usr/bin/python3 | |
... |