storebound/.forgejo/workflows/ci.yml
CRT 36a8bf9625 CLI runs on Node 20+: npx storebound (bunx keeps working)
- cli/lib/rt.ts: the runtime layer on node: modules (spawn / spawnSync with Bun's defaults, exit codes and
  "Executable not found", which with PATHEXT, sleep, serve, Glob, hasher, gunzip, stdin, SQLite, packageRoot,
  config imports with a type-stripping fallback for Node 20); every Bun.* use in cli/ goes through it
- tools/gen-embedded.ts -> cli/lib/embedded.ts: templates/, cli/shots/*.html and Play's Data safety form embedded
  (replaces Bun text imports; the bundle and the compiled sidecar carry them), checked fresh by bun run ci
- package.json: bin dist/storebound.mjs (Node ESM bundle, tools/build-node.ts, prepack), engines node >=20
- bun run ci: node bundle + node smoke (real node: --version, help, check same as Bun, scan, release plan --help,
  init, MCP handshake + tool call); Forgejo CI sets up Node 20; tests/node-compat.test.ts guards cli/
- install writes npx MCP commands when run with Node; bin/storebound falls back to Node
- docs: npx storebound init (Node 20+) or bunx storebound init
2026-10-13 04:03:28 +08:00

83 lines
4 KiB
YAML

# bun run ci on every push to main and every pull request into main: adapters, desktop version, tests, typecheck,
# desktop i18n / typecheck / build, desktop boot check (headless Chromium), desktop Rust tests and clippy, scrub. Runs on the VDS runner (docs/desktop-release.md).
# tools/ci.ts runs the steps as a task graph and the tests as parallel shards (CPU cores - 1, max 8) on the one
# self-hosted runner, so a job matrix would only queue; CI=full makes it run the Rust steps on every push.
# Publishes nothing: site/ is still published by Jenkins.
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
BUN_VERSION: '1.4.0'
CARGO_TERM_COLOR: never
CARGO_INCREMENTAL: '0'
CI: full
jobs:
ci:
# runner label: ubuntu-22.04:docker://ghcr.io/catthehacker/ubuntu:act-22.04
runs-on: ubuntu-22.04
# the self-hosted runner only runs code from this repo: pull requests from forks are skipped
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: System packages (Tauri on Linux)
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq --no-install-recommends libwebkit2gtk-4.1-dev libgtk-3-dev \
libayatana-appindicator3-dev librsvg2-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libssl-dev libxdo-dev \
build-essential curl unzip pkg-config >/dev/null
- uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
apps/desktop/src-tauri/target
key: ci-${{ runner.os }}-${{ hashFiles('bun.lock', 'apps/desktop/src-tauri/Cargo.lock') }}
restore-keys: ci-${{ runner.os }}-
# recorded test durations (shard balance) and tsc's incremental build info
- uses: actions/cache@v4
with:
path: node_modules/.cache/storebound-ci
key: ci-timings-${{ runner.os }}-${{ github.sha }}
restore-keys: ci-timings-${{ runner.os }}-
- name: Bun and Rust
run: |
P="${FORGEJO_PATH:-$GITHUB_PATH}"
curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}" >/dev/null
echo "$HOME/.bun/bin" >> "$P"
command -v rustup || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --component clippy
echo "$HOME/.cargo/bin" >> "$P"
- name: Install
run: |
rustup component add clippy
bun --version && cargo --version
bun install --frozen-lockfile
# Playwright's Chromium and headless shell (~280 MB), keyed by the browser builds the installed playwright-core
# wants (its browsers.json); the system libraries and fonts (--with-deps) are installed on every run, the job
# container starts clean
- uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('node_modules/playwright-core/browsers.json') }}
restore-keys: playwright-${{ runner.os }}-
# the job runs as root in a container: storebound adds --no-sandbox to the Chromium it starts itself there
# (cli/shots/browser.ts sandboxArgs), Playwright's own launches already pass it
- name: Headless Chromium (browser tests, desktop boot check)
run: bunx playwright install --with-deps chromium
# the npm bundle runs on Node 20+: tools/ci.ts smoke-tests dist/storebound.mjs with the oldest supported Node
- uses: actions/setup-node@v4
with:
node-version: '20'
# the runner sets CI=true in the job and it wins over the workflow env above: set CI=full for the command
# itself, or tools/ci.ts skips the desktop Rust tests and clippy when the push did not touch src-tauri
- name: bun run ci
run: CI=full bun run ci