Coverage thresholds, performance regression, security scanning. Останавливаем плохие PR. Branch protection rules
Quality gates автоматически останавливают плохой код.
- name: Run tests with coverage
run: |
pytest --cov=src --cov-report=xml --cov-fail-under=80 -v
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: true# .github/workflows/test.yml должен быть required
Repository Settings → Branches → Branch protection rules:
- Require status checks before merging
- Require branches to be up to date
- Status checks: "Tests / test"- name: Run Bandit security scan
run: |
pip install bandit
bandit -r src/ -f json -o bandit-report.json
- name: Run Safety check
run: |
pip install safety
safety check --jsonСледующий урок: CI/CD: Flaky Tests Detection
Вопросы ещё не добавлены
Вопросы для этой подтемы ещё не добавлены.
Далее: CI/CD: Matrix Strategy для разных версий