super-productivity/.github
Johannes Millan e72aa77336
Add Electron packaging smoke test to catch missing dependencies (#7336)
* ci(electron): verify packaged app.asar and smoke-test launch

Adds coverage for the gap that let #7320 ship: CI built electron TS
and ran electron-builder on release, but never exercised the packaged
binary. A stray relative import reaching out of electron/** was
compiled by tsc into src/app/util/*.js, fell outside the files glob
in electron-builder.yaml, and was missing from app.asar — the main
process crashed on launch for every 18.2.7 user.

Two new checks, both running on ubuntu-latest:

1. tools/verify-electron-requires.js extracts app.asar and re-resolves
   every relative require() under electron/** against the packaged
   tree. Runs on every PR that touches electron/**, electron-builder
   config, package.json, or the workflow itself. ~10s after the build.

2. A launch-under-xvfb smoke test starts the packaged binary, waits
   30s for a crash, and greps stderr for 'Cannot find module' /
   'Uncaught Exception'. Runs on push to master, release tags, and
   manual dispatch (not every PR — needs xvfb setup + idle wait).

Exposed as npm run electron:verify-asar for local use after dist.

* ci(electron): harden smoke workflow and verify script from review

Review feedback on the previous commit surfaced a handful of real
defects. Addressed here:

verify-electron-requires.js
- Guard resolved paths against escaping the extracted asar tree.
  Without this, a relative require with enough `..` climbs above the
  temp dir and Node's resolver hits the host filesystem, masking a
  genuinely missing module behind a stray file on the CI runner.
- Walk .cjs and .mjs files too. electron/simple-store.test.cjs ships
  via the `electron/**/*` glob and was being skipped.
- Move cleanup out of the path where `process.exit(1)` runs inside a
  `try/finally` (synchronous exit does not guarantee `finally`), so
  the temp dir is reliably removed.
- Code comment noting that esbuild-bundled preload.js is opaque to
  this walker — that coverage comes from the launch smoke test.

electron-smoke.yml
- Broaden pull_request paths filter. The previous filter only matched
  electron/**, which is exactly the wrong answer: #7320's root cause
  was a file under src/app/util/ that electron/ imported. Now uses a
  negative list — docs, translations, android/, ios/, other workflows.
- Explicit Xvfb screen geometry (`-screen 0 1280x720x24`) and
  `--disable-dev-shm-usage` on the Electron side. Both known CI
  flake preventers.
- Expanded crash-marker regex: SIGSEGV, Segmentation fault,
  TypeError:, ReferenceError:, FATAL ERROR, Check failed. Also scan
  the log during the liveness loop, not just at the end — catches
  main-process exceptions that get logged without killing the
  process.
- Move the launch log under .tmp/smoke/ so upload-artifact@v7 reliably
  finds it on failure; /tmp paths are fragile across runner images.
- Sweep stray electron worker processes on teardown via pkill.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-23 21:53:28 +02:00
..
actions/setup-e2e ci(workflows): use node 22 for npm install jobs 2026-02-25 19:14:11 +01:00
annotations docs(wiki): initial revision (v0.1) 2026-01-20 03:04:08 -08:00
ISSUE_TEMPLATE docs/wiki content v0.8 (#7068) 2026-04-01 12:40:28 +02:00
workflows Add Electron packaging smoke test to catch missing dependencies (#7336) 2026-04-23 21:53:28 +02:00
CODE_OF_CONDUCT.md docs: add code of conduct 2021-09-20 13:04:44 +02:00
CODEOWNERS security: add CODEOWNERS, enhance Dependabot, document manual setup 2026-01-21 14:30:24 +01:00
CONTRIBUTING.md docs/wiki content v0.8 (#7068) 2026-04-01 12:40:28 +02:00
dependabot.yml chore(deps): allow major version updates for softprops/action-gh-release 2026-03-30 22:53:42 +02:00
FUNDING.yml Create FUNDING.yml 2020-05-05 12:34:24 +02:00
PULL_REQUEST_TEMPLATE.md docs/wiki content v0.8 (#7068) 2026-04-01 12:40:28 +02:00
SECURITY-SETUP.md security: add CODEOWNERS, enhance Dependabot, document manual setup 2026-01-21 14:30:24 +01:00