fix: install Python and pip in workflows for proper environment
Some checks failed
audit / audit (push) Failing after 2s
ci-cd / build (push) Failing after 4s
ci / build (push) Failing after 4s
autofix / fix (push) Failing after 1s
security-scanning / audit (push) Failing after 2s
test / test (push) Successful in 2s
ci-cd / deploy (push) Has been skipped

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.
This commit is contained in:
2026-03-27 12:55:48 +01:00
parent 0a2d7002c2
commit e03e4edeaa
3 changed files with 45 additions and 2 deletions

View File

@@ -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..."

View File

@@ -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..."

View File

@@ -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..."