name: Validacion on: pull_request: branches: [develop] push: branches: [develop, 'feature/**', 'bugfix/**', 'chore/**'] workflow_dispatch: jobs: gitflow: name: gitflow runs-on: ubuntu-latest steps: - uses: https://github.com/actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha || github.sha }} persist-credentials: false - uses: https://github.com/actions/setup-python@v5 with: python-version: '3.12' - name: Validar rama, issue, milestone, etiquetas y commits env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: python scripts/check_gitflow.py ansible: name: ansible runs-on: ubuntu-latest steps: - uses: https://github.com/actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} persist-credentials: false - uses: https://github.com/actions/setup-python@v5 with: python-version: '3.12' - name: Instalar dependencias y coleccion AWS run: | python -m pip install -r ansible/requirements.txt ansible-galaxy collection install -r ansible/requirements.yml - name: Validar sintaxis y buenas practicas working-directory: ansible run: | ansible-playbook -i inventory/hosts.example.yml playbook.yml --syntax-check ansible-lint playbook.yml - name: Probar autenticacion, eventos, inventario y reglas de integracion run: python -m unittest discover -s tests -v terraform: name: terraform runs-on: ubuntu-latest steps: - uses: https://github.com/actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} persist-credentials: false - uses: https://github.com/hashicorp/setup-terraform@v3 with: terraform_version: '1.15.9' terraform_wrapper: false - name: Validar infraestructura sin credenciales AWS working-directory: terraform-tesis-ir-secure-portal run: | terraform fmt -check -diff terraform init -backend=false -input=false terraform validate -no-color secretos: name: secretos runs-on: ubuntu-latest steps: - uses: https://github.com/actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha || github.sha }} persist-credentials: false - name: Descargar Gitleaks y verificar checksum run: | set -eu mkdir -p /tmp/tesis-gitleaks cd /tmp/tesis-gitleaks base=https://github.com/gitleaks/gitleaks/releases/download/v8.24.3 curl -fsSLO "$base/gitleaks_8.24.3_linux_x64.tar.gz" curl -fsSLO "$base/gitleaks_8.24.3_checksums.txt" sha256sum --check --ignore-missing gitleaks_8.24.3_checksums.txt tar -xzf gitleaks_8.24.3_linux_x64.tar.gz gitleaks - name: Buscar secretos en los commits del cambio env: BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} run: | set -eu if [ -n "$BASE_SHA" ] && git cat-file -e "$BASE_SHA^{commit}" 2>/dev/null; then /tmp/tesis-gitleaks/gitleaks git --redact --no-banner --log-opts="$BASE_SHA..HEAD" . else /tmp/tesis-gitleaks/gitleaks git --redact --no-banner --log-opts=-1 . fi