Skip to content

CI

CI #1560

Workflow file for this run

# Based upon https://github.com/ansible-collections/collection_template/blob/main/.github/workflows/ansible-test.yml
name: CI
on:
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests
push:
branches:
- main
- stable-*
pull_request:
# Run CI once per day (at 06:00 UTC)
# This ensures that even if there haven't been commits that we are still
# testing against latest version of ansible-test for each ansible-core
# version
schedule:
- cron: '0 6 * * *'
concurrency:
group: >-
${{ github.workflow }}-${{
github.event.pull_request.number || github.sha
}}
cancel-in-progress: true
jobs:
###
# Sanity tests (REQUIRED)
#
# https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html
sanity:
name: Sanity (Ⓐ${{ matrix.ansible }})
strategy:
matrix:
ansible:
- stable-2.13
- stable-2.14
- stable-2.15
- devel
# Ansible-test on various stable branches does not yet work well with cgroups v2.
# Since ubuntu-latest now uses Ubuntu 22.04, we need to fall back to the ubuntu-20.04
# image for these stable branches. The list of branches where this is necessary will
# shrink over time, check out https://github.com/ansible-collections/news-for-maintainers/issues/28
# for the latest list.
runs-on: >-
${{ contains(fromJson(
'["stable-2.9", "stable-2.10", "stable-2.11"]'
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
steps:
- name: Perform sanity testing
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: ${{ matrix.ansible }}
testing-type: sanity
test-deps: >-
ansible.netcommon
ansible.utils
pull-request-change-detection: false
coverage: never
###
# Unit tests (OPTIONAL)
#
# https://docs.ansible.com/ansible/latest/dev_guide/testing_units.html
units:
# Ansible-test on various stable branches does not yet work well with cgroups v2.
# Since ubuntu-latest now uses Ubuntu 22.04, we need to fall back to the ubuntu-20.04
# image for these stable branches. The list of branches where this is necessary will
# shrink over time, check out https://github.com/ansible-collections/news-for-maintainers/issues/28
# for the latest list.
runs-on: >-
${{ contains(fromJson(
'["stable-2.9", "stable-2.10", "stable-2.11"]'
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
name: Units (Ⓐ${{ matrix.ansible }})
strategy:
fail-fast: false
matrix:
ansible:
- stable-2.13
- stable-2.14
- stable-2.15
- devel
steps:
- name: >-
Perform unit testing against
Ansible version ${{ matrix.ansible }}
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: ${{ matrix.ansible }}
testing-type: units
test-deps: >-
ansible.netcommon
ansible.utils
pull-request-change-detection: false
coverage: never
###
# Integration tests (RECOMMENDED)
#
# https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html
# If the application you are testing is available as a docker container and you want to test
# multiple versions see the following for an example:
# https://github.com/ansible-collections/community.zabbix/tree/master/.github/workflows
integration:
# Ansible-test on various stable branches does not yet work well with cgroups v2.
# Since ubuntu-latest now uses Ubuntu 22.04, we need to fall back to the ubuntu-20.04
# image for these stable branches. The list of branches where this is necessary will
# shrink over time, check out https://github.com/ansible-collections/news-for-maintainers/issues/28
# for the latest list.
runs-on: >-
${{ contains(fromJson(
'["stable-2.9", "stable-2.10", "stable-2.11"]'
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
strategy:
fail-fast: false
matrix:
ansible:
- devel
python:
- '3.9'
- '3.10'
- '3.11'
include:
# Add new versions announced in
# https://github.com/ansible-collections/news-for-maintainers in a timely manner,
# consider dropping testing against EOL versions and versions you don't support.
- ansible: stable-2.13
python: '3.9'
- ansible: stable-2.13
python: '3.10'
- ansible: stable-2.14
python: '3.9'
- ansible: stable-2.14
python: '3.10'
- ansible: stable-2.14
python: '3.11'
- ansible: stable-2.15
python: '3.9'
- ansible: stable-2.15
python: '3.10'
- ansible: stable-2.15
python: '3.11'
steps:
- name: >-
Perform integration testing against
Ansible version ${{ matrix.ansible }}
under Python ${{ matrix.python }}
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: ${{ matrix.ansible }}
target-python-version: ${{ matrix.python }}
testing-type: integration
test-deps: >-
ansible.netcommon
ansible.utils
pull-request-change-detection: false
coverage: never
check: # This job does nothing and is only used for the branch protection
# or multi-stage CI jobs, like making sure that all tests pass before
# a publishing job is started.
if: always()
needs:
- sanity
- units
- integration
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}