fix: improve coverage for style injector and postcss #1614
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: [main, next] | |
| pull_request: | |
| types: [opened, synchronize] | |
| paths-ignore: | |
| - '**/*.md' | |
| - '.changeset/**' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ci-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| quality: | |
| name: Quality Gate (ubuntu-latest, 22) | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| # Remote Caching enabled - configure TURBO_TOKEN and TURBO_TEAM in repository settings | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
| E2E_SKIP_OPEN_AUTOMATOR: '1' | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 | |
| - uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Security Audit | |
| timeout-minutes: 3 | |
| run: timeout 180s pnpm audit --audit-level=moderate | |
| continue-on-error: true | |
| - name: Lint | |
| run: pnpm lint | |
| - name: Build | |
| run: pnpm ci:memory --label quality-build --max-rss-mb 5632 --max-rss-delta-mb 4608 -- pnpm build:ci | |
| - name: Test | |
| run: pnpm ci:memory --label quality-test-release --max-rss-mb 5632 --max-rss-delta-mb 4608 -- pnpm test:release | |
| - name: CI Status Note | |
| if: always() | |
| run: | | |
| { | |
| echo "## CI 状态说明" | |
| echo "- 本工作流负责:lint、build、unit/integration tests、coverage 上传。" | |
| echo "- 静态、专项、多平台 e2e 已拆分为并行 job,避免 Quality Gate 在单一 job 中串行等待全部 e2e。" | |
| echo "- \`pnpm e2e:ci\` 仍保留本地/专项使用,其中 hot-update/watch 覆盖由独立工作流承载。" | |
| echo "- \`E2E Watch Gate\` 负责主 CI 内的轻量跨平台 watch 覆盖,当前覆盖 linux、macOS、Windows。" | |
| echo "- \`Compatibility Gate\` 负责跨系统/多 Node 的核心回归,避免把全仓 lint/build 在每个矩阵里重复执行。" | |
| echo "- \`pnpm e2e:watch\` 的完整 PR/nightly 矩阵仍保留在独立工作流:\`E2E Watch\`(.github/workflows/e2e-watch.yml)。" | |
| echo "- website SEO 质量门禁已拆分到独立工作流:\`Website SEO Quality\`(.github/workflows/website-seo-quality.yml)。" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload CI memory reports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ci-memory-quality-${{ github.run_id }} | |
| path: e2e/benchmark/ci-memory/** | |
| if-no-files-found: ignore | |
| retention-days: 14 | |
| e2e-static: | |
| name: E2E Static Gate (${{ matrix.shard }}/${{ matrix.shard_total }}, ubuntu-latest, 22) | |
| timeout-minutes: 15 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3] | |
| shard_total: [3] | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
| E2E_SKIP_OPEN_AUTOMATOR: '1' | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 | |
| - uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm ci:memory --label e2e-static-build-${{ matrix.shard }} --max-rss-mb 5632 --max-rss-delta-mb 4608 -- pnpm build:ci | |
| - name: Install Playwright browsers | |
| run: | | |
| for attempt in 1 2 3 4; do | |
| if pnpm exec playwright install chromium; then | |
| exit 0 | |
| fi | |
| echo "Playwright Chromium install failed, retrying (${attempt}/4)" | |
| sleep $((attempt * 10)) | |
| done | |
| pnpm exec playwright install chromium | |
| - name: E2E Static | |
| run: pnpm ci:memory --label e2e-static-${{ matrix.shard }}-${{ matrix.shard_total }} --max-rss-mb 5632 --max-rss-delta-mb 4608 -- pnpm e2e:static --exclude e2e/taro-h5-build-smoke.test.ts --shard=${{ matrix.shard }}/${{ matrix.shard_total }} | |
| - name: Upload CI memory reports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ci-memory-e2e-static-${{ matrix.shard }}-${{ github.run_id }} | |
| path: e2e/benchmark/ci-memory/** | |
| if-no-files-found: ignore | |
| retention-days: 14 | |
| e2e-focused: | |
| name: E2E Focused Gate (${{ matrix.case_name }}) | |
| timeout-minutes: 20 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - case_name: generator-web-parity | |
| command: pnpm e2e:generator-parity | |
| - case_name: preprocessor-source | |
| command: pnpm e2e:preprocessor | |
| - case_name: framework-support | |
| command: pnpm exec cross-env E2E_FRAMEWORK_SUPPORT=1 vitest run -c ./e2e/vitest.e2e.config.ts e2e/framework-ci-support.test.ts | |
| - case_name: taro-h5-build | |
| command: pnpm e2e:taro:h5-build | |
| - case_name: web-css-preservation | |
| command: pnpm e2e:web-css-preservation | |
| - case_name: web-hmr | |
| command: pnpm e2e:web:hmr | |
| - case_name: demo-user-workflow | |
| command: pnpm e2e:demo-user-workflow | |
| - case_name: demo-platform-output-matrix | |
| command: pnpm exec vitest run -c ./e2e/vitest.e2e.config.ts e2e/e2e-matrix.test.ts | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
| E2E_SKIP_OPEN_AUTOMATOR: '1' | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 | |
| - uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm ci:memory --label e2e-focused-build-${{ matrix.case_name }} --max-rss-mb 5632 --max-rss-delta-mb 4608 -- pnpm build:ci | |
| - name: Install Playwright browsers | |
| run: | | |
| for attempt in 1 2 3 4; do | |
| if pnpm exec playwright install chromium; then | |
| exit 0 | |
| fi | |
| echo "Playwright Chromium install failed, retrying (${attempt}/4)" | |
| sleep $((attempt * 10)) | |
| done | |
| pnpm exec playwright install chromium | |
| - name: Run focused e2e | |
| run: pnpm ci:memory --label e2e-focused-${{ matrix.case_name }} --max-rss-mb 5632 --max-rss-delta-mb 4608 -- ${{ matrix.command }} | |
| - name: Upload CI memory reports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ci-memory-e2e-focused-${{ matrix.case_name }}-${{ github.run_id }} | |
| path: e2e/benchmark/ci-memory/** | |
| if-no-files-found: ignore | |
| retention-days: 14 | |
| e2e-multiplatform: | |
| name: E2E Multiplatform Gate (${{ matrix.case_name }}) | |
| timeout-minutes: ${{ matrix.timeout_minutes }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - case_name: build-output | |
| timeout_minutes: 25 | |
| command: pnpm e2e:multiplatform-build | |
| - case_name: taro-alipay-output | |
| timeout_minutes: 10 | |
| command: pnpm e2e:multiplatform-build:taro-alipay | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
| E2E_SKIP_OPEN_AUTOMATOR: '1' | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 | |
| - uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm ci:memory --label e2e-multiplatform-build-${{ matrix.case_name }} --max-rss-mb 5632 --max-rss-delta-mb 4608 -- pnpm build:ci | |
| - name: Install Playwright browsers | |
| run: | | |
| for attempt in 1 2 3 4; do | |
| if pnpm exec playwright install chromium; then | |
| exit 0 | |
| fi | |
| echo "Playwright Chromium install failed, retrying (${attempt}/4)" | |
| sleep $((attempt * 10)) | |
| done | |
| pnpm exec playwright install chromium | |
| - name: Run multiplatform e2e | |
| run: pnpm ci:memory --label e2e-multiplatform-${{ matrix.case_name }} --max-rss-mb 5632 --max-rss-delta-mb 4608 -- ${{ matrix.command }} | |
| - name: Upload CI memory reports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ci-memory-e2e-multiplatform-${{ matrix.case_name }}-${{ github.run_id }} | |
| path: e2e/benchmark/ci-memory/** | |
| if-no-files-found: ignore | |
| retention-days: 14 | |
| e2e-watch: | |
| name: E2E Watch Gate (${{ matrix.runner_label }}, ${{ matrix.watch_case }}, ${{ matrix.round_profile }}) | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: ${{ matrix.timeout_minutes }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| runner_label: linux | |
| node-version: 22 | |
| watch_case: uni-app-vite-tailwindcss-v4 | |
| round_profile: default | |
| watch_save_snapshots: '1' | |
| watch_web_only: '1' | |
| timeout_minutes: 40 | |
| watch_timeout_ms: '280000' | |
| watch_poll_ms: '40' | |
| watch_command_timeout_ms: '720000' | |
| - os: macos-latest | |
| runner_label: macos | |
| node-version: 22 | |
| watch_case: uni-app-vite-tailwindcss-v4 | |
| round_profile: default | |
| watch_save_snapshots: '1' | |
| watch_web_only: '1' | |
| timeout_minutes: 45 | |
| watch_timeout_ms: '420000' | |
| watch_poll_ms: '40' | |
| watch_command_timeout_ms: '960000' | |
| - os: macos-latest | |
| runner_label: macos | |
| node-version: 22 | |
| watch_case: uni-app-vite-tailwindcss-v4:mp-weixin | |
| artifact_case: uni-app-vite-tailwindcss-v4-mp-weixin | |
| round_profile: default | |
| watch_save_snapshots: '1' | |
| timeout_minutes: 60 | |
| watch_timeout_ms: '420000' | |
| watch_poll_ms: '40' | |
| watch_max_plugin_process_ms: '9000' | |
| watch_command_timeout_ms: '1500000' | |
| - os: windows-latest | |
| runner_label: windows | |
| node-version: 22 | |
| watch_case: uni-app-vite-tailwindcss-v4 | |
| round_profile: default | |
| watch_save_snapshots: '1' | |
| watch_web_only: '1' | |
| timeout_minutes: 45 | |
| watch_timeout_ms: '420000' | |
| watch_poll_ms: '40' | |
| watch_command_timeout_ms: '960000' | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: pnpm | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Install Playwright Chromium | |
| shell: bash | |
| run: | | |
| for attempt in 1 2 3 4; do | |
| if pnpm --filter @weapp-tailwindcss/scripts exec playwright install chromium; then | |
| exit 0 | |
| fi | |
| echo "Playwright Chromium install failed, retrying (${attempt}/4)" | |
| sleep $((attempt * 10)) | |
| done | |
| pnpm --filter @weapp-tailwindcss/scripts exec playwright install chromium | |
| - name: Build watch suite package dependencies | |
| run: pnpm build:ci | |
| - name: Prepare benchmark output directory | |
| shell: bash | |
| run: | | |
| rm -f e2e/benchmark/e2e-watch-hmr/*.json | |
| rm -rf e2e/benchmark/e2e-watch-hmr/snapshots | |
| rm -rf e2e/benchmark/e2e-watch-hmr/failures | |
| mkdir -p e2e/benchmark/e2e-watch-hmr/snapshots | |
| mkdir -p e2e/benchmark/e2e-watch-hmr/failures | |
| - name: Run e2e watch suite (CI cross-platform gate) | |
| env: | |
| E2E_WATCH_CASE: ${{ matrix.watch_case }} | |
| E2E_WATCH_TIMEOUT_MS: ${{ matrix.watch_timeout_ms }} | |
| E2E_WATCH_POLL_MS: ${{ matrix.watch_poll_ms }} | |
| E2E_WATCH_MAX_HOT_UPDATE_MS: ${{ matrix.watch_max_hot_update_ms || matrix.watch_timeout_ms }} | |
| E2E_WATCH_MAX_PLUGIN_PROCESS_MS: ${{ matrix.watch_max_plugin_process_ms || '6000' }} | |
| E2E_WATCH_MAX_MEMORY_RSS_MB: ${{ matrix.watch_max_memory_rss_mb || '5632' }} | |
| E2E_WATCH_MAX_MEMORY_RSS_DELTA_MB: ${{ matrix.watch_max_memory_rss_delta_mb || '4608' }} | |
| E2E_WATCH_MAX_MEMORY_HEAP_USED_MB: ${{ matrix.watch_max_memory_heap_used_mb || '4096' }} | |
| E2E_WATCH_COMMAND_TIMEOUT_MS: ${{ matrix.watch_command_timeout_ms }} | |
| E2E_WATCH_MAX_ATTEMPTS: ${{ matrix.watch_max_attempts || '2' }} | |
| E2E_WATCH_ROUND_PROFILE: ${{ matrix.round_profile }} | |
| E2E_WATCH_WEB_ONLY: ${{ matrix.watch_web_only || '0' }} | |
| E2E_WATCH_SAVE_SNAPSHOTS: ${{ matrix.watch_save_snapshots }} | |
| WEAPP_TW_HMR_MEMORY_DEBUG: '1' | |
| NODE_OPTIONS: --max-old-space-size=6144 | |
| run: pnpm e2e:watch | |
| - name: Generate failure diff summary | |
| if: failure() | |
| shell: bash | |
| run: node .github/scripts/e2e-watch-report.cjs diff-summary | |
| - name: Generate root cause attribution report | |
| if: failure() | |
| shell: bash | |
| env: | |
| WATCH_CASE: ${{ matrix.watch_case }} | |
| run: node .github/scripts/e2e-watch-report.cjs root-cause-report | |
| - name: Publish job summary | |
| if: always() | |
| shell: bash | |
| run: node .github/scripts/e2e-watch-report.cjs job-summary | |
| env: | |
| SUMMARY_TITLE: e2e-watch CI cross-platform gate | |
| WATCH_CASE: ${{ matrix.watch_case }} | |
| ROUND_PROFILE: ${{ matrix.round_profile }} | |
| - name: Upload e2e watch reports (always) | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: e2e-watch-hmr-ci-${{ matrix.runner_label }}-node${{ matrix.node-version }}-${{ matrix.artifact_case || matrix.watch_case }}-${{ matrix.round_profile }}-${{ github.run_id }} | |
| path: | | |
| e2e/benchmark/e2e-watch-hmr/*.json | |
| e2e/benchmark/e2e-watch-hmr/hmr-speed-report.md | |
| e2e/benchmark/e2e-watch-hmr/hmr-memory-report.md | |
| if-no-files-found: ignore | |
| retention-days: 14 | |
| - name: Upload e2e watch failure artifacts | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: e2e-watch-hmr-ci-failure-${{ matrix.runner_label }}-node${{ matrix.node-version }}-${{ matrix.artifact_case || matrix.watch_case }}-${{ matrix.round_profile }}-${{ github.run_id }} | |
| path: | | |
| e2e/benchmark/e2e-watch-hmr/snapshots/** | |
| e2e/benchmark/e2e-watch-hmr/failures/** | |
| if-no-files-found: ignore | |
| retention-days: 14 | |
| compatibility: | |
| name: Compatibility Gate (${{ matrix.os }}, ${{ matrix.node-version }}, ${{ matrix.scenario }}) | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJSON(github.event_name == 'workflow_dispatch' && '[{"os":"ubuntu-latest","node-version":20,"scenario":"node20-core"},{"os":"ubuntu-latest","node-version":24,"scenario":"node24-core"},{"os":"windows-latest","node-version":20,"scenario":"windows-node20-core"},{"os":"windows-latest","node-version":22,"scenario":"windows-node22-core"},{"os":"windows-latest","node-version":24,"scenario":"windows-node24-core"},{"os":"macos-latest","node-version":22,"scenario":"macos-node22-core"}]' || '[{"os":"windows-latest","node-version":22,"scenario":"windows-node22-core"}]') }} | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 | |
| - uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: pnpm | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build core package dependency closure | |
| run: pnpm build:ci | |
| - name: Run core compatibility regression tests | |
| run: > | |
| pnpm --filter weapp-tailwindcss exec vitest run | |
| test/bundlers/module-graph.unit.test.ts | |
| test/bundlers/vite-bundle-entries.unit.test.ts | |
| test/bundlers/vite-plugin.uni-app-x.unit.test.ts | |
| test/bundlers/webpack.v5.unit.test.ts | |
| test/bundlers/webpack.v5.unit/source-candidate-cache.test.ts | |
| test/tailwindcss/patcher-resolve.test.ts | |
| test/tailwindcss/targets.log.test.ts | |
| test/watch-hmr-coverage-matrix.unit.test.ts | |
| test/watch-hmr-regression.unit.test.ts | |
| - name: Compatibility Status Note | |
| if: always() | |
| run: | | |
| { | |
| echo "## Compatibility Gate" | |
| echo "- os: ${{ matrix.os }}" | |
| echo "- node: ${{ matrix.node-version }}" | |
| echo "- scenario: ${{ matrix.scenario }}" | |
| echo "- 覆盖重点:Windows/跨平台路径归一、Vite bundle graph、Tailwind patch resolve、watch HMR 覆盖矩阵。" | |
| } >> "$GITHUB_STEP_SUMMARY" |