Skip to content

Commit 69f68e0

Browse files
authored
Merge pull request #86 from abikouo/ansible_test_integration_b
Ansible test integration
2 parents d467986 + 2be4d6e commit 69f68e0

File tree

1 file changed

+36
-1
lines changed
  • .github/actions/ansible_test_integration

1 file changed

+36
-1
lines changed

.github/actions/ansible_test_integration/action.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ inputs:
1616
ansible_test_environment:
1717
description: list of environment variables to set when running ansible-test
1818
required: false
19+
ansible_test_requirement_files:
20+
description: Requirements files containing python dependencies to run integration.
21+
default: "requirements.txt test-requirements.txt"
22+
ansible_test_constraint_files:
23+
description: Collection python constraints files.
24+
default: ""
1925

2026
runs:
2127
using: composite
@@ -39,10 +45,39 @@ runs:
3945
python3 -m pip install selinux_please_lie_to_me
4046
shell: bash
4147

48+
- name: Create requirements files argument
49+
id: requirements
50+
run: |
51+
set -eux
52+
REQ_ARG=""
53+
for item in $(echo ${FILES_LIST} | tr ' ' '\n'); do
54+
REQ_ARG="-r ${item} ${REQ_ARG}"
55+
done
56+
echo "argument=${REQ_ARG}" >> $GITHUB_OUTPUT
57+
shell: bash
58+
env:
59+
FILES_LIST: ${{ inputs.ansible_test_requirement_files }}
60+
if: inputs.ansible_test_requirement_files != ''
61+
62+
- name: Create constraints files argument
63+
id: constraints
64+
run: |
65+
set -eux
66+
CONSTRAINTS_ARG=""
67+
for item in $(echo ${CONSTRAINTS_FILES} | tr ' ' '\n'); do
68+
CONSTRAINTS_ARG="-r ${item} ${CONSTRAINTS_ARG}"
69+
done
70+
echo "argument=${CONSTRAINTS_ARG}" >> $GITHUB_OUTPUT
71+
shell: bash
72+
env:
73+
CONSTRAINTS_FILES: ${{ inputs.ansible_test_constraint_files }}
74+
if: inputs.ansible_test_constraint_files != ''
75+
4276
- name: Install collection python requirements
43-
run: python3 -m pip install -r requirements.txt -r test-requirements.txt
77+
run: python3 -m pip install ${{ steps.requirements.outputs.argument }} ${{ steps.constraints.outputs.argument }}
4478
shell: bash
4579
working-directory: ${{ inputs.collection_path }}
80+
if: ${{ (steps.requirements.outputs.argument != '') || (steps.constraints.outputs.argument != '') }}
4681

4782
- name: Set environment variables
4883
run: echo "${{ inputs.ansible_test_environment }}" >> $GITHUB_ENV

0 commit comments

Comments
 (0)