124906d084
- Introduced multiple guides for workflows including Evidence Pack Validation, Incident Response, Model Validation, Performance & HIL, Release Signing, SBOM Validation, Secret Scanning, and Supply Chain Attestation. - Created dynamic badges for each workflow to reflect their status and compliance. - Implemented a checklist for validating CI/CD workflows and evidence packs. - Developed scripts for building firmware, testing, collecting evidence, and generating audit reports. - Added tools for generating community, documentation, quality, and security badges based on various reports. - Established endpoints for dynamic badges to be integrated into documentation and README files. - Enhanced the overall structure and traceability of CI/CD processes with evidence packs and automated checks.
36 lines
935 B
Python
36 lines
935 B
Python
# coverage_badge.py
|
|
"""
|
|
Script pour extraire le taux de couverture et générer un badge dynamique pour shields.io
|
|
"""
|
|
import json
|
|
import re
|
|
|
|
# Extraction du taux depuis coverage report
|
|
coverage_file = 'docs/coverage_report/index.html'
|
|
output_json = 'docs/coverage-summary.json'
|
|
|
|
try:
|
|
with open(coverage_file, 'r', encoding='utf-8') as f:
|
|
html = f.read()
|
|
# Recherche du taux de couverture (ex: 'xx% covered')
|
|
match = re.search(r'(\d+)%\s*covered', html)
|
|
if match:
|
|
coverage = int(match.group(1))
|
|
else:
|
|
coverage = 0
|
|
except Exception:
|
|
coverage = 0
|
|
|
|
# Génération du JSON pour shields.io
|
|
badge = {
|
|
"schemaVersion": 1,
|
|
"label": "coverage",
|
|
"message": f"{coverage}%",
|
|
"color": "brightgreen" if coverage >= 80 else "orange" if coverage >= 50 else "red"
|
|
}
|
|
|
|
with open(output_json, 'w', encoding='utf-8') as f:
|
|
json.dump(badge, f)
|
|
|
|
print(f"Coverage badge generated: {badge}")
|