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 ] # Run on all PRs to satisfy branch protection, but skip build if no code changes jobs: # Check if we need to run the full CI check-changes: runs-on: ubuntu-latest outputs: should-run: ${{ steps.filter.outputs.code }} steps: - uses: actions/checkout@v4 - uses: dorny/paths-filter@v3 id: filter with: filters: | code: - 'packages/**' - 'package.json' - 'pnpm-lock.yaml' - 'tsconfig.json' - 'turbo.json' - 'jest.config.*' ci: needs: check-changes if: needs.check-changes.outputs.should-run == 'true' runs-on: ubuntu-latest env: TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TEAM: ${{ vars.TURBO_TEAM }} 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 dependencies run: pnpm install --no-frozen-lockfile # 构建 framework 包 (可独立发布的通用库,无外部依赖) - name: Build framework packages run: | pnpm --filter @esengine/ecs-framework build pnpm --filter @esengine/ecs-framework-math build pnpm --filter @esengine/behavior-tree build pnpm --filter @esengine/blueprint build pnpm --filter @esengine/fsm build pnpm --filter @esengine/timer build pnpm --filter @esengine/spatial build pnpm --filter @esengine/procgen build pnpm --filter @esengine/pathfinding build pnpm --filter @esengine/network-protocols build pnpm --filter @esengine/network build # 类型检查 (仅 framework 包) - name: Type check (framework packages) run: pnpm run type-check:framework # Lint 检查 (仅 framework 包) - name: Lint check (framework packages) run: pnpm run lint:framework # 测试 (仅 framework 包) - name: Run tests with coverage run: pnpm run test:ci:framework - 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 包 (core 和 math) - name: Build npm packages run: | pnpm run build:npm:core pnpm run build:npm:math # 上传构建产物 - name: Upload build artifacts uses: actions/upload-artifact@v4 with: name: build-artifacts path: | packages/framework/**/dist/ packages/framework/**/bin/ retention-days: 7