49 lines
1.3 KiB
YAML
49 lines
1.3 KiB
YAML
name: CI
|
||
|
||
on:
|
||
push:
|
||
branches: [develop, main, refactor/v2, feature/gitea-ci-verify-yeuimu]
|
||
pull_request:
|
||
|
||
jobs:
|
||
test:
|
||
runs-on: online # 使用你创建的 runner 标签
|
||
|
||
services:
|
||
postgres:
|
||
image: postgres:16-alpine
|
||
env:
|
||
POSTGRES_USER: test
|
||
POSTGRES_PASSWORD: test
|
||
POSTGRES_DB: inkreach_test
|
||
# 去掉 ports 映射,避免与宿主机冲突
|
||
options: >-
|
||
--health-cmd "pg_isready -U test"
|
||
--health-interval 5s
|
||
--health-timeout 3s
|
||
--health-retries 10
|
||
|
||
env:
|
||
DATABASE_URL: postgresql://test:test@postgres:5432/inkreach_test
|
||
|
||
steps:
|
||
- uses: https://gitea.com/actions/checkout@v4
|
||
|
||
# 测试 Docker 是否可用(验证挂载是否生效)
|
||
# - name: 测试 Docker 环境
|
||
# run: docker --version
|
||
|
||
- name: 安装依赖
|
||
run: npm install -g pnpm && pnpm install --frozen-lockfile
|
||
|
||
- name: Prisma generate
|
||
run: pnpm --filter @inkreach/api prisma:generate
|
||
|
||
- name: 建表(migrate deploy)
|
||
run: pnpm --filter @inkreach/api exec prisma migrate deploy
|
||
|
||
- name: API 测试(真实数据库集成测试)
|
||
run: pnpm --filter @inkreach/api test
|
||
|
||
- name: Admin 前端测试
|
||
run: pnpm --filter @inkreach/admin test |