|
| 1 | +name: Quality Gates |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + static-checks: |
| 11 | + name: Static Analysis |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Verify set -o pipefail in all bin scripts |
| 17 | + run: | |
| 18 | + failed=0 |
| 19 | + for script in bin/git-issue-*; do |
| 20 | + # Skip the sourced library (not executed directly) |
| 21 | + case "$script" in |
| 22 | + *git-issue-lib) continue ;; |
| 23 | + esac |
| 24 | + if ! grep -q 'set -o pipefail' "$script"; then |
| 25 | + echo "FAIL: $script missing 'set -o pipefail'" |
| 26 | + failed=1 |
| 27 | + fi |
| 28 | + done |
| 29 | + # Also check the main dispatcher |
| 30 | + if ! grep -q 'set -o pipefail' bin/git-issue; then |
| 31 | + echo "FAIL: bin/git-issue missing 'set -o pipefail'" |
| 32 | + failed=1 |
| 33 | + fi |
| 34 | + if [ "$failed" -eq 1 ]; then |
| 35 | + echo "::error::One or more scripts missing set -o pipefail" |
| 36 | + exit 1 |
| 37 | + fi |
| 38 | + echo "All scripts have set -o pipefail" |
| 39 | +
|
| 40 | + - name: Verify set -e in all bin scripts |
| 41 | + run: | |
| 42 | + failed=0 |
| 43 | + for script in bin/git-issue bin/git-issue-*; do |
| 44 | + case "$script" in |
| 45 | + *git-issue-lib) continue ;; |
| 46 | + esac |
| 47 | + if ! grep -q 'set -e' "$script"; then |
| 48 | + echo "FAIL: $script missing 'set -e'" |
| 49 | + failed=1 |
| 50 | + fi |
| 51 | + done |
| 52 | + if [ "$failed" -eq 1 ]; then |
| 53 | + echo "::error::One or more scripts missing set -e" |
| 54 | + exit 1 |
| 55 | + fi |
| 56 | + echo "All scripts have set -e" |
| 57 | +
|
| 58 | + test-core: |
| 59 | + name: Core Tests |
| 60 | + runs-on: ubuntu-latest |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@v4 |
| 63 | + |
| 64 | + - name: Configure git identity |
| 65 | + run: | |
| 66 | + git config --global user.name "CI Test" |
| 67 | + git config --global user.email "ci@test.local" |
| 68 | +
|
| 69 | + - name: Run core test suite |
| 70 | + run: sh t/test-issue.sh |
| 71 | + |
| 72 | + test-failure-modes: |
| 73 | + name: Failure Mode Tests |
| 74 | + runs-on: ubuntu-latest |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v4 |
| 77 | + |
| 78 | + - name: Configure git identity |
| 79 | + run: | |
| 80 | + git config --global user.name "CI Test" |
| 81 | + git config --global user.email "ci@test.local" |
| 82 | +
|
| 83 | + - name: Run failure mode tests |
| 84 | + run: sh t/test-failure-modes.sh |
| 85 | + |
| 86 | + test-environment: |
| 87 | + name: Environment Tests |
| 88 | + runs-on: ubuntu-latest |
| 89 | + steps: |
| 90 | + - uses: actions/checkout@v4 |
| 91 | + |
| 92 | + - name: Configure git identity |
| 93 | + run: | |
| 94 | + git config --global user.name "CI Test" |
| 95 | + git config --global user.email "ci@test.local" |
| 96 | +
|
| 97 | + - name: Run environment tests |
| 98 | + run: sh t/test-environment.sh |
| 99 | + |
| 100 | + test-properties: |
| 101 | + name: Property Tests |
| 102 | + runs-on: ubuntu-latest |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@v4 |
| 105 | + |
| 106 | + - name: Configure git identity |
| 107 | + run: | |
| 108 | + git config --global user.name "CI Test" |
| 109 | + git config --global user.email "ci@test.local" |
| 110 | +
|
| 111 | + - name: Run property-based tests |
| 112 | + run: sh t/test-properties.sh |
| 113 | + |
| 114 | + test-validation: |
| 115 | + name: Validation Tests |
| 116 | + runs-on: ubuntu-latest |
| 117 | + steps: |
| 118 | + - uses: actions/checkout@v4 |
| 119 | + |
| 120 | + - name: Configure git identity |
| 121 | + run: | |
| 122 | + git config --global user.name "CI Test" |
| 123 | + git config --global user.email "ci@test.local" |
| 124 | +
|
| 125 | + - name: Run label validation tests |
| 126 | + run: sh t/test-labels-validation.sh |
| 127 | + |
| 128 | + - name: Run assignee validation tests |
| 129 | + run: sh t/test-assignee-validation.sh |
| 130 | + |
| 131 | + - name: Run concurrency tests |
| 132 | + run: sh t/test-concurrency.sh |
| 133 | + |
| 134 | + quality-gate: |
| 135 | + name: Quality Gate |
| 136 | + needs: |
| 137 | + - static-checks |
| 138 | + - test-core |
| 139 | + - test-failure-modes |
| 140 | + - test-environment |
| 141 | + - test-properties |
| 142 | + - test-validation |
| 143 | + runs-on: ubuntu-latest |
| 144 | + if: always() |
| 145 | + steps: |
| 146 | + - name: Check all gates passed |
| 147 | + run: | |
| 148 | + echo "== Quality Gate Results ==" |
| 149 | + results="${{ needs.static-checks.result }},${{ needs.test-core.result }},${{ needs.test-failure-modes.result }},${{ needs.test-environment.result }},${{ needs.test-properties.result }},${{ needs.test-validation.result }}" |
| 150 | + echo "static-checks: ${{ needs.static-checks.result }}" |
| 151 | + echo "test-core: ${{ needs.test-core.result }}" |
| 152 | + echo "test-failure-modes: ${{ needs.test-failure-modes.result }}" |
| 153 | + echo "test-environment: ${{ needs.test-environment.result }}" |
| 154 | + echo "test-properties: ${{ needs.test-properties.result }}" |
| 155 | + echo "test-validation: ${{ needs.test-validation.result }}" |
| 156 | + echo "=========================" |
| 157 | + failed=0 |
| 158 | + for result in $(echo "$results" | tr ',' ' '); do |
| 159 | + if [ "$result" != "success" ]; then |
| 160 | + failed=1 |
| 161 | + fi |
| 162 | + done |
| 163 | + if [ "$failed" -eq 1 ]; then |
| 164 | + echo "::error::Quality gate FAILED - one or more checks did not pass" |
| 165 | + exit 1 |
| 166 | + fi |
| 167 | + echo "All quality gates passed" |
0 commit comments