localstack-tesis/.forgejo/workflows/validate.yml

114 lines
4.1 KiB
YAML

name: Validacion
on:
pull_request:
branches: [develop]
push:
branches: [develop]
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
github-server-url: https://git.bryan-bano.com
- uses: https://github.com/astral-sh/setup-uv@v6
with:
github-token: ''
enable-cache: false
- name: Validar rama, issue, milestone, etiquetas y commits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_SERVER_URL: https://git.bryan-bano.com
run: uv run --no-project --python 3.12 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
github-server-url: https://git.bryan-bano.com
- uses: https://github.com/astral-sh/setup-uv@v6
with:
github-token: ''
enable-cache: false
- name: Instalar dependencias y coleccion AWS
run: |
uv venv --python 3.12 .venv
uv pip install --python .venv/bin/python -r ansible/requirements.txt
echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
export PATH="$PWD/.venv/bin:$PATH"
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
github-server-url: https://git.bryan-bano.com
- 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
github-server-url: https://git.bryan-bano.com
- 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
case "$(uname -m)" in
x86_64) archive=gitleaks_8.24.3_linux_x64.tar.gz ;;
aarch64|arm64) archive=gitleaks_8.24.3_linux_arm64.tar.gz ;;
*) echo "Arquitectura no soportada" >&2; exit 1 ;;
esac
curl -fsSLO "$base/$archive"
curl -fsSLO "$base/gitleaks_8.24.3_checksums.txt"
sha256sum --check --ignore-missing gitleaks_8.24.3_checksums.txt
tar -xzf "$archive" 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