Skip to content

skip_changelog(ci): unify and auto discover integration/molecule tests #87

skip_changelog(ci): unify and auto discover integration/molecule tests

skip_changelog(ci): unify and auto discover integration/molecule tests #87

---
name: Full Integration Test
# yamllint disable-line rule:truthy
on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
pull_request:
push:
branches:
- "main"
env:
NAMESPACE: grafana
COLLECTION_NAME: grafana
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
ansible-test-sanity:
uses: ./.github/workflows/ansible-test-sanity.yml
with:
ansible-core-versions: '["stable-2.14","stable-2.15","stable-2.16"]'
discover-ansible-tests:
runs-on: ubuntu-latest
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-*" -not -iname "*_cloud_stack" -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
needs: discover-ansible-tests
if: needs.discover-ansible-tests.outputs.molecule-tests != '[]'
with:
targets: ${{ needs.discover-ansible-tests.outputs.molecule-tests }}
ansible-core-versions: '["stable-2.14","stable-2.15","stable-2.16"]'
ansible-test-integration:
uses: ./.github/workflows/ansible-test-integration.yml
needs: discover-ansible-tests
if: needs.discover-ansible-tests.outputs.integration-tests != '[]'
secrets: inherit
with:
targets: ${{ needs.discover-ansible-tests.outputs.integration-tests }}
ansible-core-versions: '["stable-2.14","stable-2.15","stable-2.16"]'
target-python-versions: '["2.7","3.6","3.7","3.8","3.9","3.10","3.11"]'