Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions .github/workflows/check.yml

This file was deleted.

92 changes: 92 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: CI

on:
push:
branches: [cloudflare-workers, main]
pull_request:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

# Target: the whole workflow finishes in under 2 minutes. The three jobs run in parallel and every
# one of them restores the pnpm store (and, for e2e, the Playwright browsers and the build) from cache.
jobs:
typecheck:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile --prefer-offline
- run: npx tsc --noEmit -p .

integration:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile --prefer-offline
# Real D1 (workerd) with the production migrations: authorization, balances, expenses, recurrence.
- run: pnpm test:integration

e2e:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile --prefer-offline

- name: Resolve Playwright version
id: pw
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"
- name: Cache Playwright browsers
id: pw-cache
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}
- name: Install Chromium
run: |
if [ "${{ steps.pw-cache.outputs.cache-hit }}" = "true" ]; then
npx playwright install-deps chromium
else
npx playwright install --with-deps chromium
fi

- name: Cache the production build
id: build-cache
uses: actions/cache@v4
with:
path: dist
key: build-${{ runner.os }}-${{ hashFiles('src/**', 'worker/**', 'public/**', 'migrations/**', 'package.json', 'pnpm-lock.yaml', 'vite*.ts', 'next.config.js', 'wrangler.example.jsonc', 'tsconfig.json') }}
- name: Build
if: steps.build-cache.outputs.cache-hit != 'true'
run: |
cp wrangler.example.jsonc wrangler.jsonc
SKIP_ENV_VALIDATION=1 pnpm build

- run: pnpm test:e2e
env:
CI: '1'
- name: Upload Playwright traces on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-traces
path: test-results
retention-days: 3
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@ dist/

# Personal Cloudflare deployment config (copy wrangler.example.jsonc to wrangler.jsonc)
wrangler.jsonc

# e2e artifacts
.e2e-state
.e2e-seed.sql
test-results
playwright-report
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,26 @@ run `npx wrangler d1 migrations apply splitpro --local`, then `npx wrangler dev

## Known gaps

- No unit or end-to-end tests. The upstream Jest tests were mocked for Prisma, so they are excluded from
the TypeScript build and do not run.
- Test coverage is small and focused on the riskiest paths (see below). There are no unit or component tests.
- Plaid / GoCardless bank sync and the Splitwise import are untested on Workers.
- Only Google sign-in is wired up. There is no email or password login.
- `drizzle-kit` and `wrangler d1 migrations` own the schema. `migrations/0001_balance_view_and_triggers.sql`
is hand-written (the `BalanceView` view and a trigger). Back it up before regenerating migrations.

## Tests

```sh
pnpm test:integration # Vitest in workerd with a real local D1 and the production migrations
pnpm build && pnpm test:e2e # Playwright against the built Worker (wrangler dev), 4 parallel workers
```

- `src/tests/integration`: authorization, balances and simplification, expense create/edit/delete
atomicity, settlements, recurring expenses (including idempotent retries), and regression tests
for D1 query bugs.
- `tests/e2e`: sign-in redirect, signed-in session, groups, expenses, settle up, a stranger being
blocked, and recurring expenses, all against the production bundle. Google sign-in cannot be
automated, so the tests seed users and signed `better-auth` session cookies in a throwaway D1.
- CI (`.github/workflows/ci.yml`) runs typecheck, integration, and e2e as three parallel jobs with
the pnpm store, Playwright browsers, and the build cached. The target is under 2 minutes.

Bug reports for this fork go to this repository's issues. Please do not report them upstream.
214 changes: 0 additions & 214 deletions jest.config.ts

This file was deleted.

Loading
Loading