Files
knowai/.drone.yml
tobegold574 52a7277844
Some checks reported errors
continuous-integration/drone/push Build was killed
fix(CI): 标签问题修改
- 只推送了latest版本,但是脚本里写的1.0.0
2025-11-10 20:56:21 +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.

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.

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⃣ 准备环境Node + pnpm
- name: prepare-environment
image: gitea.local.knowai/tobegold574/knowai-base
commands:
- cd /drone/src/frontend/knowai-core
- echo "🚀 验证 Node.js 和 pnpm 环境..."
- 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
commands:
- cd /drone/src/frontend/knowai-core
- echo "📦 安装依赖(利用缓存)..."
- pnpm install --frozen-lockfile --registry=https://registry.npmmirror.com
- 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
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⃣ 代码检查 (Lint)
- name: lint
image: gitea.local.knowai/tobegold574/knowai-base
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
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
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