Files
knowai/.drone.yml
tobegold574 6a81b7bb13
Some checks reported errors
continuous-integration/drone/push Build was killed
feat(image): 新建 knowai-core:1.0.0 镜像并完成推送
- 搭建 api、auth、utils 等逻辑模块
- 通过 tsc、eslint、vitest 测试验证

BREAKING CHANGE: 新镜像分支
2025-11-10 20:20:25 +08:00

126 lines
3.4 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

kind: pipeline
type: kubernetes
name: verify-knowai-core
trigger:
branch:
- knowai-core
event:
- push
volumes:
- name: pnpm-store-cache
emptyDir: {}
- name: repo-volume
emptyDir: {}
clone:
disable: true
steps:
# 0⃣ 克隆代码
- name: clone
image: alpine/git:latest
environment:
CA_CRT:
from_secret: ca-crt
commands:
- apk add --no-cache ca-certificates
- echo "$CA_CRT" > /etc/ssl/certs/ca.crt
- update-ca-certificates
- git clone https://gitea.local.knowai/tobegold574/knowai.git /drone/src
- cd /drone/src
- git checkout ${DRONE_BRANCH}
- echo "✅ 当前分支:$(git rev-parse --abbrev-ref HEAD)"
volumeMounts:
- name: repo-volume
mountPath: /drone/src
# 1⃣ 准备环境
- name: prepare-environment
image: gitea.local.knowai/tobegold574/knowai-base:1.0.0
commands:
- cd /drone/src/frontend/knowai-core
- echo "🚀 验证 Node.js 环境..."
- node --version
- pnpm --version
- echo "🔍 检查 pnpm 存储路径..."
- pnpm store path
- echo "🔍 检查项目结构..."
- ls -la
volumeMounts:
- name: repo-volume
mountPath: /drone/src
# 2⃣ 安装依赖
- name: install-dependencies
image: gitea.local.knowai/tobegold574/knowai-base:1.0.0
commands:
- cd /drone/src/frontend/knowai-core
- echo "📦 安装项目依赖..."
- pnpm install --registry=https://registry.npmmirror.com --no-frozen-lockfile
- echo "✅ 依赖安装完成"
volumeMounts:
- name: repo-volume
mountPath: /drone/src
- name: pnpm_store_cache
mountPath: /pnpm-global/store
# 3⃣ 类型检查
- name: type-check
image: gitea.local.knowai/tobegold574/knowai-base:1.0.0
commands:
- cd /drone/src/frontend/knowai-core
- echo "🔍 执行 TypeScript 类型检查..."
- pnpm run type-check
- echo "✅ 类型检查通过"
volumeMounts:
- name: repo-volume
mountPath: /drone/src
- name: pnpm_store_cache
mountPath: /pnpm-global/store
# 4⃣ 代码检查
- name: lint
image: gitea.local.knowai/tobegold574/knowai-base:1.0.0
commands:
- cd /drone/src/frontend/knowai-core
- echo "🔍 执行 ESLint 代码检查..."
- pnpm run lint
- echo "✅ 代码检查通过"
volumeMounts:
- name: repo-volume
mountPath: /drone/src
- name: pnpm_store_cache
mountPath: /pnpm-global/store
# 5⃣ 运行测试
- name: test
image: gitea.local.knowai/tobegold574/knowai-base:1.0.0
commands:
- cd /drone/src/frontend/knowai-core
- echo "🧪 运行单元测试..."
- pnpm run test
- echo "✅ 测试通过"
volumeMounts:
- name: repo-volume
mountPath: /drone/src
- name: pnpm_store_cache
mountPath: /pnpm-global/store
# 6⃣ 构建验证
- name: build
image: gitea.local.knowai/tobegold574/knowai-base:1.0.0
commands:
- cd /drone/src/frontend/knowai-core
- echo "🔨 验证构建过程..."
- pnpm run build
- echo "📁 检查构建产物..."
- ls -la dist/
- echo "✅ 构建验证通过"
volumeMounts:
- name: repo-volume
mountPath: /drone/src
- name: pnpm_store_cache
mountPath: /pnpm-global/store