* perf(core): 优化 EntitySystem 迭代性能,添加 CommandBuffer 延迟命令 ReactiveQuery 快照优化: - 添加快照机制,避免每帧拷贝数组 - 只在实体列表变化时创建新快照 - 静态场景下多个系统共享同一快照 CommandBuffer 延迟命令系统: - 支持延迟添加/移除组件、销毁实体、设置实体激活状态 - 每个系统拥有独立的 commands 属性 - 命令在帧末统一执行,避免迭代过程中修改实体列表 Scene 更新: - 在 lateUpdate 后自动刷新所有系统的命令缓冲区 文档: - 更新系统文档,添加 CommandBuffer 使用说明 * fix(ci): upgrade first-interaction action to v1.3.0 Fix Docker build failure in welcome workflow. * fix(ci): upgrade pnpm/action-setup to v4 and fix unused import - Upgrade pnpm/action-setup@v2 to v4 in all workflow files - Remove unused CommandType import in CommandBuffer.test.ts * fix(ci): remove duplicate pnpm version specification
126 lines
3.1 KiB
YAML
126 lines
3.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ master, main, develop ]
|
|
paths:
|
|
- 'packages/**'
|
|
- 'package.json'
|
|
- 'pnpm-lock.yaml'
|
|
- 'tsconfig.json'
|
|
- 'turbo.json'
|
|
- 'jest.config.*'
|
|
- '.github/workflows/ci.yml'
|
|
pull_request:
|
|
branches: [ master, main, develop ]
|
|
paths:
|
|
- 'packages/**'
|
|
- 'package.json'
|
|
- 'pnpm-lock.yaml'
|
|
- 'tsconfig.json'
|
|
- 'turbo.json'
|
|
- 'jest.config.*'
|
|
- '.github/workflows/ci.yml'
|
|
|
|
jobs:
|
|
ci:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20.x'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install Rust stable
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: wasm32-unknown-unknown
|
|
|
|
# 缓存 Rust 编译结果
|
|
- name: Cache Rust dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: packages/engine
|
|
cache-on-failure: true
|
|
|
|
# 缓存 wasm-pack
|
|
- name: Cache wasm-pack
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cargo/bin/wasm-pack
|
|
key: wasm-pack-${{ runner.os }}
|
|
|
|
- name: Install wasm-pack
|
|
run: |
|
|
if ! command -v wasm-pack &> /dev/null; then
|
|
cargo install wasm-pack
|
|
fi
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --no-frozen-lockfile
|
|
|
|
# 缓存 Turbo
|
|
- name: Cache Turbo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: .turbo
|
|
key: turbo-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.sha }}
|
|
restore-keys: |
|
|
turbo-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-
|
|
turbo-${{ runner.os }}-
|
|
|
|
# 构建所有包
|
|
- name: Build all packages
|
|
run: pnpm run build
|
|
|
|
- name: Copy WASM files to ecs-engine-bindgen
|
|
run: |
|
|
mkdir -p packages/ecs-engine-bindgen/src/wasm
|
|
cp packages/engine/pkg/es_engine.js packages/ecs-engine-bindgen/src/wasm/
|
|
cp packages/engine/pkg/es_engine.d.ts packages/ecs-engine-bindgen/src/wasm/
|
|
cp packages/engine/pkg/es_engine_bg.wasm packages/ecs-engine-bindgen/src/wasm/
|
|
cp packages/engine/pkg/es_engine_bg.wasm.d.ts packages/ecs-engine-bindgen/src/wasm/
|
|
|
|
# 类型检查
|
|
- name: Type check
|
|
run: pnpm run type-check
|
|
|
|
# Lint 检查
|
|
- name: Lint check
|
|
run: pnpm run lint
|
|
|
|
# 测试
|
|
- name: Run tests with coverage
|
|
run: pnpm run test:ci
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v4
|
|
continue-on-error: true
|
|
with:
|
|
file: ./coverage/lcov.info
|
|
flags: unittests
|
|
name: codecov-umbrella
|
|
fail_ci_if_error: false
|
|
|
|
# 构建 npm 包
|
|
- name: Build npm packages
|
|
run: pnpm run build:npm
|
|
|
|
# 上传构建产物
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: build-artifacts
|
|
path: |
|
|
packages/*/dist/
|
|
packages/*/bin/
|
|
retention-days: 7
|