✨ 安全重构 ScriptCat MCP 桥接:sctl 本地守护进程、分级授权与人工确认 #5552
Workflow file for this run
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: test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release/* | |
| - develop/* | |
| pull_request: | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| name: Lint | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| - name: Setup pnpm | |
| env: | |
| COREPACK_ENABLE_DOWNLOAD_PROMPT: 0 | |
| run: | | |
| corepack enable | |
| corepack install | |
| pnpm --version | |
| - name: Get pnpm store path | |
| id: pnpm-store | |
| shell: bash | |
| run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT" | |
| - name: Cache pnpm store | |
| uses: actions/cache@v6 | |
| with: | |
| path: ${{ steps.pnpm-store.outputs.path }} | |
| key: ${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('package.json', 'pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ runner.arch }}-pnpm- | |
| - name: Install dependencies | |
| run: pnpm i --frozen-lockfile | |
| - name: Cache ESLint cache | |
| uses: actions/cache@v6 | |
| with: | |
| path: .eslintcache | |
| key: eslint-${{ hashFiles('pnpm-lock.yaml', '.eslintrc*') }} | |
| restore-keys: | | |
| eslint- | |
| - name: Lint | |
| run: pnpm lint:ci | |
| test-shards: | |
| runs-on: ubuntu-latest | |
| name: Run test shard (${{ matrix.shardIndex }}/${{ matrix.shardTotal }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shardIndex: [1, 2] | |
| shardTotal: [2] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| - name: Setup pnpm | |
| env: | |
| COREPACK_ENABLE_DOWNLOAD_PROMPT: 0 | |
| run: | | |
| corepack enable | |
| corepack install | |
| pnpm --version | |
| - name: Get pnpm store path | |
| id: pnpm-store | |
| shell: bash | |
| run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT" | |
| - name: Cache pnpm store | |
| uses: actions/cache@v6 | |
| with: | |
| path: ${{ steps.pnpm-store.outputs.path }} | |
| key: ${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('package.json', 'pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ runner.arch }}-pnpm- | |
| - name: Install dependencies | |
| run: pnpm i --frozen-lockfile | |
| - name: Run test shard | |
| run: > | |
| pnpm exec vitest run | |
| --coverage | |
| --silent | |
| --reporter=blob | |
| --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} | |
| - name: Upload blob report | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: vitest-report-${{ matrix.shardIndex }} | |
| path: .vitest-reports/* | |
| include-hidden-files: true | |
| retention-days: 1 | |
| tests: | |
| runs-on: ubuntu-latest | |
| name: Run tests | |
| needs: [lint, test-shards] | |
| if: ${{ !cancelled() }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| - name: Setup pnpm | |
| env: | |
| COREPACK_ENABLE_DOWNLOAD_PROMPT: 0 | |
| run: | | |
| corepack enable | |
| corepack install | |
| pnpm --version | |
| - name: Get pnpm store path | |
| id: pnpm-store | |
| shell: bash | |
| run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT" | |
| - name: Cache pnpm store | |
| uses: actions/cache@v6 | |
| with: | |
| path: ${{ steps.pnpm-store.outputs.path }} | |
| key: ${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('package.json', 'pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ runner.arch }}-pnpm- | |
| - name: Install dependencies | |
| run: pnpm i --frozen-lockfile | |
| - name: Download blob reports | |
| uses: actions/download-artifact@v6 | |
| with: | |
| pattern: vitest-report-* | |
| path: .vitest-reports | |
| merge-multiple: true | |
| - name: Merge test and coverage reports | |
| run: > | |
| pnpm exec vitest | |
| --merge-reports | |
| --coverage | |
| --reporter=default | |
| --reporter.default.summary=false | |
| - name: Verify prerequisite jobs | |
| if: ${{ always() && (needs.lint.result != 'success' || needs.test-shards.result != 'success') }} | |
| run: exit 1 | |
| - name: Upload coverage reports to Codecov with GitHub Action | |
| uses: codecov/codecov-action@v5 | |
| e2e: | |
| runs-on: ubuntu-latest | |
| name: Run E2E tests (${{ matrix.shardIndex }}/${{ matrix.shardTotal }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shardIndex: [1, 2, 3, 4] | |
| shardTotal: [4] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| - name: Setup pnpm | |
| env: | |
| COREPACK_ENABLE_DOWNLOAD_PROMPT: 0 | |
| run: | | |
| corepack enable | |
| corepack install | |
| pnpm --version | |
| - name: Get pnpm store path | |
| id: pnpm-store | |
| shell: bash | |
| run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT" | |
| - name: Cache pnpm store | |
| uses: actions/cache@v6 | |
| with: | |
| path: ${{ steps.pnpm-store.outputs.path }} | |
| key: ${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('package.json', 'pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ runner.arch }}-pnpm- | |
| - name: Show runner CPU count | |
| run: nproc | |
| - name: Install dependencies | |
| run: pnpm i --frozen-lockfile | |
| - name: Cache Playwright browsers | |
| id: playwright-cache | |
| uses: actions/cache@v6 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| playwright- | |
| - name: Install Playwright Chromium | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| run: pnpm test:e2e:install | |
| - name: Build extension | |
| run: pnpm build | |
| - name: Run E2E tests | |
| run: pnpm exec playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} | |
| - name: Upload test artifacts | |
| if: failure() | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: e2e-test-results-${{ matrix.shardIndex }} | |
| path: | | |
| test-results/ | |
| playwright-report/ | |
| retention-days: 14 |