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

on:
push:
branches: [main]
pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- run: bun install --frozen-lockfile
- run: bun test
- name: Smoke ingest fixtures
env:
LEXSOURCE_DB: var/ci-smoke.db
run: bun src/cli.ts ingest-fixtures
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
push:
tags: ["v*"]
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- run: bun install --frozen-lockfile
- run: bun test

publish:
needs: test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Pack deploy archive
run: |
set -euo pipefail
tag="${GITHUB_REF_NAME}"
mkdir -p dist
tar -czf "dist/lexsource-${tag}.tar.gz" \
package.json bun.lock src tests docs AGENTS.md README.md tsconfig.json
(cd dist && sha256sum "lexsource-${tag}.tar.gz" > SHA256SUMS)
- uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
dist/lexsource-${{ github.ref_name }}.tar.gz
dist/SHA256SUMS
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ LexSource 是律所案源情报库,不是法律搜索引擎,也不是爬虫
- 截止日期、预算、采购人属于高风险字段:改抽取逻辑时必须更新 golden fixture 测试。
- 本地库文件在 `var/`,已 gitignore。
- 用 `bun test` 验证。不要为了绿测试放宽可投标规则。
- 改 CI 或依赖后必须本地 `bun test`。

## 常用命令

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ bun --hot src/server.ts

浏览器打开 `http://127.0.0.1:8787`。数据库默认写在 `var/lexsource.db`。

## CI / 发版

- push 到 `main` 或开 PR 会跑 `bun test`,以及一次不打外网的 `ingest-fixtures` smoke。
- 打 `vX.Y.Z` tag 会先跑同样测试,再创建 GitHub Release,并附带不含 `node_modules` 的可部署归档。

```bash
bun src/cli.ts ingest --source ccgp --url tests/fixtures/tenders/ccgp-legal-counsel.html
curl -s http://127.0.0.1:8787/api/health
Expand Down
2 changes: 1 addition & 1 deletion docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ LexSource 是给律所使用的案源情报库:把全国法律服务招投标

> 当律师能稳定地从公开主通道获得不过期的法律服务标讯,能打开可核对的重大案件 brief,并能把同一条情报导出为三种格式时,这个项目才算立住。

- 核心入库、验证、检索、导出路径有自动化测试,回归能在 `bun test` 里被挡下。
- 核心入库、验证、检索、导出路径有自动化测试,回归能在 `bun test` 里被挡下;CI 必须挡住这些回归
- 可投标列表里不应出现截止日已过或验证失败的标讯。
- 每条入库情报都能回到原文 URL 或上传件。
- 新增一级业务功能时,验收矩阵同步更新。
Expand Down
Loading