From da85b37764e7a38634cd39c2e476a6f90bf832b3 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Fri, 24 Feb 2023 14:41:59 +0100 Subject: [PATCH] [stable-4] Run tests with EOL ansible-core versions in GHA (#6071) * Run tests with EOL ansible-core versions in GHA (#6044) Run tests with EOL ansible-core versions in GHA. (cherry picked from commit b72b7d49363aba4fb3ec44fcbb6032de9e7084ad) * Re-schedule cron. * Use correct targets. * Restrict python-gitlab to < 3.13.0. * Fix Ubuntu 16.04 check. * Revert "Restrict python-gitlab to < 3.13.0." This reverts commit 3f3a519d79142525d6a163d7a9eda4a66c1890fe. * Add extra conditions from tests/utils/shippable/units.sh. * Avoid problematic broken quoting. --- .azure-pipelines/azure-pipelines.yml | 211 ------------------------- .github/workflows/ansible-test.yml | 220 +++++++++++++++++++++++++++ README.md | 1 + tests/unit/requirements-2.10.txt | 41 +++++ tests/unit/requirements-2.9.txt | 41 +++++ 5 files changed, 303 insertions(+), 211 deletions(-) create mode 100644 .github/workflows/ansible-test.yml create mode 100644 tests/unit/requirements-2.10.txt create mode 100644 tests/unit/requirements-2.9.txt diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index 58aedfd8f9..16ec16a86b 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -93,45 +93,6 @@ stages: - test: 2 - test: 3 - test: 4 - - stage: Sanity_2_11 - displayName: Sanity 2.11 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - nameFormat: Test {0} - testFormat: 2.11/sanity/{0} - targets: - - test: 1 - - test: 2 - - test: 3 - - test: 4 - - stage: Sanity_2_10 - displayName: Sanity 2.10 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - nameFormat: Test {0} - testFormat: 2.10/sanity/{0} - targets: - - test: 1 - - test: 2 - - test: 3 - - test: 4 - - stage: Sanity_2_9 - displayName: Sanity 2.9 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - nameFormat: Test {0} - testFormat: 2.9/sanity/{0} - targets: - - test: 1 - - test: 2 - - test: 3 - - test: 4 ### Units - stage: Units_2_14 displayName: Units 2.14 @@ -174,41 +135,6 @@ stages: - test: 2.6 - test: 3.5 - test: 3.8 - - stage: Units_2_11 - displayName: Units 2.11 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - nameFormat: Python {0} - testFormat: 2.11/units/{0}/1 - targets: - - test: 2.6 - - test: 2.7 - - test: 3.5 - - test: 3.9 - - stage: Units_2_10 - displayName: Units 2.10 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - nameFormat: Python {0} - testFormat: 2.10/units/{0}/1 - targets: - - test: 2.7 - - test: 3.6 - - stage: Units_2_9 - displayName: Units 2.9 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - nameFormat: Python {0} - testFormat: 2.9/units/{0}/1 - targets: - - test: 2.6 - - test: 3.5 ## Remote - stage: Remote_2_14 @@ -266,55 +192,6 @@ stages: groups: - 1 - 2 - - stage: Remote_2_11 - displayName: Remote 2.11 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.11/{0} - targets: - - name: RHEL 7.9 - test: rhel/7.9 - - name: RHEL 8.3 - test: rhel/8.3 - #- name: FreeBSD 12.2 - # test: freebsd/12.2 - groups: - - 1 - - 2 - - stage: Remote_2_10 - displayName: Remote 2.10 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.10/{0} - targets: - - name: OS X 10.11 - test: osx/10.11 - - name: macOS 10.15 - test: macos/10.15 - groups: - - 1 - - 2 - - stage: Remote_2_9 - displayName: Remote 2.9 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.9/{0} - targets: - - name: RHEL 8.2 - test: rhel/8.2 - - name: RHEL 7.8 - test: rhel/7.8 - #- name: FreeBSD 12.0 - # test: freebsd/12.0 - groups: - - 1 - - 2 ### Docker - stage: Docker_2_14 @@ -377,49 +254,6 @@ stages: - 1 - 2 - 3 - - stage: Docker_2_11 - displayName: Docker 2.11 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.11/linux/{0} - targets: - - name: Fedora 33 - test: fedora33 - - name: Alpine 3 - test: alpine3 - groups: - - 2 - - 3 - - stage: Docker_2_10 - displayName: Docker 2.10 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.10/linux/{0} - targets: - - name: Fedora 32 - test: fedora32 - - name: Ubuntu 16.04 - test: ubuntu1604 - groups: - - 2 - - 3 - - stage: Docker_2_9 - displayName: Docker 2.9 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.9/linux/{0} - targets: - - name: Fedora 31 - test: fedora31 - groups: - - 2 - - 3 ### Community Docker - stage: Docker_community_2_14 @@ -473,68 +307,23 @@ stages: testFormat: 2.12/cloud/{0}/1 targets: - test: 3.8 - - stage: Cloud_2_11 - displayName: Cloud 2.11 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - nameFormat: Python {0} - testFormat: 2.11/cloud/{0}/1 - targets: - - test: 3.6 - - stage: Cloud_2_10 - displayName: Cloud 2.10 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - nameFormat: Python {0} - testFormat: 2.10/cloud/{0}/1 - targets: - - test: 3.5 - - stage: Cloud_2_9 - displayName: Cloud 2.9 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - nameFormat: Python {0} - testFormat: 2.9/cloud/{0}/1 - targets: - - test: 2.7 - stage: Summary condition: succeededOrFailed() dependsOn: - Sanity_2_14 - - Sanity_2_9 - - Sanity_2_10 - - Sanity_2_11 - Sanity_2_12 - Sanity_2_13 - Units_2_14 - - Units_2_9 - - Units_2_10 - - Units_2_11 - Units_2_12 - Units_2_13 - Remote_2_14 - - Remote_2_9 - - Remote_2_10 - - Remote_2_11 - Remote_2_12 - Remote_2_13 - Docker_2_14 - - Docker_2_9 - - Docker_2_10 - - Docker_2_11 - Docker_2_12 - Docker_2_13 - Docker_community_2_14 - Cloud_2_14 - - Cloud_2_9 - - Cloud_2_10 - - Cloud_2_11 - Cloud_2_12 - Cloud_2_13 jobs: diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml new file mode 100644 index 0000000000..89b4202a19 --- /dev/null +++ b/.github/workflows/ansible-test.yml @@ -0,0 +1,220 @@ +--- +# Copyright (c) Ansible Project +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +# For the comprehensive list of the inputs supported by the ansible-community/ansible-test-gh-action GitHub Action, see +# https://github.com/marketplace/actions/ansible-test + +name: EOL CI +on: + # Run EOL CI against all pushes (direct commits, also merged PRs), Pull Requests + push: + branches: + - main + - stable-* + pull_request: + # Run EOL CI once per week (at 11:00 UTC) + schedule: + - cron: '0 11 * * 0' + +concurrency: + # Make sure there is at most one active run per PR, but do not cancel any non-PR runs + group: ${{ github.workflow }}-${{ (github.head_ref && github.event.number) || github.run_id }} + cancel-in-progress: true + +jobs: + sanity: + name: EOL Sanity (Ⓐ${{ matrix.ansible }}) + strategy: + matrix: + ansible: + - '2.11' + - '2.10' + - '2.9' + # 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( + '["2.9", "2.10", "2.11"]' + ), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }} + steps: + - name: Perform sanity testing + uses: felixfontein/ansible-test-gh-action@main + with: + ansible-core-github-repository-slug: felixfontein/ansible + ansible-core-version: stable-${{ matrix.ansible }} + coverage: ${{ github.event_name == 'schedule' && 'always' || 'never' }} + pull-request-change-detection: 'true' + testing-type: sanity + + 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( + '["2.9", "2.10", "2.11"]' + ), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }} + name: EOL Units (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}) + strategy: + # As soon as the first unit test fails, cancel the others to free up the CI queue + fail-fast: true + matrix: + ansible: + - '' + python: + - '' + exclude: + - ansible: '' + include: + - ansible: '2.11' + python: '2.6' + - ansible: '2.11' + python: '2.7' + - ansible: '2.11' + python: '3.5' + - ansible: '2.11' + python: '3.9' + - ansible: '2.10' + python: '2.7' + - ansible: '2.10' + python: '3.6' + - ansible: '2.9' + python: '2.6' + - ansible: '2.9' + python: '3.5' + + steps: + - name: >- + Perform unit testing against + Ansible version ${{ matrix.ansible }} + uses: felixfontein/ansible-test-gh-action@main + with: + ansible-core-github-repository-slug: felixfontein/ansible + ansible-core-version: stable-${{ matrix.ansible }} + coverage: ${{ github.event_name == 'schedule' && 'always' || 'never' }} + pre-test-cmd: >- + mkdir -p ../../ansible + ; + git clone --depth=1 --single-branch https://github.com/ansible-collections/community.internal_test_tools.git ../../community/internal_test_tools + ; + if [ ${{ matrix.ansible }} == "2.9" ]; then cp tests/unit/requirements-2.9.txt tests/unit/requirements.txt; fi + ; + if [ ${{ matrix.ansible }} == "2.10" ]; then cp tests/unit/requirements-2.10.txt tests/unit/requirements.txt; fi + pull-request-change-detection: 'true' + target-python-version: ${{ matrix.python }} + testing-type: units + + 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( + '["2.9", "2.10", "2.11"]' + ), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }} + name: EOL I (Ⓐ${{ matrix.ansible }}+${{ matrix.docker }}+py${{ matrix.python }}:${{ matrix.target }}) + strategy: + fail-fast: false + matrix: + ansible: + - '' + docker: + - '' + python: + - '' + target: + - '' + exclude: + - ansible: '' + include: + # 2.11 + - ansible: '2.11' + docker: fedora33 + python: '' + target: shippable/posix/group2/ + - ansible: '2.11' + docker: fedora33 + python: '' + target: shippable/posix/group3/ + - ansible: '2.11' + docker: alpine3 + python: '' + target: shippable/posix/group2/ + - ansible: '2.11' + docker: alpine3 + python: '' + target: shippable/posix/group3/ + - ansible: '2.11' + docker: default + python: '3.6' + target: shippable/cloud/group1/ + # 2.10 + - ansible: '2.10' + docker: fedora32 + python: '' + target: shippable/posix/group2/ + - ansible: '2.10' + docker: fedora32 + python: '' + target: shippable/posix/group3/ + - ansible: '2.10' + docker: ubuntu1604 + python: '' + target: shippable/posix/group2/ + - ansible: '2.10' + docker: ubuntu1604 + python: '' + target: shippable/posix/group3/ + - ansible: '2.10' + docker: default + python: '3.5' + target: shippable/cloud/group1/ + # 2.9 + - ansible: '2.9' + docker: fedora31 + python: '' + target: shippable/posix/group2/ + - ansible: '2.9' + docker: fedora31 + python: '' + target: shippable/posix/group3/ + - ansible: '2.9' + docker: default + python: '2.7' + target: shippable/cloud/group1/ + + steps: + - name: >- + Perform integration testing against + Ansible version ${{ matrix.ansible }} + under Python ${{ matrix.python }} + uses: felixfontein/ansible-test-gh-action@main + with: + ansible-core-github-repository-slug: felixfontein/ansible + ansible-core-version: stable-${{ matrix.ansible }} + coverage: ${{ github.event_name == 'schedule' && 'always' || 'never' }} + docker-image: ${{ matrix.docker }} + integration-continue-on-error: 'false' + integration-diff: 'false' + integration-retry-on-error: 'true' + pre-test-cmd: >- + mkdir -p ../../ansible + ; + git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.posix.git ../../ansible/posix + ; + git clone --depth=1 ${{ matrix.docker == 'ubuntu1604' && '--branch stable-1' || '' }} --single-branch https://github.com/ansible-collections/community.crypto.git ../../community/crypto + ; + git clone --depth=1 --single-branch https://github.com/ansible-collections/community.internal_test_tools.git ../../community/internal_test_tools + pull-request-change-detection: 'true' + target: ${{ matrix.target }} + target-python-version: ${{ matrix.python }} + testing-type: integration diff --git a/README.md b/README.md index 2b9577a411..f15be74247 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Community General Collection [![Build Status](https://dev.azure.com/ansible/community.general/_apis/build/status/CI?branchName=stable-4)](https://dev.azure.com/ansible/community.general/_build?definitionId=31) +[![EOL CI](https://github.com/ansible-collections/community.general/workflows/EOL%20CI/badge.svg?event=push)](https://github.com/ansible-collections/community.general/actions) [![Codecov](https://img.shields.io/codecov/c/github/ansible-collections/community.general)](https://codecov.io/gh/ansible-collections/community.general) This repository contains the `community.general` Ansible Collection. The collection is a part of the Ansible package and includes many modules and plugins supported by Ansible community which are not part of more specialized community collections. diff --git a/tests/unit/requirements-2.10.txt b/tests/unit/requirements-2.10.txt new file mode 100644 index 0000000000..ab428a46d8 --- /dev/null +++ b/tests/unit/requirements-2.10.txt @@ -0,0 +1,41 @@ +unittest2 ; python_version < '2.7' +importlib ; python_version < '2.7' + +# requirement for the memcached cache plugin +python-memcached + +# requirement for the redis cache plugin +redis < 4.1.0 + +# requirement for the linode module +linode-python # APIv3 +linode_api4 ; python_version > '2.6' # APIv4 + +# requirement for the gitlab and github modules +python-gitlab < 2.10.1 ; python_version >= '3.6' +PyGithub +httmock + +# requirement for maven_artifact module +lxml < 4.3.0 ; python_version < '2.7' # lxml 4.3.0 and later require python 2.7 or later +lxml ; python_version >= '2.7' +semantic_version + +# requirement for datadog_downtime module +datadog-api-client >= 1.0.0b3 ; python_version >= '3.6' + +# requirement for dnsimple module +dnsimple >= 2 ; python_version >= '3.6' +dataclasses ; python_version == '3.6' + +# requirement for the opentelemetry callback plugin +# WARNING: these libraries rely on Protobuf for Python, which regularly stops installing. +# That's why they are disabled for now. +# opentelemetry-api ; python_version >= '3.6' and python_version < '3.10' +# opentelemetry-exporter-otlp ; python_version >= '3.6' and python_version < '3.10' +# opentelemetry-sdk ; python_version >= '3.6' and python_version < '3.10' + +# requirement for the elastic callback plugin +elastic-apm < 6.13.0 ; python_version == '3.6' +elastic-apm ; python_version >= '3.7' +python-gitlab ; python_version < '3.6' diff --git a/tests/unit/requirements-2.9.txt b/tests/unit/requirements-2.9.txt new file mode 100644 index 0000000000..b435d01545 --- /dev/null +++ b/tests/unit/requirements-2.9.txt @@ -0,0 +1,41 @@ +unittest2 ; python_version < '2.7' +importlib ; python_version < '2.7' + +# requirement for the memcached cache plugin +python-memcached + +# requirement for the redis cache plugin +redis + +# requirement for the linode module +linode-python # APIv3 +linode_api4 ; python_version > '2.6' # APIv4 + +# requirement for the gitlab and github modules +python-gitlab +PyGithub +httmock + +# requirement for maven_artifact module +lxml < 4.3.0 ; python_version < '2.7' # lxml 4.3.0 and later require python 2.7 or later +lxml ; python_version >= '2.7' +semantic_version + +# requirement for datadog_downtime module +datadog-api-client >= 1.0.0b3 ; python_version >= '3.6' + +# requirement for dnsimple module +dnsimple >= 2 ; python_version >= '3.6' +dataclasses ; python_version == '3.6' + +# requirement for the opentelemetry callback plugin +# WARNING: these libraries rely on Protobuf for Python, which regularly stops installing. +# That's why they are disabled for now. +# opentelemetry-api ; python_version >= '3.6' and python_version < '3.10' +# opentelemetry-exporter-otlp ; python_version >= '3.6' and python_version < '3.10' +# opentelemetry-sdk ; python_version >= '3.6' and python_version < '3.10' + +# requirement for the elastic callback plugin +elastic-apm < 6.13.0 ; python_version == '3.6' +elastic-apm ; python_version >= '3.7' +pynacl >= 1.4.0, < 1.5.0; python_version >= '3.6'