|
| 1 | +name: Comprehensive Quality Gates |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [main, master] |
| 5 | + pull_request: |
| 6 | + schedule: |
| 7 | + - cron: '0 5 * * 0' |
| 8 | + |
| 9 | +jobs: |
| 10 | + # DEPENDABILITY - Stability and reliability |
| 11 | + dependability: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + - name: Check test coverage |
| 16 | + run: | |
| 17 | + echo "Checking for test files..." |
| 18 | + TESTS=$(find . -name "*_test.*" -o -name "test_*" -o -name "*_spec.*" -o -name "*.test.*" | wc -l) |
| 19 | + echo "Found $TESTS test files" |
| 20 | + if [ "$TESTS" -lt 1 ]; then |
| 21 | + echo "::warning::No test files detected" |
| 22 | + fi |
| 23 | + - name: Check error handling |
| 24 | + run: | |
| 25 | + # Check for proper error handling patterns |
| 26 | + PANICS=$(grep -rE "panic!|unwrap\(\)|expect\(" --include="*.rs" . 2>/dev/null | wc -l || echo "0") |
| 27 | + echo "Rust panics/unwraps: $PANICS" |
| 28 | +
|
| 29 | + # SECURITY - Multi-layer security scanning |
| 30 | + security: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + - name: Secret scanning |
| 35 | + uses: trufflesecurity/trufflehog@main |
| 36 | + continue-on-error: true |
| 37 | + - name: Dependency vulnerabilities |
| 38 | + run: | |
| 39 | + if [ -f "Cargo.toml" ]; then |
| 40 | + cargo install cargo-audit && cargo audit || true |
| 41 | + fi |
| 42 | + if [ -f "requirements.txt" ]; then |
| 43 | + pip install safety && safety check -r requirements.txt || true |
| 44 | + fi |
| 45 | + - name: SAST scan |
| 46 | + uses: returntocorp/semgrep-action@v1 |
| 47 | + continue-on-error: true |
| 48 | + |
| 49 | + # INTEROPERABILITY - API and format compatibility |
| 50 | + interoperability: |
| 51 | + runs-on: ubuntu-latest |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v4 |
| 54 | + - name: Check API specs |
| 55 | + run: | |
| 56 | + if [ -f "openapi.yaml" ] || [ -f "openapi.json" ]; then |
| 57 | + echo "✅ OpenAPI spec found" |
| 58 | + fi |
| 59 | + if [ -f "schema.graphql" ]; then |
| 60 | + echo "✅ GraphQL schema found" |
| 61 | + fi |
| 62 | + - name: Validate JSON/YAML schemas |
| 63 | + run: | |
| 64 | + find . -name "*.json" -exec python3 -m json.tool {} \; 2>/dev/null | head -5 || true |
| 65 | +
|
| 66 | + # VALIDATION - Input/output validation |
| 67 | + validation: |
| 68 | + runs-on: ubuntu-latest |
| 69 | + steps: |
| 70 | + - uses: actions/checkout@v4 |
| 71 | + - name: Check for validation patterns |
| 72 | + run: | |
| 73 | + VALIDATION=$(grep -rE "validate|sanitize|Schema|Validator" --include="*.rs" --include="*.res" --include="*.ex" . 2>/dev/null | wc -l || echo "0") |
| 74 | + echo "Validation patterns found: $VALIDATION" |
| 75 | +
|
| 76 | + # ATTESTATION - Supply chain integrity (SLSA) |
| 77 | + attestation: |
| 78 | + runs-on: ubuntu-latest |
| 79 | + permissions: |
| 80 | + id-token: write |
| 81 | + contents: read |
| 82 | + attestations: write |
| 83 | + steps: |
| 84 | + - uses: actions/checkout@v4 |
| 85 | + - name: Generate SBOM |
| 86 | + run: | |
| 87 | + echo "SBOM generation would run here" |
| 88 | + # For Rust: cargo-sbom |
| 89 | + # For Node: npm sbom |
| 90 | + - name: Check signatures |
| 91 | + run: | |
| 92 | + if [ -f "CHECKSUMS.txt" ] || [ -f "SHA256SUMS" ]; then |
| 93 | + echo "✅ Checksums file present" |
| 94 | + fi |
| 95 | +
|
| 96 | + # VERIFICATION - Formal methods where applicable |
| 97 | + verification: |
| 98 | + runs-on: ubuntu-latest |
| 99 | + steps: |
| 100 | + - uses: actions/checkout@v4 |
| 101 | + - name: Check SPARK proofs |
| 102 | + run: | |
| 103 | + if find . -name "*.ads" | grep -q .; then |
| 104 | + echo "Ada/SPARK files found - formal verification applicable" |
| 105 | + fi |
| 106 | + - name: Type coverage |
| 107 | + run: | |
| 108 | + if [ -f "rescript.json" ]; then |
| 109 | + echo "ReScript provides 100% type coverage" |
| 110 | + fi |
| 111 | +
|
| 112 | + # FUNCTIONALITY - Feature completeness |
| 113 | + functionality: |
| 114 | + runs-on: ubuntu-latest |
| 115 | + steps: |
| 116 | + - uses: actions/checkout@v4 |
| 117 | + - name: Check TODOs and FIXMEs |
| 118 | + run: | |
| 119 | + echo "=== Incomplete items ===" |
| 120 | + grep -rn "TODO\|FIXME\|UNIMPLEMENTED\|unimplemented!" . 2>/dev/null | head -20 || echo "None" |
| 121 | + - name: Check deprecated usage |
| 122 | + run: | |
| 123 | + grep -rn "deprecated\|DEPRECATED" . 2>/dev/null | head -10 || echo "No deprecations" |
| 124 | +
|
| 125 | + # PERFORMANCE - Benchmarks and profiling |
| 126 | + performance: |
| 127 | + runs-on: ubuntu-latest |
| 128 | + steps: |
| 129 | + - uses: actions/checkout@v4 |
| 130 | + - name: Check for benchmarks |
| 131 | + run: | |
| 132 | + BENCHES=$(find . -name "*bench*" -o -name "*perf*" | wc -l) |
| 133 | + echo "Benchmark files: $BENCHES" |
| 134 | + - name: Binary size check (Rust) |
| 135 | + run: | |
| 136 | + if [ -f "Cargo.toml" ]; then |
| 137 | + cargo build --release 2>/dev/null || true |
| 138 | + find target/release -maxdepth 1 -type f -executable -exec ls -lh {} \; 2>/dev/null || true |
| 139 | + fi |
| 140 | +
|
| 141 | + # ACCESSIBILITY - A11y compliance |
| 142 | + accessibility: |
| 143 | + runs-on: ubuntu-latest |
| 144 | + if: hashFiles('**/*.html') != '' |
| 145 | + steps: |
| 146 | + - uses: actions/checkout@v4 |
| 147 | + - name: HTML accessibility check |
| 148 | + run: | |
| 149 | + echo "Checking for a11y attributes..." |
| 150 | + A11Y=$(grep -rE 'aria-|role=|alt=' --include="*.html" . 2>/dev/null | wc -l || echo "0") |
| 151 | + echo "A11y attributes found: $A11Y" |
| 152 | + - name: Lighthouse (if web project) |
| 153 | + run: | |
| 154 | + echo "Lighthouse would run on deployed URL" |
| 155 | +
|
| 156 | + # LICENSE COMPLIANCE |
| 157 | + license: |
| 158 | + runs-on: ubuntu-latest |
| 159 | + steps: |
| 160 | + - uses: actions/checkout@v4 |
| 161 | + - name: Check license files |
| 162 | + run: | |
| 163 | + if [ -f "LICENSE" ] || [ -f "LICENSE.txt" ] || [ -f "LICENSE.md" ]; then |
| 164 | + echo "✅ License file present" |
| 165 | + head -5 LICENSE* 2>/dev/null |
| 166 | + else |
| 167 | + echo "::warning::No LICENSE file" |
| 168 | + fi |
| 169 | + - name: Check SPDX headers |
| 170 | + run: | |
| 171 | + SPDX=$(grep -rE "SPDX-License-Identifier" . 2>/dev/null | wc -l || echo "0") |
| 172 | + echo "Files with SPDX headers: $SPDX" |
| 173 | +
|
| 174 | + # DOCUMENTATION QUALITY |
| 175 | + documentation: |
| 176 | + runs-on: ubuntu-latest |
| 177 | + steps: |
| 178 | + - uses: actions/checkout@v4 |
| 179 | + - name: Check docs completeness |
| 180 | + run: | |
| 181 | + DOCS="" |
| 182 | + [ -f "README.md" ] || [ -f "README.adoc" ] && DOCS="$DOCS README" |
| 183 | + [ -f "CONTRIBUTING.md" ] || [ -f "CONTRIBUTING.adoc" ] && DOCS="$DOCS CONTRIBUTING" |
| 184 | + [ -f "CHANGELOG.md" ] && DOCS="$DOCS CHANGELOG" |
| 185 | + [ -f "SECURITY.md" ] && DOCS="$DOCS SECURITY" |
| 186 | + [ -d "docs" ] && DOCS="$DOCS docs/" |
| 187 | + echo "Documentation:$DOCS" |
| 188 | + - name: Check code comments |
| 189 | + run: | |
| 190 | + COMMENTS=$(grep -rE "^[[:space:]]*(//|#|/\*)" --include="*.rs" --include="*.res" --include="*.py" . 2>/dev/null | wc -l || echo "0") |
| 191 | + echo "Comment lines: $COMMENTS" |
0 commit comments