name: SonarQube Code Quality Scan on: push: branches: - main pull_request: types: [opened, synchronize, reopened] jobs: sonarqube: name: SonarQube Scan runs-on: ubuntu-latest steps: - name: Clone Repository uses: actions/checkout@v4 with: fetch-depth: 0 # Required for advanced SonarQube features like blame info - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" - name: Install system dependencies run: | sudo apt-get update -qq sudo apt-get install -y -qq libegl1 libxkbcommon0 libglib2.0-0t64 libgl1-mesa-glx || true - name: Install project dependencies run: | python -m venv .venv .venv/bin/pip install --upgrade pip .venv/bin/pip install -r requirements.txt .venv/bin/pip install -r requirements-dev.txt - name: Run tests with coverage run: | .venv/bin/coverage run -m pytest --junitxml=pytest-report.xml tests/ .venv/bin/coverage xml - name: Run SonarQube Scanner uses: sonarsource/sonarqube-scan-action@v4 env: SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST_URL }}