@@ -147,3 +147,82 @@ jobs:
147147 run : bash scripts/setup-recheck.sh lean
148148 - name : Check the Lean leg (no axioms)
149149 run : bash scripts/check-recheck.sh lean
150+
151+ # ==========================================================================
152+ # Required status check "CI/gate" (Branch-Floor ruleset).
153+ # The check context is this job's name. It waits for every other job in this
154+ # workflow and runs even when one fails, is cancelled or is skipped; it exits
155+ # 0 only when every required job succeeded. Pattern:
156+ # hyperpolymath/ordinal-notation proven-tests.yml, job ci-gate.
157+ # ==========================================================================
158+ ci-gate :
159+ name : " CI/gate"
160+ runs-on : ubuntu-24.04
161+ timeout-minutes : 5
162+ permissions : {}
163+ needs : [check, cold-check, experimental, narrowing, cubical, rocq-recheck, lean-recheck]
164+ if : always()
165+ steps :
166+ - name : Require every needed job to have succeeded
167+ env :
168+ NEEDS_JSON : ${{ toJSON(needs) }}
169+ REQUIRED_JOBS : " check cold-check experimental narrowing cubical rocq-recheck lean-recheck"
170+ ADVISORY_JOBS : " "
171+ DESIGNED_SKIPS : " "
172+ run : |
173+ set -euo pipefail
174+ summary="${GITHUB_STEP_SUMMARY:-/dev/null}"
175+ result_of() { local job="$1"; jq -r --arg j "$job" '.[$j].result // "missing"' <<< "$NEEDS_JSON"; }
176+ in_list() { local needle="$1" haystack="$2"; case " $haystack " in *" $needle "*) return 0 ;; esac; return 1; }
177+ detector_of() {
178+ local job="$1" pair
179+ for pair in $DESIGNED_SKIPS; do
180+ if [ "${pair%%:*}" = "$job" ]; then echo "${pair#*:}"; return 0; fi
181+ done
182+ return 1
183+ }
184+ row() { printf '| %s | %s | %s | %s |\n' "$@" | tee -a "$summary"; }
185+ {
186+ echo "### CI/gate"
187+ echo
188+ echo "| job | result | role | verdict |"
189+ echo "|---|---|---|---|"
190+ } | tee -a "$summary"
191+ fail=0
192+ total=0
193+ passed=0
194+ for j in $REQUIRED_JOBS; do
195+ total=$((total + 1))
196+ r=$(result_of "$j")
197+ case "$r" in
198+ success) v="ok"; passed=$((passed + 1)) ;;
199+ skipped)
200+ if d=$(detector_of "$j") && [ "$(result_of "$d")" = "success" ]; then
201+ v="ok (designed skip; detector $d succeeded)"; passed=$((passed + 1))
202+ else
203+ v="FAIL (skipped without a successful detector)"; fail=1
204+ fi ;;
205+ *) v="FAIL (result must be success)"; fail=1 ;;
206+ esac
207+ row "$j" "$r" required "$v"
208+ done
209+ for j in $ADVISORY_JOBS; do
210+ row "$j" "$(result_of "$j")" advisory "not gating"
211+ done
212+ for j in $(jq -r 'keys[]' <<< "$NEEDS_JSON"); do
213+ if ! in_list "$j" "$REQUIRED_JOBS $ADVISORY_JOBS"; then
214+ row "$j" "$(result_of "$j")" unclassified "FAIL (job is in needs but neither required nor advisory)"
215+ fail=1
216+ fi
217+ done
218+ if [ "$total" -eq 0 ]; then
219+ echo "::error::no required jobs configured"
220+ fail=1
221+ fi
222+ msg="required jobs: $total; satisfied: $passed; advisory: $(wc -w <<< "$ADVISORY_JOBS")"
223+ echo "$msg" | tee -a "$summary"
224+ if [ "$fail" -ne 0 ]; then
225+ echo "::error::CI/gate failed ($msg)"
226+ exit 1
227+ fi
228+ echo "CI/gate passed ($msg)"
0 commit comments