Skip to content

Commit e075309

Browse files
authored
Merge branch 'v2' into v2-straya
2 parents 59530d0 + 9bf4f6c commit e075309

89 files changed

Lines changed: 2444 additions & 1449 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,29 +152,52 @@ jobs:
152152
run: pnpm install --frozen-lockfile && pnpm build
153153

154154
- name: Install temporal_ts dependencies & build
155-
run: cd temporal_ts && npm install && npm run build
155+
run: cd infra/temporal_ts && npm install && npm run build
156156

157157
- name: Unit tests
158-
run: cd temporal_ts && npm test
158+
run: cd infra/temporal_ts && npm test
159159

160160
- name: E2E tests (Docker Temporal)
161161
run: |
162162
if [ -z "$STRIPE_API_KEY" ]; then
163163
echo "::warning::Temporal e2e tests skipped — STRIPE_API_KEY secret not available (fork PR?)"
164164
exit 0
165165
fi
166-
cd temporal_ts && npx vitest run src/__tests__/e2e/docker-e2e.test.ts
166+
cd infra/temporal_ts && npx vitest run src/__tests__/e2e/docker-e2e.test.ts
167167
env:
168168
STRIPE_API_KEY: ${{ secrets.STRIPE_API_KEY }}
169169
POSTGRES_URL: 'postgres://postgres:postgres@localhost:55432/postgres'
170170
TEMPORAL_ADDRESS: 'localhost:7233'
171171

172172
docker-build:
173-
name: Docker build
173+
name: Docker build & test
174174
runs-on: ubuntu-24.04
175+
176+
services:
177+
postgres:
178+
image: postgres:18
179+
env:
180+
POSTGRES_PASSWORD: postgres
181+
ports:
182+
- 55432:5432
183+
options: >-
184+
--health-cmd pg_isready
185+
--health-interval 5s
186+
--health-timeout 5s
187+
--health-retries 5
188+
175189
steps:
176190
- uses: actions/checkout@v5
177-
- name: Build Docker image
178-
run: docker build -t sync-engine:ci .
179-
- name: Smoke test
180-
run: docker run --rm sync-engine:ci --version
191+
192+
- name: Docker build + smoke tests
193+
run: |
194+
if [ -z "$STRIPE_API_KEY" ]; then
195+
echo "::warning::Docker e2e skipped — STRIPE_API_KEY not available (fork PR?). Running build-only."
196+
docker build -t sync-engine:test .
197+
docker run --rm sync-engine:test --version
198+
exit 0
199+
fi
200+
bash scripts/docker-test.sh
201+
env:
202+
STRIPE_API_KEY: ${{ secrets.STRIPE_API_KEY }}
203+
DATABASE_URL: 'postgres://postgres:postgres@localhost:55432/postgres'

.github/workflows/docker-image.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build Docker Image
2+
3+
on:
4+
# Manual trigger
5+
workflow_dispatch:
6+
7+
# Automatic trigger on new commits on any branch
8+
push:
9+
branches:
10+
- '**'
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v5
19+
20+
# Set up QEMU
21+
- name: Set up QEMU
22+
uses: docker/setup-qemu-action@v3
23+
24+
# Set up Docker Buildx
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
# Login to Docker Hub
29+
- name: Login to Docker Hub
30+
uses: docker/login-action@v3
31+
with:
32+
username: ${{ secrets.DOCKERHUB_USERNAME }}
33+
password: ${{ secrets.DOCKERHUB_TOKEN_SYNC_ENGINE }}
34+
35+
# Generate image tags and labels
36+
- name: Docker meta
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: stripe/sync-engine
41+
tags: |
42+
type=sha,format=long,prefix=
43+
type=ref,event=branch
44+
type=raw,value=latest,enable={{is_default_branch}}
45+
46+
# Build and push Docker images for each target
47+
- name: Build and push Docker images
48+
uses: docker/build-push-action@v5
49+
with:
50+
context: .
51+
file: Dockerfile
52+
push: true
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: ${{ steps.meta.outputs.labels }}
55+
platforms: linux/arm64

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ Pulumi.*.yaml
77
LICENSE.md
88
dist/
99
docs/out/
10-
.claude/
10+
.claude/
11+
**/.terraform/

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"rubyLsp.rubyVersionManager": {
66
"identifier": "rbenv"
77
},
8-
"rubyLsp.bundleGemfile": "temporal_ruby/Gemfile"
8+
"rubyLsp.bundleGemfile": "infra/temporal_ruby/Gemfile"
99
}

AGENTS.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ pnpm install
99
pnpm build # required before running CLI or e2e tests
1010
```
1111

12-
**You must build before running the CLI.** `tsx` and `node --experimental-strip-types`
13-
do not work because the codebase uses `?raw` imports (bundler feature) and
14-
`import ... with { type: 'json' }` (import attributes).
12+
Most packages run directly from source via `npx tsx` — no build needed.
13+
`node --strip-types` does not work because the codebase uses `moduleResolution: "bundler"`
14+
with extensionless imports (`from './index'` not `from './index.ts'`).
15+
16+
Exceptions that require `pnpm build`:
17+
18+
- `apps/supabase` — uses `?raw` imports (bundler feature)
19+
- `apps/stateless` — uses `import ... with { type: 'json' }` (import attributes)
1520

1621
For dev with auto-rebuild: `cd packages/sync-engine && pnpm dev`
1722

@@ -54,7 +59,7 @@ reporting back. Don't just push and return — keep polling `gh pr checks` or
5459

5560
## Key Gotchas
5661

57-
- `tsx` fails on this project `?raw` imports pull in Deno-only code. Use built output.
62+
- `tsx` fails on `apps/supabase` `?raw` imports pull in Deno-only code. Other packages work fine with `npx tsx`.
5863
- `packages/sync-engine/src/supabase` is Deno, not Node. Don't try to run those files with Node/tsx.
5964
- E2E tests need Stripe keys with **write** permissions (they create real objects).
6065
- Do not add `esbuild` as a dependency — its native binaries fail on this machine. Use `tsup` (already in the repo) for bundling.

Dockerfile

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,18 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-l
1414

1515
FROM base AS build
1616
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
17-
RUN pnpm run -r build
17+
ENV NODE_OPTIONS="--max-old-space-size=4096"
18+
RUN pnpm --filter @stripe/protocol \
19+
--filter @stripe/util-postgres \
20+
--filter @stripe/ts-cli \
21+
--filter @stripe/stateless-sync \
22+
--filter @stripe/store-postgres \
23+
--filter @stripe/destination-postgres \
24+
--filter @stripe/destination-google-sheets \
25+
--filter @stripe/source-stripe \
26+
--filter @stripe/sync-engine-stateless \
27+
--filter @stripe/sync-engine \
28+
run build
1829

1930
## Build step complete, copy to working image
2031
FROM node:24-alpine
@@ -24,28 +35,41 @@ WORKDIR /app
2435
COPY --from=base /app/package.json /app/pnpm-lock.yaml /app/pnpm-workspace.yaml* ./
2536

2637
# Copy package.json files for required packages
38+
COPY --from=base /app/apps/sync-engine/package.json /app/apps/sync-engine/
2739
COPY --from=base /app/apps/stateless/package.json /app/apps/stateless/
2840
COPY --from=base /app/packages/protocol/package.json /app/packages/protocol/
2941
COPY --from=base /app/packages/stateless-sync/package.json /app/packages/stateless-sync/
3042
COPY --from=base /app/packages/source-stripe/package.json /app/packages/source-stripe/
3143
COPY --from=base /app/packages/destination-postgres/package.json /app/packages/destination-postgres/
44+
COPY --from=base /app/packages/destination-google-sheets/package.json /app/packages/destination-google-sheets/
45+
COPY --from=base /app/packages/store-postgres/package.json /app/packages/store-postgres/
46+
COPY --from=base /app/packages/util-postgres/package.json /app/packages/util-postgres/
3247
COPY --from=base /app/packages/ts-cli/package.json /app/packages/ts-cli/
3348

3449
# Copy production dependencies (including workspace dependencies)
3550
COPY --from=prod-deps /app/node_modules /app/node_modules
51+
COPY --from=prod-deps /app/apps/sync-engine/node_modules /app/apps/sync-engine/node_modules
3652
COPY --from=prod-deps /app/apps/stateless/node_modules /app/apps/stateless/node_modules
3753
COPY --from=prod-deps /app/packages/protocol/node_modules /app/packages/protocol/node_modules
3854
COPY --from=prod-deps /app/packages/stateless-sync/node_modules /app/packages/stateless-sync/node_modules
3955
COPY --from=prod-deps /app/packages/source-stripe/node_modules /app/packages/source-stripe/node_modules
4056
COPY --from=prod-deps /app/packages/destination-postgres/node_modules /app/packages/destination-postgres/node_modules
57+
COPY --from=prod-deps /app/packages/destination-google-sheets/node_modules /app/packages/destination-google-sheets/node_modules
58+
COPY --from=prod-deps /app/packages/store-postgres/node_modules /app/packages/store-postgres/node_modules
59+
COPY --from=prod-deps /app/packages/util-postgres/node_modules /app/packages/util-postgres/node_modules
4160

4261
# Copy built files
62+
COPY --from=build /app/apps/sync-engine/dist /app/apps/sync-engine/dist
4363
COPY --from=build /app/apps/stateless/dist /app/apps/stateless/dist
4464
COPY --from=build /app/packages/protocol/dist /app/packages/protocol/dist
4565
COPY --from=build /app/packages/stateless-sync/dist /app/packages/stateless-sync/dist
4666
COPY --from=build /app/packages/source-stripe/dist /app/packages/source-stripe/dist
4767
COPY --from=build /app/packages/destination-postgres/dist /app/packages/destination-postgres/dist
68+
COPY --from=build /app/packages/destination-google-sheets/dist /app/packages/destination-google-sheets/dist
69+
COPY --from=build /app/packages/store-postgres/dist /app/packages/store-postgres/dist
70+
COPY --from=build /app/packages/util-postgres/dist /app/packages/util-postgres/dist
4871
COPY --from=build /app/packages/ts-cli/dist /app/packages/ts-cli/dist
4972

5073
ENV NODE_ENV=production
51-
ENTRYPOINT ["node", "apps/stateless/dist/cli/index.js"]
74+
ENTRYPOINT ["node", "apps/sync-engine/dist/cli.js"]
75+
CMD ["serve"]

README.md

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)