mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-18 21:54:26 +01:00
Add full gate, nightly timer, 8 shards
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWZB8QEaFVQoa8CjuAw
This commit is contained in:
parent
100b0c9663
commit
f79d425d3d
@ -316,7 +316,7 @@ repos:
|
||||
files: '^stronglift_replacement/workout_app/.*\.(dart|yaml)$'
|
||||
pass_filenames: false
|
||||
- id: flutter-test-coverage-shard-0
|
||||
name: flutter test bucket 0/4 (workout app, local gate)
|
||||
name: flutter test bucket 0/8 (workout app, local gate)
|
||||
entry: bash scripts/check_flutter_coverage.sh --gate-shard 0
|
||||
language: system
|
||||
pass_filenames: false
|
||||
@ -324,7 +324,7 @@ repos:
|
||||
require_serial: true
|
||||
stages: [manual]
|
||||
- id: flutter-test-coverage-shard-1
|
||||
name: flutter test bucket 1/4 (workout app, local gate)
|
||||
name: flutter test bucket 1/8 (workout app, local gate)
|
||||
entry: bash scripts/check_flutter_coverage.sh --gate-shard 1
|
||||
language: system
|
||||
pass_filenames: false
|
||||
@ -332,7 +332,7 @@ repos:
|
||||
require_serial: true
|
||||
stages: [manual]
|
||||
- id: flutter-test-coverage-shard-2
|
||||
name: flutter test bucket 2/4 (workout app, local gate)
|
||||
name: flutter test bucket 2/8 (workout app, local gate)
|
||||
entry: bash scripts/check_flutter_coverage.sh --gate-shard 2
|
||||
language: system
|
||||
pass_filenames: false
|
||||
@ -340,17 +340,49 @@ repos:
|
||||
require_serial: true
|
||||
stages: [manual]
|
||||
- id: flutter-test-coverage-shard-3
|
||||
name: flutter test bucket 3/4 (workout app, local gate)
|
||||
name: flutter test bucket 3/8 (workout app, local gate)
|
||||
entry: bash scripts/check_flutter_coverage.sh --gate-shard 3
|
||||
language: system
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
require_serial: true
|
||||
stages: [manual]
|
||||
- id: flutter-test-coverage-shard-4
|
||||
name: flutter test bucket 4/8 (workout app, local gate)
|
||||
entry: bash scripts/check_flutter_coverage.sh --gate-shard 4
|
||||
language: system
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
require_serial: true
|
||||
stages: [manual]
|
||||
- id: flutter-test-coverage-shard-5
|
||||
name: flutter test bucket 5/8 (workout app, local gate)
|
||||
entry: bash scripts/check_flutter_coverage.sh --gate-shard 5
|
||||
language: system
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
require_serial: true
|
||||
stages: [manual]
|
||||
- id: flutter-test-coverage-shard-6
|
||||
name: flutter test bucket 6/8 (workout app, local gate)
|
||||
entry: bash scripts/check_flutter_coverage.sh --gate-shard 6
|
||||
language: system
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
require_serial: true
|
||||
stages: [manual]
|
||||
- id: flutter-test-coverage-shard-7
|
||||
name: flutter test bucket 7/8 (workout app, local gate)
|
||||
entry: bash scripts/check_flutter_coverage.sh --gate-shard 7
|
||||
language: system
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
require_serial: true
|
||||
stages: [manual]
|
||||
# Fails unless every shard above passed on THIS tree, then applies the
|
||||
# unchanged 100% bar and every-lib-file guard to their union.
|
||||
- id: flutter-test-coverage-merge
|
||||
name: flutter coverage 100% (union of the 4 buckets)
|
||||
name: flutter coverage 100% (union of the 8 buckets)
|
||||
entry: bash scripts/check_flutter_coverage.sh --gate-merge
|
||||
language: system
|
||||
pass_filenames: false
|
||||
|
||||
14
full-gate.service
Normal file
14
full-gate.service
Normal file
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=screen-locker full test suite (writes the green/red full stamp that gates pushes)
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
# %h = kuhy's home. nightly_full_gate.sh skips under load and on a dirty tree.
|
||||
ExecStart=/bin/bash %h/src/screen-locker/scripts/nightly_full_gate.sh
|
||||
# Each hook step is <60 s on its own; the whole run gets its own generous cap.
|
||||
TimeoutStartSec=45min
|
||||
Nice=19
|
||||
IOSchedulingClass=idle
|
||||
CPUQuota=20%
|
||||
MemoryMax=4G
|
||||
Environment=FLUTTER_TEST_CONCURRENCY=2
|
||||
14
full-gate.timer
Normal file
14
full-gate.timer
Normal file
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Nightly screen-locker full suite at 22:00
|
||||
# No After=graphical-session.target: it would close an ordering cycle with
|
||||
# timers.target and systemd would delete this timer's job (see
|
||||
# early-bird-workout-check.timer, 2026-08-04).
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* 22:00:00
|
||||
# Persistent stamps on elapse, not on success; a night skipped by the load
|
||||
# guard is simply skipped. The PC is off from 23:00, so no catch-up is wanted.
|
||||
Persistent=false
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
@ -42,7 +42,7 @@ APP_DIR="stronglift_replacement/workout_app"
|
||||
LCOV_INFO="$APP_DIR/coverage/lcov.info"
|
||||
# Number of local-gate buckets; must equal the flutter-test-coverage-shard-*
|
||||
# hooks in .pre-commit-config.yaml (the merge counts them, see below).
|
||||
GATE_SHARDS=4
|
||||
GATE_SHARDS=8
|
||||
|
||||
die() {
|
||||
echo "ERROR: $*" >&2
|
||||
|
||||
53
scripts/full_gate.sh
Executable file
53
scripts/full_gate.sh
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ============================================================================
|
||||
# The FULL suite, outside the push path: every manual-stage hook of
|
||||
# .pre-commit-config.yaml as its own <60 s step (gate_stamp.sh step <id>), then
|
||||
# a green or red verdict in $GIT_DIR:
|
||||
# gate-full-green commit the full suite passed on (push gate's base)
|
||||
# gate-full-status "green <commit> <time>" or "red <hook-id> <commit> <time>"
|
||||
# A red status makes scripts/push_gate.sh refuse every push until a full run
|
||||
# is green again. The stamp itself is written by gate_stamp.sh once every
|
||||
# step passed, as before.
|
||||
#
|
||||
# full_gate.sh list hook ids, one per line
|
||||
# full_gate.sh step <id> one step (interactive use: one call each)
|
||||
# full_gate.sh all every step in order, stops at the first red
|
||||
# (the nightly timer's entry point)
|
||||
# ============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
gitdir="$(git rev-parse --git-dir)"
|
||||
readonly GATE="bash scripts/check_gate_stamp.sh"
|
||||
|
||||
record() { # verdict words...
|
||||
printf '%s %s\n' "$*" "$(date -Is)" > "$gitdir/gate-full-status"
|
||||
}
|
||||
|
||||
run_step() {
|
||||
local id="$1" head
|
||||
head="$(git rev-parse HEAD)"
|
||||
if $GATE step "$id"; then
|
||||
# The last passing step stamps the tree: that is a full green.
|
||||
if bash "${GATE_SHARED:-$HOME/src/utils/scripts/gate_stamp.sh}" check >/dev/null 2>&1; then
|
||||
printf '%s\n' "$head" > "$gitdir/gate-full-green"
|
||||
record green "$head"
|
||||
echo "full-gate: GREEN on ${head:0:10}"
|
||||
fi
|
||||
else
|
||||
record red "$id" "$head"
|
||||
echo "full-gate: RED at '$id' on ${head:0:10}; pushes are refused until green" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
list) $GATE full --list ;;
|
||||
step) run_step "${2:?usage: full_gate.sh step <hook-id>}" ;;
|
||||
all)
|
||||
while IFS= read -r id; do run_step "$id"; done < <($GATE full --list)
|
||||
;;
|
||||
*) echo "usage: full_gate.sh list | step <id> | all" >&2; exit 2 ;;
|
||||
esac
|
||||
28
scripts/nightly_full_gate.sh
Executable file
28
scripts/nightly_full_gate.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ============================================================================
|
||||
# Nightly entry point (full-gate.timer, 22:00): run the full suite on a clean
|
||||
# detached checkout of main in a throwaway worktree, unless the machine is
|
||||
# busy. A red result lands in the repo's $GIT_DIR/gate-full-status, which
|
||||
# refuses the next push (scripts/push_gate.sh).
|
||||
# Loadavg guard: skip (exit 0, logged) when the 5-min load exceeds MAX_LOAD.
|
||||
# ============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
readonly REPO="${SCREEN_LOCKER_REPO:-$HOME/src/screen-locker}"
|
||||
readonly MAX_LOAD="${GATE_MAX_LOAD:-6}"
|
||||
|
||||
read -r _ load5 _ < /proc/loadavg
|
||||
if awk -v l="$load5" -v m="$MAX_LOAD" 'BEGIN { exit !(l > m) }'; then
|
||||
echo "nightly-full-gate: load5=$load5 > $MAX_LOAD, skipped tonight" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cd "$REPO"
|
||||
# The verdict files live in the main repo's git dir; the suite runs on HEAD.
|
||||
if [[ -n "$(git status --porcelain --untracked-files=no)" ]]; then
|
||||
echo "nightly-full-gate: working tree dirty, skipped (the gate stamps HEAD only)" >&2
|
||||
exit 0
|
||||
fi
|
||||
exec bash scripts/full_gate.sh all
|
||||
Loading…
Reference in New Issue
Block a user