mirror of
https://github.com/lobehub/lobe-chat.git
synced 2025-12-20 01:12:52 +08:00
180 lines
4.4 KiB
YAML
180 lines
4.4 KiB
YAML
name: Test CI
|
|
|
|
on: [push, pull_request]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
# Package tests - using each package's own test script
|
|
test-intenral-packages:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
package:
|
|
- file-loaders
|
|
- prompts
|
|
- model-runtime
|
|
- web-crawler
|
|
- electron-server-ipc
|
|
- utils
|
|
- python-interpreter
|
|
- context-engine
|
|
- agent-runtime
|
|
|
|
name: Test package ${{ matrix.package }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v5
|
|
with:
|
|
node-version: 22
|
|
package-manager-cache: false
|
|
|
|
- name: Install bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: ${{ secrets.BUN_VERSION }}
|
|
|
|
- name: Install deps
|
|
run: bun i
|
|
|
|
- name: Test ${{ matrix.package }} package with coverage
|
|
run: bun run --filter @lobechat/${{ matrix.package }} test:coverage
|
|
|
|
- name: Upload ${{ matrix.package }} coverage to Codecov
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: ./packages/${{ matrix.package }}/coverage/lcov.info
|
|
flags: packages/${{ matrix.package }}
|
|
|
|
test-packages:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
package: [model-bank]
|
|
|
|
name: Test package ${{ matrix.package }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v5
|
|
with:
|
|
node-version: 22
|
|
package-manager-cache: false
|
|
|
|
- name: Install bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.2.23
|
|
|
|
- name: Install deps
|
|
run: bun i
|
|
|
|
- name: Test ${{ matrix.package }} package with coverage
|
|
run: bun run --filter ${{ matrix.package }} test:coverage
|
|
|
|
- name: Upload ${{ matrix.package }} coverage to Codecov
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: ./packages/${{ matrix.package }}/coverage/lcov.info
|
|
flags: packages/${{ matrix.package }}
|
|
|
|
# App tests
|
|
test-website:
|
|
name: Test Website
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v5
|
|
with:
|
|
node-version: 22
|
|
package-manager-cache: false
|
|
|
|
- name: Install bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.2.23
|
|
|
|
- name: Install deps
|
|
run: bun i
|
|
|
|
- name: Test App Coverage
|
|
run: bun run test-app:coverage
|
|
|
|
- name: Upload App Coverage to Codecov
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: ./coverage/app/lcov.info
|
|
flags: app
|
|
|
|
test-databsae:
|
|
name: Test Database
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
postgres:
|
|
image: paradedb/paradedb:latest
|
|
env:
|
|
POSTGRES_PASSWORD: postgres
|
|
options: >-
|
|
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
|
|
ports:
|
|
- 5432:5432
|
|
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v5
|
|
with:
|
|
node-version: 22
|
|
package-manager-cache: false
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
|
|
- name: Install deps
|
|
run: pnpm i
|
|
|
|
- name: Lint
|
|
run: npm run lint
|
|
|
|
- name: Test Client DB
|
|
run: pnpm --filter @lobechat/database test:client-db
|
|
env:
|
|
KEY_VAULTS_SECRET: LA7n9k3JdEcbSgml2sxfw+4TV1AzaaFU5+R176aQz4s=
|
|
S3_PUBLIC_DOMAIN: https://example.com
|
|
APP_URL: https://home.com
|
|
|
|
- name: Test Coverage
|
|
run: pnpm --filter @lobechat/database test:coverage
|
|
env:
|
|
DATABASE_TEST_URL: postgresql://postgres:postgres@localhost:5432/postgres
|
|
DATABASE_DRIVER: node
|
|
NEXT_PUBLIC_SERVICE_MODE: server
|
|
KEY_VAULTS_SECRET: LA7n9k3JdEcbSgml2sxfw+4TV1AzaaFU5+R176aQz4s=
|
|
S3_PUBLIC_DOMAIN: https://example.com
|
|
APP_URL: https://home.com
|
|
|
|
- name: Upload Database coverage to Codecov
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: ./packages/database/coverage/lcov.info
|
|
flags: database
|