56 lines
1.8 KiB
YAML
56 lines
1.8 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
validate:
|
|
runs-on: ubuntu
|
|
|
|
steps:
|
|
# Checkout repository source code
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
# Install required system dependencies
|
|
# Includes Ansible, Docker (for molecule and compose), and Python tooling
|
|
- name: Install dependencies
|
|
run: |
|
|
apt-get update
|
|
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
|
|
run: |
|
|
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
|
|
run: |
|
|
cd enterprise-infra-simulator
|
|
ansible-playbook --syntax-check playbooks/*.yml
|
|
|
|
# Validate Docker Compose configuration
|
|
# Ensures compose file is valid and can be parsed correctly
|
|
- name: Docker Compose validation
|
|
run: |
|
|
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
|