Skip to content

Commit 6ad0914

Browse files
authored
Support pre-install for unit, sanity and integration tests (#102)
* Support pre-install for unit, sanity and integration tests * Allow the use of pre-release collections to satisfy test dependencies.
1 parent 93d78d7 commit 6ad0914

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

.github/actions/build_install_collection/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ runs:
7979
working-directory: ${{ inputs.source_path }}
8080

8181
- name: Install collection and dependencies
82-
run: ansible-galaxy collection install ./${{ steps.identify.outputs.tar_file || inputs.tar_file }} -p /home/runner/collections
82+
run: ansible-galaxy collection install ./${{ steps.identify.outputs.tar_file || inputs.tar_file }} --pre -p /home/runner/collections
8383
shell: bash
8484
working-directory: ${{ inputs.source_path }}
8585

.github/workflows/integration.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: Integration tests
22
on:
33
workflow_call:
44
inputs:
5+
collection_pre_install:
6+
required: false
7+
type: string
8+
default: ""
59
cml_lab:
610
default: tests/integration/labs/single.yaml
711
required: false
@@ -72,6 +76,10 @@ jobs:
7276
- name: Install ansible-core (${{ matrix.ansible-version }})
7377
run: python3 -m pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check
7478

79+
- name: Pre install collections dependencies first so the collection install does not
80+
run: ansible-galaxy collection install --pre ${{ inputs.collection_pre_install }} -p /home/runner/collections
81+
if: inputs.collection_pre_install != ''
82+
7583
- name: Read collection metadata from galaxy.yml
7684
id: identify
7785
uses: ansible-network/github_actions/.github/actions/identify_collection@main

.github/workflows/sanity.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: Sanity tests
22
on:
33
workflow_call:
44
inputs:
5+
collection_pre_install:
6+
required: false
7+
type: string
8+
default: ""
59
matrix_exclude:
610
# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix
711
# 2.9 supports Python 3.5-3.8
@@ -144,6 +148,10 @@ jobs:
144148
- name: Install ansible-core (${{ matrix.ansible-version }})
145149
run: python3 -m pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check
146150

151+
- name: Pre install collections dependencies first so the collection install does not
152+
run: ansible-galaxy collection install --pre ${{ inputs.collection_pre_install }} -p /home/runner/collections/
153+
if: inputs.collection_pre_install != ''
154+
147155
- name: Read collection metadata from galaxy.yml
148156
id: identify
149157
uses: ansible-network/github_actions/.github/actions/identify_collection@main

.github/workflows/unit_galaxy.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: Unit tests, dependencies from galaxy
22
on:
33
workflow_call:
44
inputs:
5+
collection_pre_install:
6+
required: false
7+
type: string
8+
default: ""
59
matrix_exclude:
610
# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix
711
# 2.9 supports Python 3.5-3.8
@@ -137,6 +141,10 @@ jobs:
137141
- name: Install ansible-core (${{ matrix.ansible-version }})
138142
run: python3 -m pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check
139143

144+
- name: Pre install collections dependencies first so the collection install does not
145+
run: ansible-galaxy collection install --pre ${{ inputs.collection_pre_install }} -p /home/runner/collections
146+
if: inputs.collection_pre_install != ''
147+
140148
- name: Read collection metadata from galaxy.yml
141149
id: identify
142150
uses: ansible-network/github_actions/.github/actions/identify_collection@main

.github/workflows/unit_source.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ on:
33
workflow_call:
44
inputs:
55
collection_pre_install:
6-
required: true
6+
required: false
77
type: string
8+
default: ""
89
matrix_exclude:
910
# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix
1011
# 2.12 supports Python 3.8-3.10
@@ -86,16 +87,16 @@ jobs:
8687
- name: Install ansible-core (${{ matrix.ansible-version }})
8788
run: python3 -m pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check
8889

90+
- name: Pre install collections dependencies first so the collection install does not
91+
run: ansible-galaxy collection install --pre ${{ inputs.collection_pre_install }} -p /home/runner/collections
92+
if: inputs.collection_pre_install != ''
93+
8994
- name: Read collection metadata from galaxy.yml
9095
id: identify
9196
uses: ansible-network/github_actions/.github/actions/identify_collection@main
9297
with:
9398
source_path: ${{ env.source_directory }}
9499

95-
- name: Pre install collections dependencies first so the collection install does not
96-
run: ansible-galaxy collection install --pre ${{ inputs.collection_pre_install }} -p /home/runner/collections
97-
if: inputs.collection_pre_install != ''
98-
99100
- name: Build and install the collection
100101
uses: ansible-network/github_actions/.github/actions/build_install_collection@main
101102
with:

0 commit comments

Comments
 (0)