Commit Graph

40 Commits

Author SHA1 Message Date
张翔 bd87cdf0e6 fix(deploy): 修复生产环境容器启动失败问题
ci/woodpecker/push/woodpecker Pipeline failed
问题:
1. Dockerfile.prod目录结构错误
   - standalone路径不正确
   - static文件路径错误
2. docker-compose.server.yml网络配置问题
   - external网络可能不存在
3. 健康检查命令不可用
   - alpine镜像缺少wget

修复:
1. Dockerfile.prod
   - 正确复制standalone目录内容
   - 将static文件复制到.next/static/
   - 安装curl用于健康检查
2. docker-compose.server.yml
   - 移除external网络依赖
   - 使用curl进行健康检查
3. deploy-production.sh
   - 使用curl替代wget
   - 备份包含Dockerfile.prod和docker-compose.server.yml
2026-03-29 19:44:43 +08:00
张翔 ffa4705b18 feat(ci): 重构部署流程 - 同步构建产物到生产服务器
ci/woodpecker/push/woodpecker Pipeline failed
重大变更:
- 移除CI/CD中的Docker镜像构建和推送
- 改为在CI中构建产物,通过rsync同步到生产服务器
- 生产服务器本地构建镜像并部署

新增文件:
- Dockerfile.prod: 生产服务器专用Dockerfile
- docker-compose.server.yml: 生产服务器docker-compose配置
- scripts/deploy-production.sh: 生产服务器部署脚本

优势:
1. 减少CI/CD服务器负载(无需构建镜像)
2. 加快部署速度(直接同步产物)
3. 降低镜像仓库存储成本
4. 生产服务器可自主控制构建和部署
2026-03-29 17:24:40 +08:00
张翔 7cbb7a9ac8 fix(test): 修复测试环境问题
ci/woodpecker/push/woodpecker Pipeline failed
1. jest.setup.js:
   - 添加 Request/Response/Headers 全局对象 mock
   - 解决 'Request is not defined' 错误

2. .eslintrc.json:
   - 将 jest.setup.js 添加到忽略列表

3. shared-mocks.tsx:
   - 添加 ArrowUp 图标 mock

4. back-to-top.test.tsx:
   - 重写测试使用 import 语法
   - 使用 fireEvent.scroll 触发滚动事件
   - 修复组件渲染测试
2026-03-29 14:50:09 +08:00
张翔 1e101183ca fix: 修复Woodpecker CI配置解析错误
ci/woodpecker/push/woodpecker Pipeline failed
问题根本原因:
- YAML heredoc块格式导致解析器无法正确识别命令类型
- Pipeline #30 显示 'No pipeline steps available' 错误

修复方案:
- 将企业微信通知逻辑移至独立脚本文件 scripts/notify-wechat.sh
- 简化 .woodpecker.yml 中的通知步骤配置
- 使用标准shell脚本处理环境变量展开

验证:
- YAML语法验证通过
- 命令类型检查通过(所有命令均为字符串类型)
2026-03-29 08:54:06 +08:00
张翔 34ce9fb968 fix: 修复CI/CD流程问题并建立监控机制
- 禁用Git LFS(项目未使用LFS)
- 修复企业微信通知环境变量展开问题
- 创建CI/CD诊断脚本
- 建立持续监控机制
- 添加预防措施文档

问题根本原因:
1. Woodpecker CI Git插件默认启用LFS,导致不必要的LFS命令执行
2. Shell脚本heredoc块内变量展开时机问题导致环境变量丢失

修复方案:
1. 在clone配置中添加 lfs: false
2. 将环境变量赋值移到单独的命令行,heredoc仅用于生成JSON

验证方法:
- 运行 diagnose-cicd-issues.sh 进行诊断
- 运行 scripts/monitoring/cicd-monitor.sh 进行监控
2026-03-29 08:48:31 +08:00
张翔 d19c290365 fix: 使用 cat heredoc 方法修复企业微信通知环境变量展开
ci/woodpecker/push/woodpecker Pipeline failed
- 使用 cat > file <<EOF 替代其他方法
- 确保环境变量在 heredoc 中正确展开
- 本地测试验证成功
2026-03-29 08:03:19 +08:00
张翔 dd2a0999bb fix: 修复企业微信通知环境变量展开问题
ci/woodpecker/push/woodpecker Pipeline failed
- 使用 PAYLOAD=$(cat <<ENDPAYLOAD) 替代 cat > file <<EOF
- 确保环境变量在 heredoc 中正确展开
- 添加测试脚本验证环境变量展开
- 修复构建详情链接和消息内容缺失问题
2026-03-28 22:48:22 +08:00
张翔 5a27d2fc2a feat: 添加企业微信通知本地测试脚本
ci/woodpecker/push/woodpecker Pipeline failed
- 支持在本地测试企业微信通知功能
- 显示生成的 JSON 内容和响应结果
- 方便调试和验证通知配置
2026-03-28 22:29:16 +08:00
张翔 6797a1ee2d feat: 添加 Woodpecker CI 本地测试工具
ci/woodpecker/push/woodpecker Pipeline failed
- validate-woodpecker.sh: 全面验证配置文件
- test-step.sh: 单步测试工具,支持 Docker 隔离环境
- README.md: 详细使用文档和最佳实践

这些工具可以在本地验证和测试 CI/CD 配置,避免通过持续提交来测试
2026-03-28 22:24:46 +08:00
张翔 a003f1192e feat(ui/ux): 优化用户体验和可访问性
- 字体加载优化: 添加 font-display: block 策略,创建 useFontLoading hook
- 色彩对比度: 调整 text-muted 和 text-tertiary 颜色值确保 WCAG AA 合规
- 滚动进度条: 新增 ScrollProgress 组件,支持 reduced motion
- 表单自动保存: 新增 useFormAutosave hook,防止用户数据丢失
- 返回顶部按钮: 新增 BackToTop 组件,提升长页面导航体验
- 图片懒加载: 优化 OptimizedImage 组件,添加 blur placeholder 和加载动画

所有新组件均包含完整测试,1450+ 测试通过
2026-03-28 11:21:04 +08:00
张翔 ebaa7f3c50 fix: 修复Woodpecker CI配置文件中的linter错误
ci/woodpecker/manual/woodpecker Pipeline was successful
- 移除未使用的YAML锚点定义
- 替换commands字段中的锚点引用为实际值
- 移除有问题的通知步骤
- 修复测试文件中的问题
- 添加新的测试用例和配置文件
2026-03-28 09:42:45 +08:00
张翔 7a38eae6e0 chore: 删除e2e测试相关的初始化文件和快照文件
清理不再需要的测试初始化文件和视觉回归测试的快照文件,以保持代码库整洁
2026-03-27 09:56:57 +08:00
张翔 498bb3a3c8 refactor: reorganize project structure and improve code quality
- Move CI/CD configs to config/ci/ directory
- Reorganize scripts into categorized directories (deployment, monitoring, testing, utils)
- Consolidate documentation into docs/ directory with proper structure
- Update linting and testing configurations
- Remove obsolete test reports and performance summaries
- Add new documentation for code quality tools and contact form security
- Improve project organization and maintainability
- Fix lint-staged config to only lint JS/TS files
- Disable react/react-in-jsx-scope rule for Next.js compatibility
- Ignore scripts and test config directories in ESLint
2026-03-24 13:38:58 +08:00
张翔 4fdfc2d8b4 feat: implement frontend-backend configuration linkage
- Create public config API for frontend consumption
- Add configuration fetching to homepage
- Implement module show/hide logic based on config
- Add support for Services items filtering
- Add support for Products featured products and pricing display
- Add support for News display count, categories, and sort order
- Fix table name from 'configs' to 'siteConfig' in API route
- Update type definitions for proper TypeScript support
2026-03-13 13:11:20 +08:00
张翔 5bc8356a37 fix: resolve HMR error and TypeScript build issues
- Disable all experimental features to fix React 19 and Next.js 16 compatibility
- Fix TypeScript error in check-permission.ts (role property issue)
- Add test script for Contact page validation
- Use production mode to avoid HMR issues completely
2026-03-13 12:25:42 +08:00
张翔 b026d2b2ab fix: resolve React 19 and Next.js 16 HMR compatibility issue 2026-03-13 12:13:43 +08:00
张翔 ca4342d81d fix: resolve TypeScript compilation error and add verification script 2026-03-13 12:05:00 +08:00
张翔 b86ca1f428 feat: add Woodpecker CI configuration for tiered testing 2026-03-13 11:52:32 +08:00
张翔 e8dffa4f05 chore: remove GitHub Actions workflows, use Woodpecker CI exclusively 2026-03-10 13:10:11 +08:00
张翔 3991b34841 ci: add coverage trend monitoring 2026-03-10 12:45:56 +08:00
张翔 4ece85a9c3 feat: 添加生产环境部署和监控配置
- 新增生产环境部署脚本和文档
- 添加监控系统配置(Alertmanager, Prometheus, Grafana)
- 更新e2e测试用例以适配新环境
- 添加.env.production配置文件
- 优化Sentry初始化逻辑为动态加载
- 新增全局设置脚本以支持不同环境
2026-03-09 16:37:23 +08:00
张翔 4897c6e11c feat: 建立监控告警体系和生产环境配置
阶段三:建立监控告警体系
- 集成Sentry错误监控:安装依赖,创建配置文件,初始化Sentry
- 配置性能监控:创建监控工具类,实现健康检查API
- 更新环境变量模板,添加Sentry和数据库配置

阶段四:配置生产环境
- 创建生产环境变量模板
- 创建Dockerfile和docker-compose.prod.yml
- 创建备份和恢复脚本
- 设置脚本执行权限
2026-03-09 11:00:42 +08:00
张翔 6d92024b63 feat: 修复测试套件问题并添加Woodpecker CI配置
- 修复API测试认证问题:创建全局认证设置,更新Playwright配置
- 优化回归测试稳定性:增加超时时间到15秒,修复定位器
- 创建Woodpecker CI工作流:CI、部署和质量门禁配置
- 添加Jest配置和测试脚本
- 移除登录页面的默认账号密码显示(安全问题修复)
2026-03-09 10:26:02 +08:00
张翔 724cd7f27a chore: add color contrast testing scripts and update dependencies 2026-03-07 10:46:27 +08:00
张翔 336802d65a feat: add heading hierarchy checker script and npm script 2026-03-06 20:54:34 +08:00
张翔 cbbc6e8824 feat: add color contrast checking script for CI/CD
- Added scripts/check-color-contrast.ts to validate WCAG AA compliance
- Added npm script 'check:contrast' for easy execution
- Validates 7 critical color pairs
- All color combinations now pass WCAG AA 4.5:1 standard
2026-03-06 20:25:52 +08:00
张翔 4c8714c12d feat: complete system test fixes - 100% pass rate (85/85)
- Fixed all form tests (20/20 passing)
- Fixed all performance tests (35/35 passing)
- Fixed all SEO and accessibility tests (30/30 passing)
- Enhanced test framework with custom reporting
- Added performance baseline tracking
- Improved test reliability and error handling
2026-03-06 19:37:02 +08:00
张翔 33568b38a4 chore: remove old scripts directory (backed up to scripts.backup) 2026-03-06 12:55:55 +08:00
张翔 71560b016b fix: correct lighthouse result structure access 2026-03-06 11:24:51 +08:00
张翔 db992cf4fb fix: correct lighthouse and chrome-launcher imports 2026-03-06 11:22:19 +08:00
张翔 4036b286a0 fix: add missing fs and path imports to scripts 2026-03-06 10:19:22 +08:00
张翔 54bdafa47f fix: correct score calculation in accessibility test 2026-03-06 10:17:49 +08:00
张翔 e82f5b26aa fix: use browser.newContext() for axe-core/playwright compatibility 2026-03-06 10:17:09 +08:00
张翔 755e0889a5 docs: add testing scripts documentation 2026-03-06 10:12:53 +08:00
张翔 614fa8f85e feat: add one-click test runner script 2026-03-06 10:09:44 +08:00
张翔 dc41aaf04e feat: add comprehensive test report generator 2026-03-06 10:09:04 +08:00
张翔 7e023f0bf1 feat: add form validation testing script 2026-03-06 10:07:52 +08:00
张翔 4b84f28065 feat: add accessibility testing script with axe-core 2026-03-06 10:05:10 +08:00
张翔 2202d4045b feat: add SEO validation script 2026-03-06 10:04:06 +08:00
张翔 0bedc7e023 feat: add performance audit script with Lighthouse 2026-03-06 10:02:58 +08:00