mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-22 03:43:09 +00:00
feat(ci): avoid defining supported ansible versions by discovering them from collection
Signed-off-by: gardar <gardar@users.noreply.github.com>
This commit is contained in:
parent
d2ff013bb3
commit
fc426d4d8e
2 changed files with 28 additions and 9 deletions
35
.github/workflows/ansible-ci.yml
vendored
35
.github/workflows/ansible-ci.yml
vendored
|
@ -9,16 +9,31 @@ jobs:
|
||||||
ansible-lint:
|
ansible-lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out codebase
|
- uses: actions/checkout@v3
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Lint collection
|
- name: Lint collection
|
||||||
uses: ansible/ansible-lint-action@main
|
uses: ansible/ansible-lint-action@main
|
||||||
|
|
||||||
|
discover-ansible-versions:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
versions: ${{ steps.supported-ansible-versions.outputs.result }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Get Ansible versions that the collection supports
|
||||||
|
id: supported-ansible-versions
|
||||||
|
uses: mikefarah/yq@master
|
||||||
|
with:
|
||||||
|
cmd: yq -o json -I=0 '.requires_ansible | split(",") | .[] |= sub("(.*)", "stable-${1}")' meta/runtime.yml
|
||||||
|
|
||||||
ansible-test-sanity:
|
ansible-test-sanity:
|
||||||
uses: ./.github/workflows/ansible-test-sanity.yml
|
uses: ./.github/workflows/ansible-test-sanity.yml
|
||||||
needs: ansible-lint
|
needs:
|
||||||
|
- ansible-lint
|
||||||
|
- discover-ansible-versions
|
||||||
with:
|
with:
|
||||||
ansible-core-versions: '["stable-2.9","stable-2.10","stable-2.11","stable-2.12","stable-2.13","stable-2.14"]'
|
ansible-core-versions: ${{ needs.discover-ansible-versions.outputs.versions }}
|
||||||
|
|
||||||
discover-ansible-tests:
|
discover-ansible-tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -37,16 +52,20 @@ jobs:
|
||||||
|
|
||||||
ansible-test-molecule:
|
ansible-test-molecule:
|
||||||
uses: ./.github/workflows/ansible-test-integration.yml
|
uses: ./.github/workflows/ansible-test-integration.yml
|
||||||
needs: discover-ansible-tests
|
needs:
|
||||||
|
- discover-ansible-tests
|
||||||
|
- discover-ansible-versions
|
||||||
if: needs.discover-ansible-tests.outputs.molecule-tests != '[]'
|
if: needs.discover-ansible-tests.outputs.molecule-tests != '[]'
|
||||||
with:
|
with:
|
||||||
targets: ${{ needs.discover-ansible-tests.outputs.molecule-tests }}
|
targets: ${{ needs.discover-ansible-tests.outputs.molecule-tests }}
|
||||||
ansible-core-versions: '["stable-2.9","stable-2.10","stable-2.11","stable-2.12","stable-2.13","stable-2.14"]'
|
ansible-core-versions: ${{ needs.discover-ansible-versions.outputs.versions }}
|
||||||
|
|
||||||
ansible-test-integration:
|
ansible-test-integration:
|
||||||
uses: ./.github/workflows/ansible-test-integration.yml
|
uses: ./.github/workflows/ansible-test-integration.yml
|
||||||
needs: discover-ansible-tests
|
needs:
|
||||||
|
- discover-ansible-tests
|
||||||
|
- discover-ansible-versions
|
||||||
if: needs.discover-ansible-tests.outputs.integration-tests != '[]'
|
if: needs.discover-ansible-tests.outputs.integration-tests != '[]'
|
||||||
with:
|
with:
|
||||||
targets: ${{ needs.discover-ansible-tests.outputs.integration-tests }}
|
targets: ${{ needs.discover-ansible-tests.outputs.integration-tests }}
|
||||||
ansible-core-versions: '["stable-2.9","stable-2.10","stable-2.11","stable-2.12","stable-2.13","stable-2.14"]'
|
ansible-core-versions: ${{ needs.discover-ansible-versions.outputs.versions }}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
---
|
---
|
||||||
requires_ansible: '>=2.9.10'
|
requires_ansible: "2.9,2.10,2.11,2.12,2.13,2.14"
|
||||||
|
|
Loading…
Reference in a new issue