Files
inkreach-official-website/.gitea/workflows/ci.yaml
T
RyRh 763f200917
CI / build-and-test (push) Canceled after 0s
CI / test (push) Canceled after 25s
td1
2026-09-04 15:12:25 +08:00

65 lines
1.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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
- name: 安装依赖
run: |
npm config set registry https://registry.npmmirror.com
npm install -g @pnpm/exe
pnpm install --frozen-lockfile --registry=https://registry.npmmirror.com
- 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
build-and-test:
runs-on: online
steps:
- uses: https://gitea.com/actions/checkout@v4
- name: 安装 Docker 客户端
run: |
apt-get update && apt-get install -y docker.io
- name: 构建镜像
run: docker build -t my-app:latest .
- name: 启动测试服务
run: |
docker run -d --name test-server -p 8080:80 my-app:latest
sleep 5
- name: 测试服务是否正常
run: curl -f http://localhost:8080