name: CI on: push: branches: [ master, main, develop ] paths: - 'packages/**' - 'package.json' - 'package-lock.json' - 'tsconfig.json' - 'jest.config.*' - '.github/workflows/ci.yml' pull_request: branches: [ master, main, develop ] paths: - 'packages/**' - 'package.json' - 'package-lock.json' - 'tsconfig.json' - 'jest.config.*' - '.github/workflows/ci.yml' jobs: test: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20.x' cache: 'npm' - name: Install dependencies run: npm ci - name: Type check run: npm run type-check - name: Lint check run: npm run lint - name: Build core package first run: npm run build:core - name: Run tests with coverage run: npm 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 build: runs-on: ubuntu-latest needs: test steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20.x' cache: 'npm' - name: Install dependencies run: npm ci - name: Build project run: npm run build - name: Build npm package run: npm run build:npm - name: Upload build artifacts uses: actions/upload-artifact@v4 with: name: build-artifacts path: | bin/ dist/ retention-days: 7