Files
feuerwerk/.gitea/workflows/ci.yml
T
adminandClaude Opus 5.5 94749b4f3e
game-maker / gate (push) Successful in 3m6s
game-maker / suite (push) Successful in 9m38s
Let a project keep named snapshots and restore them (#231)
Autosave only keeps the latest revision. Before a risky change there
was no way to put a known good state aside and go back to it later.
The main menu now has "Snapshots..." to create, restore and delete
named copies of the open project.

- Server: SnapshotStore.php keeps each snapshot as a copy of the
  project JSON under data/snapshots/<project>/ (git-ignored). Four
  routes under projects/{id}/snapshots use the same owner check as the
  project, so an admin also sees foreign snapshots.
- Create writes the autosave first. With unsaved edits (play with open
  edits, failed save, conflict) no snapshot is made and a message says
  why. The rule is the pure function in src/editor/snapshots.ts.
- An empty name falls back to the local date and time.
- Restore asks first, then keeps the current state as "Before
  restoring <name>". It writes the snapshot back as a new revision and
  reloads the project, so the undo list is empty. A restore can itself
  be undone by restoring that snapshot.
- Deleting a project deletes its snapshots too. Images, sounds, fonts
  and pixel art are content-addressed and never deleted, so a snapshot
  can always reach them.
- Client: SnapshotStore and HttpSnapshotStore in src/core/store, the
  SnapshotsDialog, and the flows in ProjectSession. A stale revision
  (409) becomes StaleRevisionError.
- CI runs the new PHP test in the gate job next to accounts.

Not covered by e2e: the lock during play and the conflict case. Both
are unit tests only.

Tests:
- check.sh: 164 files, 2401 tests, CHECK EXIT 0.
- tests/php/snapshots.test.php: 14 checks, all passed.
- tests/editor/snapshots.test.ts: 5 tests for the time format, the
  blocker rule, the routes and 409.
- New e2e module 50 on a throwaway project: create, rename, restore,
  undo the restore, delete, then delete the project and get 404 on
  its snapshots. 46b expects the new menu entry. e2e 46,50: 20 checks
  passed. The check sum goes from 1385 to 1393 (computed).
- Counter-checks, originals restored and compared with cmp: blocker
  always allowed fails 1 unit test. No sorting fails 2 PHP checks.
  Restore without keeping the old state fails 50c and aborts 50d.
- The first sort test with 2 snapshots passed by chance half the time
  because of random ids. It now uses 8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 18:21:52 +02:00

66 lines
2.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Runs the whole proof on the Gitea runner: gate, the editor suite and the three example games.
#
# `runs-on: game-maker-ci` picks the image built from tools/ci/Dockerfile. The render device and
# /dev/shm come from the runner's own container.options (/_stacks/git/runner/config.yaml), not
# from here – without them chromium falls back to software WebGL.
#
# Two jobs without `needs:`, so they start together and use both slots of the runner
# (`capacity: 2`, four cores). The gate no longer stands in front of the suite: a lint error used
# to cost the full e2e run before it was reported, and the run reported it after six minutes
# instead of one. Both still have to pass for the push to be green.
#
# The price is contention: while the gate runs, vitest and chromium share the four cores, and the
# suite measures text widths and frame counts. That is why the gate caps vitest at two workers
# (GM_TEST_WORKERS) – two cores stay free for the browser for the whole overlap.
name: game-maker
on:
push:
workflow_dispatch:
jobs:
gate:
runs-on: game-maker-ci
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Install
run: npm ci --no-audit --no-fund
- name: Gate
run: ./check.sh
env:
GM_TEST_WORKERS: 2
# The API's own rules (#180, #179, #231). Not part of check.sh: the host the editor is built
# on has no PHP, the image does.
- name: PHP tests
run: |
php tests/php/accounts.test.php
php tests/php/snapshots.test.php
suite:
runs-on: game-maker-ci
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Versions
run: |
node --version
chromium --version
php --version | head -1
- name: Install
run: npm ci --no-audit --no-fund
- name: Build
run: npm run build
- name: Editor suite
run: tools/ci/run-e2e.sh
- name: Example games
run: tools/ci/run-smokes.sh