Skip to content

Commit 7d590bf

Browse files
authored
workflow: Update ansible-test CI action and fix detected issues (#60)
* fixes for sanity and sap_company unit * update remaining tests with new set_module_args * updated workflow matrix * exclude python 3.13 for 2.16 and 2.17 * add 2.14 and 2.15 with exclusions for 3.12 and 3.13 * remove python 2 support and unused packages from unit folder * split workflow into supported and eol, update gitignore * update readme to align with workflow matrix * downgrade requires_ansible to allow EOL sanity tests
1 parent 7c678da commit 7d590bf

31 files changed

+355
-780
lines changed

.github/workflows/ansible-test.yml

Lines changed: 114 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,144 @@
1+
---
2+
# Always check ansible-core support matrix before configuring units matrix.
3+
# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix
4+
15
name: CI
26
on:
3-
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests
47
push:
8+
branches:
9+
- main
10+
- dev
11+
512
pull_request:
13+
614
# Run CI once per day (at 06:00 UTC)
715
# This ensures that even if there haven't been commits that we are still testing against latest version of ansible-test for each ansible-base version
816
schedule:
917
- cron: '0 6 * * *'
10-
env:
11-
NAMESPACE: community
12-
COLLECTION_NAME: sap_libs
18+
19+
workflow_dispatch:
1320

1421
jobs:
15-
sanity:
16-
name: Sanity (Ⓐ${{ matrix.ansible }})
22+
sanity-supported:
23+
runs-on: ubuntu-latest
24+
name: Sanity (Supported Ⓐ${{ matrix.ansible }})
1725
strategy:
26+
fail-fast: false # Disabled so we can see all failed combinations.
27+
# Define a build matrix to test compatibility across multiple Ansible versions.
28+
# Each version listed below will spawn a separate job that runs in parallel.
1829
matrix:
1930
ansible:
20-
- stable-2.13
21-
- stable-2.14
22-
- stable-2.15
23-
- stable-2.16
24-
- stable-2.17
25-
- stable-2.18
26-
- stable-2.19
27-
- devel
28-
29-
runs-on: >-
30-
${{ contains(fromJson(
31-
'["stable-2.13", "stable-2.14"]'
32-
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
31+
# Supported versions (must pass)
32+
- 'stable-2.18' # Python 3.11 - 3.13
33+
- 'stable-2.19' # Python 3.11 - 3.13
34+
- 'devel' # Test against the upcoming development version.
3335
steps:
36+
- uses: actions/checkout@v5
3437

35-
- name: Check out code
36-
uses: actions/checkout@v4
38+
- name: ansible-test - sanity
39+
uses: ansible-community/ansible-test-gh-action@release/v1
40+
with:
41+
ansible-core-version: ${{ matrix.ansible }}
42+
testing-type: sanity
3743

38-
- name: Perform sanity testing with ansible-test
44+
45+
sanity-eol:
46+
runs-on: ubuntu-latest
47+
# This job only runs if the supported tests pass
48+
needs: sanity-supported
49+
name: Sanity (EOL Ⓐ${{ matrix.ansible }})
50+
continue-on-error: true # This entire job is allowed to fail
51+
strategy:
52+
fail-fast: false # Disabled so we can see all failed combinations.
53+
# Define a build matrix to test compatibility across multiple Ansible versions.
54+
# Each version listed below will spawn a separate job that runs in parallel.
55+
matrix:
56+
ansible:
57+
# EOL versions (allowed to fail)
58+
# NOTE: Ensure that meta/runtime.yml `requires_ansible` version is aligned with tested versions.
59+
- 'stable-2.14' # Python 3.9 - 3.11
60+
- 'stable-2.15' # Python 3.9 - 3.11
61+
- 'stable-2.16' # Python 3.10 - 3.12
62+
- 'stable-2.17' # Python 3.10 - 3.12
63+
steps:
64+
- uses: actions/checkout@v5
65+
66+
- name: ansible-test - sanity
3967
uses: ansible-community/ansible-test-gh-action@release/v1
4068
with:
4169
ansible-core-version: ${{ matrix.ansible }}
4270
testing-type: sanity
43-
44-
45-
units:
46-
runs-on: >-
47-
${{ contains(fromJson(
48-
'["stable-2.13", "stable-2.14"]'
49-
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
50-
name: Units (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
71+
72+
units-supported:
73+
runs-on: ubuntu-latest
74+
name: Units (Supported Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
5175
strategy:
52-
# As soon as the first unit test fails, cancel the others to free up the CI queue
53-
fail-fast: true
76+
fail-fast: false # Disabled so we can see all failed combinations.
77+
# Define a build matrix to test compatibility across multiple Ansible versions.
78+
# Each version listed below will spawn a separate job that runs in parallel.
5479
matrix:
5580
ansible:
56-
- stable-2.13
57-
- stable-2.14
58-
- stable-2.15
59-
- stable-2.16
60-
- stable-2.17
61-
- stable-2.18
62-
- stable-2.19
63-
- devel
81+
- 'stable-2.18' # Python 3.11 - 3.13
82+
- 'stable-2.19' # Python 3.11 - 3.13
83+
- 'devel' # Test against the upcoming development version.
84+
python:
85+
- '3.11'
86+
- '3.12'
87+
- '3.13'
6488

6589
steps:
66-
- name: Check out code
67-
uses: actions/checkout@v4
90+
- uses: actions/checkout@v5
6891

69-
- name: Perform unit testing with ansible-test
92+
- name: ansible-test - units
7093
uses: ansible-community/ansible-test-gh-action@release/v1
7194
with:
7295
ansible-core-version: ${{ matrix.ansible }}
96+
target-python-version: ${{ matrix.python }}
7397
testing-type: units
74-
# test-deps: >-
75-
# ansible.netcommon
76-
# ansible.utils
77-
78-
# Please consult the Readme for information on why we disabled integration tests temporarily.
79-
80-
# integration:
81-
# runs-on: ubuntu-latest
82-
# name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
83-
# strategy:
84-
# fail-fast: false
85-
# matrix:
86-
# ansible:
87-
# - stable-2.9 # Only if your collection supports Ansible 2.9
88-
# - stable-2.10
89-
# - stable-2.11
90-
# - stable-2.12
91-
# - stable-2.13
92-
# - devel
93-
# python:
94-
# - 2.6
95-
# - 2.7
96-
# - 3.5
97-
# - 3.6
98-
# - 3.7
99-
# - 3.8
100-
# - 3.9
101-
# exclude:
102-
# # Because ansible-test doesn't support python3.9 for Ansible 2.9
103-
# - ansible: stable-2.9
104-
# python: 3.9
105-
# - ansible: devel
106-
# python: 2.6
107-
108-
# steps:
109-
# - name: Check out code
110-
# uses: actions/checkout@v3
111-
112-
# - name: Perform integration testing with ansible-test
113-
# uses: ansible-community/ansible-test-gh-action@release/v1
114-
# with:
115-
# ansible-core-version: ${{ matrix.ansible }}
116-
# python-version: 3.8
117-
# pre-test-cmd: >-
118-
# mkdir -p tests/output/
119-
# touch tests/output/coverage
120-
# target-python-version: ${{ matrix.python }}
121-
# testing-type: integration
122-
# test-deps: >-
123-
# ansible.netcommon
124-
# ansible.utils
98+
99+
units-eol:
100+
runs-on: ubuntu-latest
101+
# This job only runs if the supported tests pass
102+
needs: units-supported
103+
name: Units (EOL Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
104+
continue-on-error: true # This entire job is allowed to fail
105+
strategy:
106+
fail-fast: false # Disabled so we can see all failed combinations.
107+
# Define a build matrix to test compatibility across multiple Ansible versions.
108+
# Each version listed below will spawn a separate job that runs in parallel.
109+
matrix:
110+
ansible:
111+
- 'stable-2.14' # Python 3.9 - 3.11
112+
- 'stable-2.15' # Python 3.9 - 3.11
113+
- 'stable-2.16' # Python 3.10 - 3.12
114+
- 'stable-2.17' # Python 3.10 - 3.12
115+
python:
116+
- '3.9'
117+
- '3.10'
118+
- '3.11'
119+
- '3.12'
120+
exclude:
121+
# Exclusions for incompatible Python versions.
122+
- ansible: 'stable-2.14'
123+
python: '3.12'
124+
125+
- ansible: 'stable-2.15'
126+
python: '3.12'
127+
128+
- ansible: 'stable-2.16'
129+
python: '3.9'
130+
131+
- ansible: 'stable-2.17'
132+
python: '3.9'
133+
134+
steps:
135+
- uses: actions/checkout@v5
136+
137+
- name: ansible-test - units
138+
uses: ansible-community/ansible-test-gh-action@release/v1
139+
with:
140+
ansible-core-version: ${{ matrix.ansible }}
141+
target-python-version: ${{ matrix.python }}
142+
testing-type: units
143+
144+
# Please consult the Readme for information on why we disabled integration tests temporarily.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,6 @@ dmypy.json
179179

180180
# Pyre type checker
181181
.pyre/
182+
183+
# Ignore ansible workspace
184+
.ansible

README.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,29 +62,26 @@ The process of decision making in this collection is based on discussing and fin
6262

6363
Every voice is important. If you have something on your mind, create an issue or dedicated discussion and let's discuss it!
6464

65-
## Tested with Ansible and the following Python versions
66-
67-
Tested Ansible versions:
68-
- 2.13
69-
- 2.14
70-
- 2.15
71-
- 2.16
72-
- devel
73-
74-
Tested Python versions:
75-
- 3.6
76-
- 3.7
77-
- 3.8
78-
- 3.9
79-
- 3.10
80-
- 3.11
81-
82-
Due to SAP licensing and hardware requirements, integration tests are momentarily not feasible.
65+
## Tested with the following Ansible and Python version combinations
66+
67+
Supported ansible-core versions:
68+
- `2.18` with Python `3.11 - 3.13`
69+
- `2.19` with Python `3.11 - 3.13`
70+
- `devel` with Python `3.11 - 3.13`
71+
72+
End-of-life ansible-core versions are only tested for backwards compatibility.
73+
- `2.14` with Python `3.9 - 3.11`
74+
- `2.15` with Python `3.9 - 3.11`
75+
- `2.16` with Python `3.10 - 3.12`
76+
- `2.17` with Python `3.10 - 3.12`
77+
78+
**Support for Python 2 has been dropped in release `1.5.0`.**
79+
80+
Due to SAP licensing and hardware requirements, integration tests are momentarily not feasible.
8381
The modules are tested manually against SAP systems until we found a solution or have some
8482
modules where we are able to execute integration test we decided to disable these tests.
8583

86-
The test support for Ansible versions 2.9 - 2.12 is disabled due to eol of these versions.
87-
The modules may work with these versions but are not tested.
84+
**NOTE:** All tests combinations were configured following official [ansible-core-support-matrix](https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix).
8885

8986
## External requirements
9087

changelogs/changelog.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,4 @@ releases:
123123
in this collection that have been made after the previous release.
124124
fragments:
125125
- 30-fix-lint-issues.yml
126-
release_date: '2024-23-01'
126+
release_date: '2024-01-23'

meta/runtime.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
requires_ansible: ">=2.9.10"
2+
requires_ansible: ">=2.14.0"
33

44
plugin_routing:
55
modules:

plugins/modules/sap_hdbsql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152

153153
import csv
154154
from ansible.module_utils.basic import AnsibleModule
155-
from ansible.module_utils.six import StringIO
155+
from io import StringIO
156156
from ansible.module_utils.common.text.converters import to_native
157157

158158

tests/sanity/ignore-2.17.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ plugins/modules/sap_snote.py validate-modules:missing-gplv3-license # Licensed u
66
plugins/modules/sap_system_facts.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
77
plugins/modules/sap_task_list_execute.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
88
plugins/modules/sap_user.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
9-
plugins/modules/sapcar_extract.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
10-
tests/unit/compat/mock.py pylint:use-yield-from # suggested construct does not work with Python 2
9+
plugins/modules/sapcar_extract.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0

tests/sanity/ignore-2.18.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ plugins/modules/sap_snote.py validate-modules:missing-gplv3-license # Licensed u
66
plugins/modules/sap_system_facts.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
77
plugins/modules/sap_task_list_execute.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
88
plugins/modules/sap_user.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
9-
plugins/modules/sapcar_extract.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
10-
tests/unit/compat/mock.py pylint:use-yield-from # suggested construct does not work with Python 2
9+
plugins/modules/sapcar_extract.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0

tests/sanity/ignore-2.19.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
plugins/modules/sap_pyrfc.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
2+
plugins/modules/sap_company.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
3+
plugins/modules/sap_control_exec.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
4+
plugins/modules/sap_hdbsql.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
5+
plugins/modules/sap_snote.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
6+
plugins/modules/sap_system_facts.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
7+
plugins/modules/sap_task_list_execute.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
8+
plugins/modules/sap_user.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
9+
plugins/modules/sapcar_extract.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0

tests/sanity/ignore-2.20.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
plugins/modules/sap_pyrfc.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
2+
plugins/modules/sap_company.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
3+
plugins/modules/sap_control_exec.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
4+
plugins/modules/sap_hdbsql.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
5+
plugins/modules/sap_snote.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
6+
plugins/modules/sap_system_facts.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
7+
plugins/modules/sap_task_list_execute.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
8+
plugins/modules/sap_user.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
9+
plugins/modules/sapcar_extract.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0

0 commit comments

Comments
 (0)