From 64f37ef393c4c2126f02850ed4cd66a74bc31723 Mon Sep 17 00:00:00 2001 From: ilia Date: Sat, 10 Jan 2026 14:26:19 -0500 Subject: [PATCH] Fix sonar-analysis job: Install Python 3.11 instead of 3.10 ISSUE: ====== - Ubuntu 22.04 comes with Python 3.10 - Project requires Python >=3.11 (pyproject.toml) - Error: Package 'pote' requires a different Python: 3.10.12 not in '>=3.11' FIX: ==== - Install Python 3.11 from deadsnakes PPA - Install pip for Python 3.11 - Use python3.11 -m pip explicitly for all pip operations - Use python3.11 -m pytest for test execution CHANGES: ======== - Install software-properties-common for add-apt-repository - Add deadsnakes PPA for Python 3.11 - Install python3.11, python3.11-dev, python3.11-venv, python3.11-distutils - Install pip via get-pip.py for Python 3.11 - Update all pip/pytest commands to use python3.11 -m This ensures the sonar-analysis job uses Python 3.11 as required. --- .github/workflows/ci.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05fcbbf..4218f23 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -344,16 +344,27 @@ jobs: echo "⚠️ Warning: Could not verify SonarQube server connectivity (continuing anyway)" fi - - name: Install Python and dependencies + - name: Install Python 3.11 and dependencies run: | - apt-get update && apt-get install -y python3 python3-pip - pip3 install --upgrade pip + apt-get update + apt-get install -y software-properties-common + add-apt-repository -y ppa:deadsnakes/ppa + apt-get update + apt-get install -y python3.11 python3.11-dev python3.11-venv python3.11-distutils + # Install pip for Python 3.11 + curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11 + # Ensure python3 and pip3 point to 3.11 + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 || true + # Use python3.11 -m pip for pip operations + python3.11 -m pip install --upgrade pip + python3 --version + python3.11 -m pip --version - name: Generate coverage report run: | echo "Generating coverage report for SonarQube..." - pip3 install -e ".[dev]" - pytest tests/ --cov=src/pote --cov-report=xml --cov-report=term || true + python3.11 -m pip install -e ".[dev]" + python3.11 -m pytest tests/ --cov=src/pote --cov-report=xml --cov-report=term || true - name: Run SonarScanner run: |