Update ingestor and data manager for improved shutdown handling and logging - Incremented project version in quality gate configuration. - Commented out ingestor service in docker-compose for clarity. - Enhanced main loop in app.py to handle exit signals and exceptions. - Added shutdown methods in Ingestor and DataManager classes for graceful resource cleanup. - Updated unit tests to validate shutdown behavior and exception handling. - Introduced coverage configuration to omit specific files.
85 lines
2.3 KiB
YAML
85 lines
2.3 KiB
YAML
name: Quality gate
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- 'feature/**'
|
|
- 'release/**'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- 'release/**'
|
|
types: [ opened, synchronize, reopened ]
|
|
|
|
jobs:
|
|
sonar:
|
|
name: SonarQube Analysis
|
|
runs-on: ubuntu-latest
|
|
permissions: write-all
|
|
|
|
steps:
|
|
- name: ⬇️ Checkout Code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: 🔧 Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: 🗄️ Cache Python dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Configure SSH
|
|
uses: webfactory/ssh-agent@v0.9.0
|
|
with:
|
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
|
|
- name: Add github.com to known_hosts
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
|
|
|
- name: 📦 Install Dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install pytest pytest-cov
|
|
|
|
- name: ⬇️ Setup Node.js 18
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: 📥 Setup SonarScanner
|
|
uses: warchant/setup-sonar-scanner@v7
|
|
|
|
- name: 🧪 Run Tests with Pytest
|
|
run: |
|
|
pytest tests --junitxml=pytest.xml --cov=ingestor --cov-report=xml --cov-report=term
|
|
|
|
- name: 📊 Run SonarQube Analysis
|
|
env:
|
|
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
|
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
run: |
|
|
sonar-scanner \
|
|
-Dsonar.projectKey=$SONAR_PROJECT_KEY \
|
|
-Dsonar.sources=ingestor \
|
|
-Dsonar.tests=tests \
|
|
-Dsonar.python.coverage.reportPaths=coverage.xml \
|
|
-Dsonar.python.xunit.reportPath=pytest.xml \
|
|
-Dsonar.host.url=$SONAR_HOST_URL \
|
|
-Dsonar.token=$SONAR_TOKEN \
|
|
-Dsonar.python.version=3.11 \
|
|
-Dsonar.projectVersion=1.0.1 \
|
|
-Dsonar.coverage.exclusions=ingestor/app.py
|