Skip to content

CI

CI #878

Workflow file for this run

# Copyright (c) 2020-2022 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-20.04
strategy:
fail-fast: false
matrix:
include:
- ansible_version: '2.9'
python_version: '2.7'
- ansible_version: '2.9'
python_version: '3.5'
- ansible_version: '2.9'
python_version: '3.6'
- ansible_version: '2.9'
python_version: '3.7'
- ansible_version: '2.9'
python_version: '3.8'
- ansible_version: '2.9.6'
python_version: '3.8'
- ansible_version: '2.10'
python_version: '3.6'
- ansible_version: '2.10'
python_version: '3.7'
- ansible_version: '2.10'
python_version: '3.8'
- ansible_version: '2.10'
python_version: '3.9'
- ansible_version: '2.11'
python_version: 3.6
- ansible_version: '2.11'
python_version: 3.7
- ansible_version: '2.11'
python_version: 3.8
- ansible_version: '2.11'
python_version: 3.9
- ansible_version: '2.12'
python_version: '3.8'
- ansible_version: '2.12'
python_version: '3.9'
- ansible_version: '2.12'
python_version: '3.10'
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: checkout collection mafalb.ansible
uses: actions/checkout@v2
with:
path: ansible_collections/mafalb/ansible
- name: setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
# necessary ?
- name: install virtualenv for python 2.7
if: matrix.python_version == '2.7'
run: |
pip install virtualenv
- 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"]}' -e mafalb_ansible_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
if ansible-lint --version|grep "^ansible-lint 4"
then
ANSIBLE_LINT_VERSION=4
fi
. tests/lint.sh requirements ${{ matrix.python_version }}
- name: sanity
run: |
source ~/.virtualenvs/ansible/bin/activate
ansible-test sanity --requirements --python ${{ matrix.python_version }}
- 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 }}
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-20.04
needs:
- ansible-test
strategy:
fail-fast: false
matrix:
os:
#- arch
- fedora33
- fedora34
- fedora35
- c8s
- c9s
- centos7
- rocky8
- alma8
- debian11
- ubuntu20
- ubuntu2104
- ubuntu2110
ansible_version:
- '2.12'
- '2.11'
- '2.10'
- '2.9'
exclude:
#- os: arch
# ansible_version: '2.9'
#- os: arch
# ansible_version: '2.10'
#- os: arch
# ansible_version: '2.12'
- os: fedora33
ansible_version: '2.10'
- os: fedora33
ansible_version: '2.11'
- os: fedora33
ansible_version: '2.12'
- os: fedora34
ansible_version: '2.10'
- os: fedora34
ansible_version: '2.12'
- os: fedora35
ansible_version: '2.10'
- os: fedora35
ansible_version: '2.11'
- os: c8s
ansible_version: '2.9'
- os: c8s
ansible_version: '2.10'
- os: c8s
ansible_version: '2.11'
- os: c9s
ansible_version: '2.9'
- os: c9s
ansible_version: '2.10'
- os: c9s
ansible_version: '2.12'
- os: alma8
ansible_version: '2.10'
- os: alma8
ansible_version: '2.11'
- os: alma8
ansible_version: '2.12'
- os: rocky8
ansible_version: '2.10'
- os: rocky8
ansible_version: '2.11'
- os: rocky8
ansible_version: '2.12'
- os: centos7
ansible_version: '2.10'
- os: centos7
ansible_version: '2.11'
- os: centos7
ansible_version: '2.12'
- os: debian11
ansible_version: '2.9'
- os: debian11
ansible_version: '2.11'
- os: debian11
ansible_version: '2.12'
- os: ubuntu20
ansible_version: '2.10'
- os: ubuntu20
ansible_version: '2.11'
- os: ubuntu20
ansible_version: '2.12'
- os: ubuntu2104
ansible_version: '2.9'
- os: ubuntu2104
ansible_version: '2.11'
- os: ubuntu2104
ansible_version: '2.12'
- os: ubuntu2110
ansible_version: '2.9'
- os: ubuntu2110
ansible_version: '2.11'
- os: ubuntu2110
ansible_version: '2.12'
env:
ANSIBLE_VERSION: ${{ matrix.ansible_version }}
CI_IMAGE: ${{ matrix.image }}
CI_HOSTNAME: ci-${{ matrix.os }}
CI_DRIVER: docker
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
defaults:
run:
working-directory: ansible_collections/mafalb/ansible
steps:
- name: checkout collection ansible
uses: actions/checkout@v2
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: '../../..'
- name: install community.docker
if: matrix.ansible_version != '2.9'
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
- name: run install-ansible.sh
run: |
source ~/.virtualenvs/molecule/bin/activate
# this finds some errors when dependendencies differ from ansible-test's
docker exec -t ci-${{ matrix.os }} ansible-playbook /root/install-ansible.yml
virtualenv:
runs-on: ubuntu-20.04
needs: ansible-test
strategy:
fail-fast: false
matrix:
os:
# there are special dependencies for fedora35 that are probably not necessary anymore
#- arch
- fedora33
- fedora34
- fedora35
- c8s
- c9s
- centos7
- rocky8
- alma8
- debian9
- debian10
- debian11
- ubuntu18
- ubuntu20
- ubuntu2104
- ubuntu2110
ansible_version:
- '2.9'
- '2.10'
- '2.11'
- '2.12'
python_version:
- '2.7'
- '3.5'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
exclude:
# impossible ansible - python combinations
- ansible_version: '2.9'
python_version: '3.9'
- ansible_version: '2.9'
python_version: '3.10'
- ansible_version: '2.10'
python_version: '2.7'
- ansible_version: '2.10'
python_version: '3.5'
- ansible_version: '2.10'
python_version: '3.10'
- ansible_version: '2.11'
python_version: '2.7'
- ansible_version: '2.11'
python_version: '3.5'
- ansible_version: '2.11'
python_version: '3.10'
- ansible_version: '2.12'
python_version: '2.7'
- ansible_version: '2.12'
python_version: '3.5'
- ansible_version: '2.12'
python_version: '3.6'
- ansible_version: '2.12'
python_version: '3.7'
- os: fedora33
python_version: '3.10'
- os: fedora34
python_version: '3.5'
- os: fedora34
python_version: '3.10'
- os: fedora35
python_version: '3.5'
# c8s has 2.7, 3.6, 3.8, 3.9
- os: c8s
python_version: '3.5'
- os: c8s
python_version: '3.7'
- os: c8s
python_version: '3.10'
# c9s has only 3.9 at this point
- os: c9s
python_version: '2.7'
- os: c9s
python_version: '3.5'
- os: c9s
python_version: '3.6'
- os: c9s
python_version: '3.7'
- os: c9s
python_version: '3.8'
- os: c9s
python_version: '3.10'
# centos7 has 2.7, 3.6
- os: centos7
python_version: '3.5'
- os: centos7
python_version: '3.7'
- os: centos7
python_version: '3.8'
- os: centos7
python_version: '3.9'
- os: centos7
python_version: '3.10'
# alma8 has 2.7, 3.6, 3.8, 3.9
- os: alma8
python_version: '3.5'
- os: alma8
python_version: '3.7'
- os: alma8
python_version: '3.10'
# rocky8 has 2.7, 3.6, 3.8, 3.9
- os: rocky8
python_version: '3.5'
- os: rocky8
python_version: '3.7'
- os: rocky8
python_version: '3.10'
# 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'
# debian9 has 2.7 and 3.5
- os: debian9
python_version: '3.6'
- os: debian9
python_version: '3.7'
- os: debian9
python_version: '3.8'
- os: debian9
python_version: '3.9'
- os: debian9
python_version: '3.10'
# debian 10 has 2.7 and 3.7
- os: debian10
python_version: '3.5'
- os: debian10
python_version: '3.6'
- os: debian10
python_version: '3.8'
- os: debian10
python_version: '3.9'
- os: debian10
python_version: '3.10'
# debian 11 has 2.7 and 3.9
- os: debian11
python_version: '3.5'
- os: debian11
python_version: '3.6'
- os: debian11
python_version: '3.7'
- os: debian11
python_version: '3.8'
- os: debian11
python_version: '3.10'
# ubuntu18 has 2.7, 3.6, 3.7, 3.8
- os: ubuntu18
python_version: '3.5'
- os: ubuntu18
python_version: '3.9'
- os: ubuntu18
python_version: '3.10'
# ubuntu20 has 2.7, 3.8, 3.9
- os: ubuntu20
python_version: '3.5'
- os: ubuntu20
python_version: '3.6'
- os: ubuntu20
python_version: '3.7'
- os: ubuntu20
python_version: '3.10'
# ubuntu2104 has 2.7, 3.9, 3.10
- os: ubuntu2104
python_version: '3.5'
- os: ubuntu2104
python_version: '3.6'
- os: ubuntu2104
python_version: '3.7'
- os: ubuntu2104
python_version: '3.8'
- os: ubuntu2104
python_version: '3.10' # present, but not working properly
# ubuntu2110 has 2.7, 3.9, 3.10
- os: ubuntu2110
python_version: '3.5'
- os: ubuntu2110
python_version: '3.6'
- os: ubuntu2110
python_version: '3.7'
- os: ubuntu2110
python_version: '3.8'
env:
ANSIBLE_VERSION: ${{ matrix.ansible_version }}
PYTHON_VERSION: ${{ matrix.python_version }}
CI_IMAGE: ${{ matrix.image }}
CI_HOSTNAME: ci-${{ matrix.os }}
CI_DRIVER: docker
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
defaults:
run:
working-directory: ansible_collections/mafalb/ansible
steps:
- name: checkout collection ansible
uses: actions/checkout@v2
with:
path: ansible_collections/mafalb/ansible
- name: install molecule
run: |
ansible-playbook -D playbooks/install-molecule.yml -e molecule_ansible_version=${{ matrix.ansible_version }} -t all,debug
env:
ANSIBLE_COLLECTIONS_PATHS: ../../..
- name: install community.docker
if: matrix.ansible_version != '2.9'
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 scenario virtualenv
run: |
source ~/.virtualenvs/molecule/bin/activate
if test "${{ matrix.os }}" != 'debian9'\
-a "${{ matrix.os }}" != 'centos7'\
-a "${{ matrix.ansible_version }}" = '2.9'
then
export ANSIBLE_PYTHON_INTERPRETER=python3
fi
molecule -e .env-${{ matrix.os }}.yml test -s virtualenv
update:
runs-on: ubuntu-20.04
needs:
- ansible-test
#- virtualenv
strategy:
fail-fast: false
matrix:
os:
- c8s
- ubuntu20
ansible_version:
- '2.12'
include:
- os: c8s
python_version: '3.8'
- os: ubuntu20
python_version: '3.8'
env:
PYTHON_VERSION: ${{ matrix.python_version }}
CI_IMAGE: ${{ matrix.image }}
CI_HOSTNAME: ci-${{ matrix.os }}
CI_DRIVER: docker
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
defaults:
run:
working-directory: ansible_collections/mafalb/ansible
steps:
- name: checkout collection ansible
uses: actions/checkout@v2
with:
path: ansible_collections/mafalb/ansible
- name: install molecule with system ansible (old!)
run: |
sudo apt install ansible
/usr/bin/ansible-playbook -D playbooks/molecule.yml -e molecule_ansible_version=${{ matrix.ansible_version }} -t all,debug
env:
ANSIBLE_COLLECTIONS_PATHS: ../../..
- name: install community.docker
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: molecule scenario update
run: |
source ~/.virtualenvs/molecule/bin/activate
molecule -e .env-${{ matrix.os }}.yml test -s update
...