screentinker/.github/workflows/ci.yml
ScreenTinker 2ccf3264a9
Some checks are pending
CI / Unit tests (node --test) (push) Waiting to run
CI / Android unit tests (Kotlin schedule evaluator vectors) (push) Waiting to run
CI / Boot smoke + version check (push) Waiting to run
feat(scheduling): per-item schedule blocks (#74 dayparting, #75 auto-expire)
Each playlist item can carry schedule blocks (active days, start/end
time-of-day, optional start/end dates). An item plays when the screen's
local "now" matches at least one block; an item with no blocks always
plays. #74 covers time-of-day/day-of-week windows including overnight
wrap; #75 covers inclusive date ranges (auto-expiry). Evaluation is
on-device, so dayparting and expiry work offline.

- Shared evaluator contract: shared/schedule-vectors.json (39 vectors —
  DST US+AU, overnight-wrap anchoring, timezone correctness, date
  boundaries). Canonical JS evaluator in server/lib/schedule-eval.js;
  Kotlin and Tizen ports kept in lockstep by drift guards (Tizen byte-diff
  test, Kotlin JUnit reads the shared JSON, new android-test CI job).
- All three players (web, Android, Tizen) filter by schedule against their
  own clock, idle with a "Nothing scheduled" message + 30s re-check when
  everything is filtered, and fail open on any evaluator error.
- Editor: per-item schedule modal + row badge in the playlist editor;
  client validation mirrors the server; editing marks the playlist draft.
- Part B (behaviour change): device/group schedule overrides now evaluate
  in each device's effective timezone instead of server-local time.
- Device detail shows the reported timezone + a clock-skew warning.
- i18n for en/es/fr/de/pt across all new strings (namespaced itemsched.*
  to avoid colliding with the device-schedule calendar's schedule.*).
- CHANGELOG documents the feature, the Part B change, the fail-open
  guarantee, and the scheduled-single-video re-render tradeoff.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 15:46:41 -05:00

106 lines
3.4 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
# main gets frequent pushes - cancel an in-flight run when a newer commit
# (or rerun) supersedes it, per ref.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Unit tests (node --test)
runs-on: ubuntu-latest
defaults:
run:
working-directory: server
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '20'
cache: npm
cache-dependency-path: server/package-lock.json
- run: npm ci
- run: npm test
android-test:
name: Android unit tests (Kotlin schedule evaluator vectors)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- uses: android-actions/setup-android@v3
# ScheduleEvalTest reads the SHARED shared/schedule-vectors.json (wired via
# the test task in app/build.gradle.kts), so a ScheduleEval.kt change that
# breaks the contract fails here.
- name: Kotlin evaluator vector conformance
working-directory: android
run: ./gradlew :app:testDebugUnitTest --no-daemon
smoke:
name: Boot smoke + version check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '20'
cache: npm
cache-dependency-path: server/package-lock.json
- name: Install deps
working-directory: server
run: npm ci
# Boot against a fresh SQLite db (clean checkout = no db yet). SELF_HOSTED
# makes the first user an admin with no billing. No certs present, so the
# server listens on plain HTTP at :3001. Background it and wait until it
# answers.
- name: Boot server
working-directory: server
env:
SELF_HOSTED: 'true'
run: |
node server.js > "$RUNNER_TEMP/server.log" 2>&1 &
echo $! > "$RUNNER_TEMP/server.pid"
for i in $(seq 1 30); do
curl -sf http://localhost:3001/api/status >/dev/null && exit 0
sleep 1
done
echo "server did not come up within 30s:"; cat "$RUNNER_TEMP/server.log"; exit 1
# Assert the public status endpoint is healthy and reports exactly the
# VERSION file - this is what proves the single-source-of-truth wiring.
- name: Assert /api/status ok and version matches VERSION
run: |
STATUS="$(curl -sf http://localhost:3001/api/status)"
echo "status: $STATUS"
EXPECTED="$(cat VERSION)"
REPORTED="$(echo "$STATUS" | jq -r .version)"
echo "VERSION file: $EXPECTED reported: $REPORTED"
test "$(echo "$STATUS" | jq -r .status)" = "ok"
test "$REPORTED" = "$EXPECTED"
echo "OK: status ok, version $REPORTED matches VERSION"
- name: Stop server
if: always()
run: kill "$(cat "$RUNNER_TEMP/server.pid")" 2>/dev/null || true
# TODO (deferred - needs a tag earlier than HEAD, so meaningful from v1.8.0 on):
# upgrade-path job. Restore a db created by the previous tagged release, boot
# the current code against it, and assert migrations complete and /api/status
# is healthy. Add once a prior release tag exists.