Daniel Grozdanovic bcd0f8a227
Some checks failed
CI - SharePoint Plugin with SonarQube / Test and SonarQube Analysis (push) Has been cancelled
Initial commit: SharePoint connector and ToothFairyAI integration
2026-02-22 17:58:45 +02:00

97 lines
2.6 KiB
YAML

on:
push:
branches:
- main
- develop
- feature/*
pull_request:
branches:
- main
- develop
- feature/*
name: CI - SharePoint Plugin with SonarQube
jobs:
test-and-scan:
name: Test and SonarQube Analysis
runs-on: ubuntu-latest
defaults:
run:
working-directory: plugins/sharepoint
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('plugins/sharepoint/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov pytest-mock
- name: Run tests with coverage
run: |
pytest \
--cov=. \
--cov-report=xml:coverage.xml \
--cov-report=term \
--cov-report=html \
-v \
--ignore=venv \
--ignore=.venv
continue-on-error: false
- name: Verify coverage file
run: |
pwd
ls -la
if [ -f coverage.xml ]; then
echo "✅ Coverage file exists"
echo "First 30 lines of coverage.xml:"
head -30 coverage.xml
else
echo "❌ ERROR: Coverage file was not created!"
exit 1
fi
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v6
with:
projectBaseDir: plugins/sharepoint
args: >
-Dsonar.projectKey=sharepoint-connector
-Dsonar.projectName=SharePoint Connector Plugin
-Dsonar.sources=.
-Dsonar.python.coverage.reportPaths=coverage.xml
-Dsonar.tests=.
-Dsonar.test.inclusions=test_*.py
-Dsonar.exclusions=venv/**,**/__pycache__/**,*.pyc,.venv/**,htmlcov/**,templates/**,static/**
-Dsonar.python.version=3.11
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
- name: SonarQube Quality Gate Check
uses: SonarSource/sonarqube-quality-gate-action@v1
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}