mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-18 20:54:35 +01:00
Add gatelock.evening_chain: `pending` lists the unpaid rungs (book, tutor, LeetCode), `run` runs each gate in order before night lockdown. Also RANK_EVENING_GATE = 150, systemd/evening-gates.service and install_evening_gates.sh (never enables or starts the unit). Failure paths: - pending: unreadable ledger or key, reader error, any exception -> exit 2 on stderr. FAIL CLOSED (root enters lockdown). - pending: free day, sick day, 23:00 or later -> exit 1 (stands down). - run: a rung it cannot check is unpaid, its gate stays up (closed). - run: gate fails, or exits 0 with the rung unpaid -> skipped; two in a row -> exit 1, never a spin (stops, root enters lockdown: closed). - run: gate exit 10 -> exit 0; exit 3 (no X) -> exit 3; gate still up at 23:00 is killed -> exit 0 (the hard time wins). - earned_time/freedays/sickdays are an optional `evening` extra, so a locker never fails to start over them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWYGbnVt12uFXKgNYm8
50 lines
1.8 KiB
YAML
50 lines
1.8 KiB
YAML
name: gatelock tests
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
# The workflow's own file counts as gatelock: editing only this file used
|
|
# to trigger nothing, so a fix to the job itself could never prove itself.
|
|
paths: ['gatelock/**', 'earned_time/**', 'freedays/**', 'sickdays/**', '.github/workflows/gatelock-tests.yml']
|
|
pull_request:
|
|
branches: [main]
|
|
paths: ['gatelock/**', 'earned_time/**', 'freedays/**', 'sickdays/**', '.github/workflows/gatelock-tests.yml']
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: gatelock
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.x"
|
|
cache: pip
|
|
cache-dependency-path: gatelock/requirements.txt
|
|
|
|
# The evening chain (gatelock.evening_chain) reads earned_time, freedays
|
|
# and sickdays; they are siblings in this repo, so CI installs the
|
|
# checkout, not a tag.
|
|
- name: Install the sibling packages
|
|
run: >-
|
|
pip install ../crdt-sync ../earned_time
|
|
&& pip install --no-deps ../freedays ../sickdays
|
|
|
|
- name: Install dependencies
|
|
run: pip install -r requirements.txt
|
|
|
|
# The viewport, fit-check and keyboard tests drive real Tk: focus
|
|
# delivery, canvas scrolling and widget heights are Tk's own behaviour,
|
|
# and mocking them is what let a viewport that scrolled itself pass
|
|
# every check for a week. Headless they skip, silently taking coverage
|
|
# with them -- so the runner gets a display instead.
|
|
- name: Install a virtual X display
|
|
run: sudo apt-get update && sudo apt-get install -y xvfb
|
|
|
|
- name: Run tests with coverage
|
|
run: xvfb-run -a -s "-screen 0 1600x1200x24" python -m pytest -v
|