Rebuild tests using Checkmk containers #902
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: | |
# Resources: | |
# - Template for this file: https://github.com/ansible-collections/collection_template/blob/main/.github/workflows/ansible-test.yml | |
env: | |
NAMESPACE: checkmk | |
COLLECTION_NAME: general | |
name: Ansible Linting | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
- devel | |
paths: | |
- 'roles/**' | |
- 'playbooks/**' | |
- 'tests/**' | |
push: | |
branches: | |
- main | |
- devel | |
paths: | |
- 'roles/**' | |
- 'playbooks/**' | |
- 'tests/**' | |
- '.github/workflows/ansible-lint.yaml' | |
jobs: | |
integration: | |
runs-on: ubuntu-22.04 | |
name: I py${{ matrix.python }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
python: | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} | |
- name: Install Checkmk collection | |
run: ansible-galaxy collection install ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} | |
# Run the linting | |
- name: Run yamllint on roles | |
run: yamllint -c ./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/.yamllint ./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/roles/ | |
working-directory: ./ansible_collections/ | |
- name: Run yamllint on playbooks | |
run: yamllint -c ./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/.yamllint ./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/playbooks/ | |
working-directory: ./ansible_collections/ | |
- name: Run yamllint on tests | |
run: yamllint -c ./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/.yamllint ./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/tests/ | |
working-directory: ./ansible_collections/ | |
- name: Run ansible-lint on roles | |
run: ansible-lint -c ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/.ansible-lint ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/roles/ | |
working-directory: ./ansible_collections/ | |
env: | |
ANSIBLE_LIBRARY: "./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/plugins/modules" | |
ANSIBLE_ROLES_PATH: "./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/roles" | |
- name: Run ansible-lint on tests | |
run: ansible-lint -c ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/.ansible-lint ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/tests/ | |
working-directory: ./ansible_collections/ | |
env: | |
ANSIBLE_LIBRARY: "./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/plugins/modules" | |
ANSIBLE_ROLES_PATH: "./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/roles" | |
- name: Run ansible-lint on playbooks | |
run: ansible-lint -c ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/.ansible-lint ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/playbooks/ | |
working-directory: ./ansible_collections/ | |
env: | |
ANSIBLE_LIBRARY: "./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/plugins/modules" | |
ANSIBLE_ROLES_PATH: "./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/roles" |