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
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
# Reads the pnpm version from packageManager in package.json.
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck
- run: pnpm lint
- run: pnpm test
4 changes: 4 additions & 0 deletions README.chs.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ pnpm install
pnpm dev
```

### 检查

推送前运行 `pnpm typecheck`、`pnpm lint` 和 `pnpm test`。CI 会在拉取请求和 `main` 分支上运行同样的检查。

### 数据库开发

使用 `pnpm db:generate --name <名称>` 生成迁移,`pnpm db:check` 检查仓库定义与迁移是否一致,`pnpm db:diagram` 查看表结构图,`pnpm test:db` 运行数据库测试。
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ pnpm install
pnpm dev
```

### Checks

Run `pnpm typecheck`, `pnpm lint` and `pnpm test` before pushing. CI runs the same checks on pull requests and on `main`.

### Database development

Use `pnpm db:generate --name <name>` to generate migrations, `pnpm db:check` to check repository consistency, and `pnpm db:diagram` to view the schema. Run `pnpm test:db` for database tests.
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
"license": "MIT",
"author": "Labloom Contributors",
"homepage": "https://labloom.dev",
"packageManager": "pnpm@12.5.1",
"scripts": {
"lint": "eslint --config configs/eslint.config.js --cache --cache-location dist/.eslintcache .",
"lint:fix": "eslint --config configs/eslint.config.js --fix .",
"lint:test": "node configs/config.test.js",
"test": "npm run test:feed && npm run test:db",
"test:feed": "node --test configs/feed.test.js",
"test:db": "node --import tsx --test tests/database-tools.test.ts && node tests/run-workspace.mjs",
"perf": "node tests/run-workspace.mjs --perf",
Expand Down
160 changes: 159 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tests/support/session.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mkdtempSync } from "node:fs";
import { mkdirSync, mkdtempSync } from "node:fs";
import { join } from "node:path";
import * as session from "../../main/session";
import * as state from "../../main/workspace-state";
Expand Down Expand Up @@ -32,6 +32,7 @@ export function openWorkspace(path: string, expectedId?: string, input?: Session
export function openTest(t: TestContext, input: SessionOptions = {}): ReturnType<typeof session.open> {
const root = process.env.LABLOOM_TEST_ROOT ?? join(process.cwd(), ".local");
options = input;
mkdirSync(root, { recursive: true });
const workspace = session.open(mkdtempSync(join(root, "session-test-")), "create", options);
t.after(() => session.close());
return workspace;
Expand Down
Loading