Task test #8
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: CI/CD Workflow | |
on: | |
push: | |
branches: | |
- main # 当代码推送到 main 分支时触发 | |
pull_request: | |
branches: | |
- main # 当有 PR 请求合并到 main 分支时触发 | |
jobs: | |
build: | |
runs-on: ubuntu-latest # 使用最新的 Ubuntu 环境 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 # 检出代码 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '19' # 指定 Node.js 版本 | |
- name: Install pnpm | |
run: npm install -g pnpm # 全局安装 pnpm | |
- name: Install dependencies | |
run: pnpm install # 使用 pnpm 安装依赖 | |
- name: Run tests | |
run: pnpm test # 运行测试 | |
- name: Build project | |
run: pnpm build # 构建项目 |