2023-01-11 19:55:24 +00:00
|
|
|
---
|
|
|
|
name: Ansible CI
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
env:
|
|
|
|
ANSIBLE_FORCE_COLOR: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
ansible-lint:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-01-13 01:36:41 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
2023-01-11 19:55:24 +00:00
|
|
|
- name: Lint collection
|
|
|
|
uses: ansible/ansible-lint-action@main
|
|
|
|
|
2023-01-13 01:36:41 +00:00
|
|
|
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
|
|
|
|
|
2023-01-11 19:55:24 +00:00
|
|
|
ansible-test-sanity:
|
|
|
|
uses: ./.github/workflows/ansible-test-sanity.yml
|
2023-01-13 01:36:41 +00:00
|
|
|
needs:
|
|
|
|
- ansible-lint
|
|
|
|
- discover-ansible-versions
|
2023-01-11 19:55:24 +00:00
|
|
|
with:
|
2023-01-13 01:36:41 +00:00
|
|
|
ansible-core-versions: ${{ needs.discover-ansible-versions.outputs.versions }}
|
2023-01-11 19:55:24 +00:00
|
|
|
|
|
|
|
discover-ansible-tests:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: ansible-lint
|
|
|
|
outputs:
|
|
|
|
molecule-tests: ${{ steps.set-tests.outputs.ansible-test-molecule }}
|
|
|
|
integration-tests: ${{ steps.set-tests.outputs.ansible-test-integration }}
|
|
|
|
steps:
|
|
|
|
- name: Check out codebase
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Discover tests
|
|
|
|
id: set-tests
|
|
|
|
run: |
|
|
|
|
echo ansible-test-molecule="[`for x in $(find tests/integration/targets -maxdepth 1 -mindepth 1 -type d -iname "molecule-*" -printf "%f\n"); do echo '{"test":\"'"${x}"'\","name":\"'"${x#*-}\"'"}'; done | tr '\n' ',' | sed '$s/,$//'`]" >> $GITHUB_OUTPUT
|
|
|
|
echo ansible-test-integration="[`for x in $(find tests/integration/targets -maxdepth 1 -mindepth 1 -type d -not -iname "molecule-*" -printf "%f\n"); do echo '{"test":\"'"${x}"'\","name":\"'"${x}\"'"}'; done | tr '\n' ',' | sed '$s/,$//'`]" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
ansible-test-molecule:
|
|
|
|
uses: ./.github/workflows/ansible-test-integration.yml
|
2023-01-13 01:36:41 +00:00
|
|
|
needs:
|
|
|
|
- discover-ansible-tests
|
|
|
|
- discover-ansible-versions
|
2023-01-11 19:55:24 +00:00
|
|
|
if: needs.discover-ansible-tests.outputs.molecule-tests != '[]'
|
|
|
|
with:
|
|
|
|
targets: ${{ needs.discover-ansible-tests.outputs.molecule-tests }}
|
2023-01-13 01:36:41 +00:00
|
|
|
ansible-core-versions: ${{ needs.discover-ansible-versions.outputs.versions }}
|
2023-01-11 19:55:24 +00:00
|
|
|
|
|
|
|
ansible-test-integration:
|
|
|
|
uses: ./.github/workflows/ansible-test-integration.yml
|
2023-01-13 01:36:41 +00:00
|
|
|
needs:
|
|
|
|
- discover-ansible-tests
|
|
|
|
- discover-ansible-versions
|
2023-01-11 19:55:24 +00:00
|
|
|
if: needs.discover-ansible-tests.outputs.integration-tests != '[]'
|
|
|
|
with:
|
|
|
|
targets: ${{ needs.discover-ansible-tests.outputs.integration-tests }}
|
2023-01-13 01:36:41 +00:00
|
|
|
ansible-core-versions: ${{ needs.discover-ansible-versions.outputs.versions }}
|