From e03e4edeaacdc4f35ad10aa4d531c1ffe69e1523 Mon Sep 17 00:00:00 2001 From: aitbc1 Date: Fri, 27 Mar 2026 12:55:48 +0100 Subject: [PATCH] fix: install Python and pip in workflows for proper environment PROGRESS: Nuclear fix working perfectly! Python project detected correctly. Issue: 'pip: command not found' - Python environment not properly set up Root cause: Runner missing Python3 and pip installation Solution: - Add Python environment setup to all workflows - Install python3, python3-pip, python3-venv if not available - Upgrade pip to latest version - Verify Python and pip versions before proceeding - Maintain same nuclear fix approach for workspace control Updated workflows: - audit.yml: Python setup + poetry install + audit - fix.yml: Python setup + poetry install + safety fixes - security-scanning.yml: Python setup + poetry install + security scans Expected results: - Python 3 installed and available - pip upgraded and working - Poetry installed for dependency management - Security scanning tools (safety, bandit) installed - All workflows should complete successfully This should resolve the 'command not found' errors and enable proper Python dependency management and security scanning. --- .gitea/workflows/audit.yml | 19 +++++++++++++++++-- .gitea/workflows/fix.yml | 14 ++++++++++++++ .gitea/workflows/security-scanning.yml | 14 ++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/audit.yml b/.gitea/workflows/audit.yml index 47cecc29..820bd9d9 100644 --- a/.gitea/workflows/audit.yml +++ b/.gitea/workflows/audit.yml @@ -40,8 +40,23 @@ jobs: npm audit || true elif [ -f "pyproject.toml" ]; then echo "✅ Python project detected!" - echo "PyProject.toml content:" - head -10 pyproject.toml + echo "=== PYTHON SETUP ===" + + # Install Python and pip if not available + if ! command -v python3 >/dev/null 2>&1; then + echo "Installing Python 3..." + apt-get update + apt-get install -y python3 python3-pip python3-venv + fi + + if ! command -v pip >/dev/null 2>&1; then + echo "Installing pip..." + python3 -m pip install --upgrade pip + fi + + echo "Python version: $(python3 --version)" + echo "Pip version: $(pip --version)" + echo "=== PYTHON DEPENDENCIES ===" if command -v poetry >/dev/null 2>&1; then echo "Poetry found, installing dependencies..." diff --git a/.gitea/workflows/fix.yml b/.gitea/workflows/fix.yml index ff025a83..9d8cee41 100644 --- a/.gitea/workflows/fix.yml +++ b/.gitea/workflows/fix.yml @@ -38,6 +38,20 @@ jobs: npm audit fix || true elif [ -f "pyproject.toml" ]; then echo "✅ Python project detected!" + echo "=== PYTHON SETUP ===" + + # Install Python and pip if not available + if ! command -v python3 >/dev/null 2>&1; then + echo "Installing Python 3..." + apt-get update + apt-get install -y python3 python3-pip python3-venv + fi + + if ! command -v pip >/dev/null 2>&1; then + echo "Installing pip..." + python3 -m pip install --upgrade pip + fi + echo "=== PYTHON DEPENDENCIES ===" if command -v poetry >/dev/null 2>&1; then echo "Poetry found, installing dependencies..." diff --git a/.gitea/workflows/security-scanning.yml b/.gitea/workflows/security-scanning.yml index eaf68951..d53b45ec 100644 --- a/.gitea/workflows/security-scanning.yml +++ b/.gitea/workflows/security-scanning.yml @@ -38,6 +38,20 @@ jobs: npm audit --audit-level moderate || true elif [ -f "pyproject.toml" ]; then echo "✅ Python project detected!" + echo "=== PYTHON SETUP ===" + + # Install Python and pip if not available + if ! command -v python3 >/dev/null 2>&1; then + echo "Installing Python 3..." + apt-get update + apt-get install -y python3 python3-pip python3-venv + fi + + if ! command -v pip >/dev/null 2>&1; then + echo "Installing pip..." + python3 -m pip install --upgrade pip + fi + echo "=== PYTHON DEPENDENCIES ===" if command -v poetry >/dev/null 2>&1; then echo "Poetry found, installing dependencies..."