mirror of
https://git.bjxgj.com/xgj/xgj-actions.git
synced 2025-10-14 06:33:37 +08:00
53 lines
1.2 KiB
YAML
53 lines
1.2 KiB
YAML
# pnpm monorepo项目示例
|
|
name: pnpm Monorepo CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
install-and-test:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
node-version: [16, 18, 20]
|
|
|
|
steps:
|
|
- name: 检出代码
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 设置pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 8
|
|
|
|
- name: 设置Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'pnpm'
|
|
|
|
- name: 安装依赖
|
|
id: install-deps
|
|
uses: actions/xgj/npm-install@v1
|
|
with:
|
|
package-manager: 'pnpm'
|
|
cache-prefix: 'monorepo'
|
|
|
|
- name: 显示缓存状态
|
|
run: |
|
|
echo "缓存命中: ${{ steps.install-deps.outputs.cache-hit }}"
|
|
echo "缓存Key: ${{ steps.install-deps.outputs.cache-key }}"
|
|
|
|
- name: 运行所有包的测试
|
|
run: pnpm run test --recursive
|
|
|
|
- name: 构建所有包
|
|
run: pnpm run build --recursive
|
|
|
|
- name: 类型检查
|
|
run: pnpm run type-check --recursive
|