[pre-commit.ci] pre-commit autoupdate #185
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# README FIRST | |
# 1. replace "community/molecule" with the correct name, ie "community/zabbix" | |
# 2. If you don't have unit tests remove that section | |
# 3. If your collection depends on other collections ensure they are installed, see "Install collection dependencies" | |
# If you need help please ask in #ansible-community on Libera.Chat IRC | |
name: CI | |
"on": | |
# Run CI against all pushes (direct commits) and Pull Requests | |
- push | |
- pull_request | |
jobs: | |
### | |
# Sanity tests (REQUIRED) | |
# | |
# https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html | |
sanity: | |
name: Sanity (${{ matrix.ansible }}) | |
strategy: | |
matrix: | |
ansible: | |
- stable-2.15 | |
- stable-2.16 | |
- stable-2.17 | |
- devel | |
runs-on: ubuntu-latest | |
steps: | |
# ansible-test requires the collection to be in a directory in the form | |
# .../ansible_collections/community/molecule/ | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
path: ansible_collections/community/molecule | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
# it is just required to run that once as "ansible-test sanity" in the docker image | |
# will run on all python versions it supports. | |
python-version: 3.11 | |
cache: 'pip' | |
# Install the head of the given branch (devel, stable-2.10) | |
- name: Install ansible (${{ matrix.ansible }}) | |
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check | |
- run: pip install -r ansible_collections/community/molecule/requirements.txt | |
# run ansible-test sanity inside of Docker. | |
# The docker container has all the pinned dependencies that are required | |
# and all python versions ansible supports. | |
- name: Run sanity tests | |
run: ansible-test sanity --docker -v --color --requirements | |
working-directory: ./ansible_collections/community/molecule | |
### | |
# Unit tests (OPTIONAL) | |
# | |
# https://docs.ansible.com/ansible/latest/dev_guide/testing_units.html | |
# units: | |
# runs-on: ubuntu-latest | |
# name: Units (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}) | |
# strategy: | |
# # As soon as the first unit test fails, cancel the others to free up the CI queue | |
# fail-fast: true | |
# matrix: | |
# ansible: | |
# - stable-2.9 # Only if your collection supports Ansible 2.9 | |
# - stable-2.10 | |
# - devel | |
# python: | |
# - 3.6 | |
# - 3.7 | |
# - 3.8 | |
# - 3.9 | |
# exclude: | |
# - ansible: stable-2.9 | |
# python: 3.9 | |
# steps: | |
# - name: Check out code | |
# uses: actions/checkout@v2 | |
# with: | |
# path: ansible_collections/community/molecule | |
# - name: Set up Python ${{ matrix.ansible }} | |
# uses: actions/setup-python@v2 | |
# with: | |
# python-version: ${{ matrix.python }} | |
# - name: Install ansible-base (${{ matrix.ansible }}) | |
# run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check | |
# # OPTIONAL If your unit test requires Python libraries from other collections | |
# # Install them like this | |
# - name: Install collection dependencies | |
# run: ansible-galaxy collection install ansible.netcommon -p . | |
# # Run the unit tests | |
# - name: Run unit test | |
# run: ansible-test units -v --color --python ${{ matrix.python }} --docker --coverage | |
# working-directory: ./ansible_collections/community/molecule | |
# # ansible-test support producing code coverage date | |
# - name: Generate coverage report | |
# run: ansible-test coverage xml -v --requirements --group-by command --group-by version | |
# working-directory: ./ansible_collections/community/molecule | |
# # See the reports at https://codecov.io/gh/ansible_collections/GITHUBORG/REPONAME | |
# - uses: codecov/codecov-action@v1 | |
# with: | |
# fail_ci_if_error: false | |
### | |
# Integration tests (RECOMMENDED) | |
# | |
# https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html | |
# If the application you are testing is available as a docker container and you want to test | |
# multiple versions see the following for an example: | |
# https://github.com/ansible-collections/community.zabbix/tree/master/.github/workflows | |
# integration: | |
# runs-on: ubuntu-latest | |
# name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}}) | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# ansible: | |
# - stable-2.9 # Only if your collection supports Ansible 2.9 | |
# - stable-2.10 | |
# - devel | |
# python: | |
# - 3.6 | |
# - 3.7 | |
# - 3.8 | |
# - 3.9 | |
# exclude: | |
# - ansible: stable-2.9 | |
# python: 3.9 | |
# steps: | |
# - name: Check out code | |
# uses: actions/checkout@v2 | |
# with: | |
# path: ansible_collections/community/molecule | |
# - name: Set up Python ${{ matrix.ansible }} | |
# uses: actions/setup-python@v2 | |
# with: | |
# python-version: ${{ matrix.python }} | |
# - name: Install ansible-base (${{ matrix.ansible }}) | |
# run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check | |
# # OPTIONAL If your integration test requires Python libraries or modules from other collections | |
# # Install them like this | |
# # - name: Install collection dependencies | |
# # run: ansible-galaxy collection install ansible.netcommon -p . | |
# # Run the integration tests | |
# - name: Run integration test | |
# run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --coverage | |
# working-directory: ./ansible_collections/community/molecule | |
# # ansible-test support producing code coverage date | |
# - name: Generate coverage report | |
# run: ansible-test coverage xml -v --requirements --group-by command --group-by version | |
# working-directory: ./ansible_collections/community/molecule | |
# # See the reports at https://codecov.io/gh/ansible_collections/GITHUBORG/REPONAME | |
# - uses: codecov/codecov-action@v1 | |
# with: | |
# fail_ci_if_error: false |