mnemo_cards/tools/ci/code-quality.yml

78 lines
2.4 KiB
YAML
Raw Normal View History

2025-11-16 12:15:21 +00:00
name: Code Quality
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
quality-gate:
runs-on: ubuntu-latest
container: dart:stable
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
2025-11-19 19:59:53 +00:00
flutter-version: '3.35.5'
2025-11-16 12:15:21 +00:00
channel: 'stable'
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.pub-cache
**/.dart_tool
key: ${{ runner.os }}-deps-${{ hashFiles('**/pubspec.lock') }}
2025-11-16 14:05:47 +00:00
- name: Quick dependency check
2025-11-16 12:15:21 +00:00
run: |
2025-11-16 14:05:47 +00:00
# Быстрая проверка наличия pubspec файлов
if ! find . -name "pubspec.yaml" -type f | grep -q .; then
echo "No pubspec.yaml files found"
exit 1
fi
2025-11-16 12:15:21 +00:00
2025-11-16 14:05:47 +00:00
- name: Check for common issues
2025-11-16 12:15:21 +00:00
run: |
2025-11-16 14:05:47 +00:00
# Проверка на наличие TODO/FIXME в коде
if grep -r -i "todo\|fixme\|hack" --include="*.dart" . | grep -v -E "(test|example)"; then
echo "⚠️ Found TODO/FIXME comments in production code"
fi
2025-11-16 12:15:21 +00:00
2025-11-16 14:05:47 +00:00
# Проверка на потенциальные секреты
if grep -r -i "password\|secret\|key\|token" --include="*.dart" --include="*.yaml" --include="*.json" . | grep -v -E "(example|test|mock|fake|pubspec)"; then
echo "⚠️ Potential secrets found in code"
echo "Please review and ensure no real secrets are committed"
else
echo "✅ No obvious secrets found"
fi
2025-11-16 12:15:21 +00:00
2025-11-16 14:05:47 +00:00
- name: Quality gate check
2025-11-16 12:15:21 +00:00
run: |
2025-11-16 14:05:47 +00:00
# Проверка что основные проекты существуют
2025-11-16 12:15:21 +00:00
projects=("mnemo_cards_backend" "mnemo_cards_web_v2" "mnemo_cards")
for project in "${projects[@]}"; do
2025-11-16 14:05:47 +00:00
if [ ! -d "$project" ]; then
echo "❌ Project $project not found"
exit 1
2025-11-16 12:15:21 +00:00
fi
done
2025-11-16 14:05:47 +00:00
# Проверка что нет критических ошибок в логах
if [ -f ".github/workflows/code-quality.log" ]; then
if grep -i "error\|failed\|exception" .github/workflows/code-quality.log; then
echo "❌ Found critical errors in quality check"
2025-11-16 12:15:21 +00:00
exit 1
fi
fi
echo "✅ Quality gate passed"