GitHub Action for setting up job matrix based on expected ansible, python and docker image support for Ansible Collections.
To use the action add the following step to your workflow file (e.g.
.github/workflows/ansible-test.yml
), example for sanity tests:
steps:
- name: Get the job matrix parameters for ansible-test as JSON
uses: data-bene/ansible-test-versions-gh-action@release/v1
id: default-matrix
with:
python-version: '[ "3.9" ]'
strategy:
fail-fast: ${{ inputs.fail-fast }}
matrix:
ansible-core-version: ${{ fromJSON(define-matrix.outputs.ansible-core-version) }}
python-version: ${{ fromJSON(define-matrix.outputs.python-version) }}
target-python-version: ${{ fromJSON(define-matrix.outputs.target-python-version) }}
exclude: ${{ fromJSON(define-matrix.outputs.target-python-exclude) }}
And for integration tests:
steps:
- name: Get the job matrix parameters for ansible-test as JSON
uses: data-bene/ansible-test-versions-gh-action@release/v1
id: default-matrix
with:
docker-image: '[ "ubuntu2004" ]'
docker-include: '[]'
strategy:
fail-fast: ${{ inputs.fail-fast }}
matrix:
ansible-core-version: ${{ fromJSON(define-matrix.outputs.ansible-core-version) }}
python-version: ${{ fromJSON(define-matrix.outputs.python-version) }}
docker-image: ${{ fromJSON(define-matrix.outputs.docker-image) }}
exclude: ${{ fromJSON(define-matrix.outputs.docker-exclude) }}
include: ${{ fromJSON(define-matrix.outputs.docker-include) }}
Pro tip: instead of using branch pointers, like
main
, pin versions of Actions that you use to tagged versions or SHA-1 commit identifiers. This will make your workflows more secure and better reproducible, saving you from sudden and unpleasant surprises.
When set the inputs replace the default values, inputs MUST be JSON.
ansible-core-version
: Array of ansible versions (required: false)docker-exclude
: Array of matrix excludes for docker (required: false)docker-image
: Array of docker images (required: false)docker-include
: Array of matrix includes for docker (required: false)python-version
: Array of python versions (controler) (required: false)target-python-exclude
: Array of excludes target python versions (required: false)target-python-version
: Array of target python versions (managed) (required: false)
JSON outputs:
ansible-core-version
: Array of ansible versionsdocker-exclude
: Array of matrix excludes for dockerdocker-image
: Array of docker imagesdocker-include
: Array of matrix includes for dockerpython-version
: Array of python versions (controler)target-python-exclude
: Array of excludes target python versionstarget-python-version
: Array of target python versions (managed)