Merge pull request #25 from Aignosi/SIENTIAPDE-1318-adicionar-pipeline-de-qualidade
SIENTIAPDE-1318: Enhance Code Quality Checks
This commit is contained in:
31
.github/workflows/quality-gate.yml
vendored
31
.github/workflows/quality-gate.yml
vendored
@@ -57,11 +57,38 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: 📦 Install Dependencies
|
- name: 📦 Install Development Dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
|
pip install -r requirements-dev.txt
|
||||||
|
|
||||||
|
- name: 📦 Install Runtime Dependencies
|
||||||
|
run: |
|
||||||
pip install -r ${{ steps.prepare-requirements.outputs.PROCESSED_REQUIREMENTS_FILE }}
|
pip install -r ${{ steps.prepare-requirements.outputs.PROCESSED_REQUIREMENTS_FILE }}
|
||||||
pip install pytest pytest-cov pytest-asyncio
|
|
||||||
|
- name: 📝 Code Formatting Check (Ruff)
|
||||||
|
run: |
|
||||||
|
echo "Checking code formatting..."
|
||||||
|
ruff format --check orchestrator/ tests/
|
||||||
|
continue-on-error: false
|
||||||
|
|
||||||
|
- name: 🔎 Code Linting (Ruff)
|
||||||
|
run: |
|
||||||
|
echo "Running linting checks..."
|
||||||
|
ruff check orchestrator/ tests/
|
||||||
|
continue-on-error: false
|
||||||
|
|
||||||
|
- name: 🏷️ Type Checking (mypy)
|
||||||
|
run: |
|
||||||
|
echo "Running type checks..."
|
||||||
|
mypy orchestrator/
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: 🔒 Security Analysis (Bandit)
|
||||||
|
run: |
|
||||||
|
echo "Running security analysis..."
|
||||||
|
bandit -r orchestrator/ -ll -q
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
- name: 🧪 Run Tests with Pytest
|
- name: 🧪 Run Tests with Pytest
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ redis
|
|||||||
couchbase
|
couchbase
|
||||||
pymongo
|
pymongo
|
||||||
jinja2
|
jinja2
|
||||||
git+ssh://git@github.com/Aignosi/sientia-dataops-library.git@1.4.3
|
git+ssh://git@github.com/Aignosi/sientia-dataops-library.git@1.4.6
|
||||||
prometheus-client
|
prometheus-client
|
||||||
|
|||||||
29
validate.sh
29
validate.sh
@@ -11,6 +11,27 @@ YELLOW='\033[1;33m'
|
|||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
NC='\033[0m' # No Color
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
# Args
|
||||||
|
FIX_MODE=false
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
--fix)
|
||||||
|
FIX_MODE=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
echo "Usage: $0 [--fix]"
|
||||||
|
echo " --fix Apply Ruff auto-fixes (format and lint fixes)."
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "${RED}Unknown option: $1${NC}"
|
||||||
|
echo "Usage: $0 [--fix]"
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
echo -e "${BLUE}╔════════════════════════════════════════════════════════╗${NC}"
|
echo -e "${BLUE}╔════════════════════════════════════════════════════════╗${NC}"
|
||||||
echo -e "${BLUE}║ Model Manager - Code Validation Suite ║${NC}"
|
echo -e "${BLUE}║ Model Manager - Code Validation Suite ║${NC}"
|
||||||
echo -e "${BLUE}╚════════════════════════════════════════════════════════╝${NC}"
|
echo -e "${BLUE}╚════════════════════════════════════════════════════════╝${NC}"
|
||||||
@@ -47,12 +68,16 @@ run_step() {
|
|||||||
FAILED_STEPS=()
|
FAILED_STEPS=()
|
||||||
|
|
||||||
# Step 1: Code Formatting Check (Ruff)
|
# Step 1: Code Formatting Check (Ruff)
|
||||||
if ! run_step "1. Code Formatting (Ruff)" "ruff format orchestrator/ tests/ && ruff format --check orchestrator/ tests/"; then
|
# - default: check only
|
||||||
|
# - --fix: write changes
|
||||||
|
if ! run_step "1. Code Formatting (Ruff)" "if \$FIX_MODE; then ruff format orchestrator/ tests/; else ruff format --check orchestrator/ tests/; fi"; then
|
||||||
FAILED_STEPS+=("Code Formatting")
|
FAILED_STEPS+=("Code Formatting")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 2: Linting (Ruff)
|
# Step 2: Linting (Ruff)
|
||||||
if ! run_step "2. Code Linting (Ruff)" "ruff check --fix orchestrator/ tests/"; then
|
# - default: check only
|
||||||
|
# - --fix: apply autofixes
|
||||||
|
if ! run_step "2. Code Linting (Ruff)" "if \$FIX_MODE; then ruff check --fix orchestrator/ tests/; else ruff check orchestrator/ tests/; fi"; then
|
||||||
FAILED_STEPS+=("Linting")
|
FAILED_STEPS+=("Linting")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user