chore: repo overall update #21
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy Vite Project | |
on: | |
push: | |
branches: | |
- dev # 监听主分支的推送事件 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# 检查代码库 | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# 设置 Node.js 环境 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' # 根据项目需求选择 Node.js 版本 | |
# 安装 pnpm | |
- name: Install pnpm | |
run: npm install -g pnpm | |
# 安装依赖 | |
- name: Install dependencies | |
run: pnpm install | |
# 运行构建命令 | |
- name: Build Vite project | |
run: pnpm run build:report | |
# 上传测试覆盖率报告到packages/canyon-report下 | |
- name: Upload coverage report | |
run: cd packages/canyon-report && npm install canyon-uploader -g && canyon-uploader map --dsn=https://collect.canyonjs.org/coverage/map/client | |
- name: Start Vite Server | |
run: cd packages/canyon-report && npm run dev & | |
shell: bash | |
continue-on-error: true | |
- name: Run Playwright Tests | |
run: cd packages/canyon-report && npx playwright install && npx playwright test | |
# 保存构建结果到工作空间 | |
# - name: Upload build artifact | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: build-output | |
# path: dist/ # 根据 Vite 的默认输出目录 | |
# 如果需要部署,可以添加一个部署步骤,例如使用 GitHub Pages 或其他服务 |