mnemo_cards/.forgejo/workflows/code-quality.yml

77 lines
2.4 KiB
YAML

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:
flutter-version: '3.19.0'
channel: 'stable'
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.pub-cache
**/.dart_tool
key: ${{ runner.os }}-deps-${{ hashFiles('**/pubspec.lock') }}
- name: Quick dependency check
run: |
# Быстрая проверка наличия pubspec файлов
if ! find . -name "pubspec.yaml" -type f | grep -q .; then
echo "No pubspec.yaml files found"
exit 1
fi
- name: Check for common issues
run: |
# Проверка на наличие 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
# Проверка на потенциальные секреты
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
- name: Quality gate check
run: |
# Проверка что основные проекты существуют
projects=("mnemo_cards_backend" "mnemo_cards_web_v2" "mnemo_cards")
for project in "${projects[@]}"; do
if [ ! -d "$project" ]; then
echo "❌ Project $project not found"
exit 1
fi
done
# Проверка что нет критических ошибок в логах
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"
exit 1
fi
fi
echo "✅ Quality gate passed"