Some checks reported errors
continuous-integration/drone/push Build was killed
- 搭建 api、auth、utils 等逻辑模块 - 通过 tsc、eslint、vitest 测试验证 BREAKING CHANGE: 新镜像分支
126 lines
3.4 KiB
YAML
126 lines
3.4 KiB
YAML
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
|