This commit is contained in:
+30
-5
@@ -9,22 +9,47 @@ jobs:
|
|||||||
runs-on: ubuntu
|
runs-on: ubuntu
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
# Checkout repository source code
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install deps
|
# Install required system dependencies
|
||||||
|
# Includes Ansible, Docker (for molecule and compose), and Python tooling
|
||||||
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y python3 python3-pip ansible docker.io
|
apt-get install -y python3 python3-pip ansible docker.io
|
||||||
|
pip3 install ansible-lint molecule molecule-plugins[docker]
|
||||||
|
|
||||||
|
# Basic Python syntax validation to catch immediate errors
|
||||||
|
# This avoids introducing runtime failures due to syntax issues
|
||||||
- name: Python syntax check
|
- name: Python syntax check
|
||||||
run: |
|
run: |
|
||||||
find migration-validation-framework -name "*.py" -exec python3 -m py_compile {} \;
|
find migration-validation-framework -name "*.py" -exec python3 -m py_compile {} \;
|
||||||
|
|
||||||
|
# Run Ansible lint to enforce best practices and detect potential issues
|
||||||
|
# Uses ansible.cfg from the project directory
|
||||||
|
- name: Ansible lint
|
||||||
|
run: |
|
||||||
|
cd enterprise-infra-simulator
|
||||||
|
ansible-lint
|
||||||
|
|
||||||
|
# Perform syntax validation of all playbooks
|
||||||
|
# Ensures playbooks are structurally correct before execution
|
||||||
- name: Ansible syntax check
|
- name: Ansible syntax check
|
||||||
run: |
|
run: |
|
||||||
ansible-playbook -i enterprise-infra-simulator/inventory/hosts.ini \
|
cd enterprise-infra-simulator
|
||||||
--syntax-check enterprise-infra-simulator/playbooks/*.yml
|
ansible-playbook --syntax-check playbooks/*.yml
|
||||||
|
|
||||||
- name: Docker compose validation
|
# Validate Docker Compose configuration
|
||||||
|
# Ensures compose file is valid and can be parsed correctly
|
||||||
|
- name: Docker Compose validation
|
||||||
run: |
|
run: |
|
||||||
docker compose -f observability-stack/docker-compose.yml config
|
docker compose -f observability-stack/docker-compose.yml config
|
||||||
|
|
||||||
|
# Execute Molecule tests for Ansible roles
|
||||||
|
# This validates role behavior in an isolated container environment
|
||||||
|
- name: Molecule test
|
||||||
|
run: |
|
||||||
|
cd enterprise-infra-simulator
|
||||||
|
molecule test
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
[defaults]
|
||||||
|
roles_path = ./roles
|
||||||
|
inventory = ./inventory/hosts.ini
|
||||||
|
host_key_checking = False
|
||||||
|
retry_files_enabled = False
|
||||||
Reference in New Issue
Block a user