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
9 changes: 9 additions & 0 deletions railway.api.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
[build]
builder = "NIXPACKS"
buildCommand = "corepack pnpm install --frozen-lockfile && corepack pnpm --filter @tomeet/api... typecheck"
watchPatterns = [
"/apps/api/**",
"/packages/**",
"/package.json",
"/pnpm-lock.yaml",
"/pnpm-workspace.yaml",
"/tsconfig.base.json",
"/railway.api.toml",
]

[deploy]
startCommand = "corepack pnpm --filter @tomeet/api start"
Expand Down
9 changes: 9 additions & 0 deletions railway.wechat.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
[build]
builder = "RAILPACK"
buildCommand = "corepack enable && pnpm install --frozen-lockfile"
watchPatterns = [
"/apps/wechat-ilink-worker/**",
"/packages/**",
"/package.json",
"/pnpm-lock.yaml",
"/pnpm-workspace.yaml",
"/tsconfig.base.json",
"/railway.wechat.toml",
]

[deploy]
startCommand = "pnpm --filter @tomeet/wechat-ilink-worker start"
Expand Down
9 changes: 9 additions & 0 deletions railway.worker.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
[build]
builder = "NIXPACKS"
buildCommand = "corepack pnpm install --frozen-lockfile && corepack pnpm --filter @tomeet/intelligence-worker... typecheck"
watchPatterns = [
"/apps/intelligence-worker/**",
"/packages/**",
"/package.json",
"/pnpm-lock.yaml",
"/pnpm-workspace.yaml",
"/tsconfig.base.json",
"/railway.worker.toml",
]

[deploy]
startCommand = "corepack pnpm --filter @tomeet/intelligence-worker start"
Expand Down
43 changes: 43 additions & 0 deletions scripts/railway-config.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import test from "node:test";

const sharedWatchPatterns = [
"/packages/**",
"/package.json",
"/pnpm-lock.yaml",
"/pnpm-workspace.yaml",
"/tsconfig.base.json"
];

const configs = [
{
file: "railway.api.toml",
appPattern: "/apps/api/**"
},
{
file: "railway.worker.toml",
appPattern: "/apps/intelligence-worker/**"
},
{
file: "railway.wechat.toml",
appPattern: "/apps/wechat-ilink-worker/**"
}
];

function readStringArray(source, key) {
const match = source.match(new RegExp(`^${key}\\s*=\\s*\\[([\\s\\S]*?)\\]`, "mu"));
assert.ok(match, `${key} must be configured`);
return [...match[1].matchAll(/"([^"]+)"/gu)].map((entry) => entry[1]);
}

test("Railway services redeploy for shared workspace changes", async () => {
for (const config of configs) {
const source = await readFile(new URL(`../${config.file}`, import.meta.url), "utf8");
assert.deepEqual(readStringArray(source, "watchPatterns"), [
config.appPattern,
...sharedWatchPatterns,
`/${config.file}`
]);
}
});
Loading