强化推送后远端检查规则 #8
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: Tooling | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| project-tooling: | |
| name: project-tooling | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Setup Node | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| cache-dependency-path: resources/webui/upstream/source/package-lock.json | |
| - name: Restore .NET tools | |
| run: dotnet tool restore | |
| - name: Restore .NET packages | |
| run: dotnet restore CodexCliPlus.sln | |
| - name: Build .NET | |
| run: dotnet build CodexCliPlus.sln --configuration Release --no-restore | |
| - name: Test .NET | |
| run: dotnet test tests/CodexCliPlus.Tests/CodexCliPlus.Tests.csproj --configuration Release --no-build --verbosity normal --filter "Category!=LiveBackend&Category!=Smoke" | |
| - name: Install web dependencies | |
| working-directory: resources/webui/upstream/source | |
| run: npm ci | |
| - name: Lint web | |
| working-directory: resources/webui/upstream/source | |
| run: npm run lint | |
| - name: Type-check web | |
| working-directory: resources/webui/upstream/source | |
| run: npm run type-check | |
| - name: Test web | |
| working-directory: resources/webui/upstream/source | |
| run: npm run test | |
| - name: Coverage web | |
| working-directory: resources/webui/upstream/source | |
| run: npm run coverage -- --coverage.reporter=text --coverage.reporter=json-summary --coverage.reporter=html | |
| - name: Enforce web coverage baseline | |
| working-directory: resources/webui/upstream/source | |
| shell: pwsh | |
| run: | | |
| $summaryPath = "coverage/coverage-summary.json" | |
| if (!(Test-Path $summaryPath)) { | |
| throw "Web coverage summary not found: $summaryPath" | |
| } | |
| $summary = Get-Content -Raw $summaryPath | ConvertFrom-Json | |
| $lineCoverage = [decimal]$summary.total.lines.pct | |
| $minimumLineCoverage = [decimal]80.0 | |
| if ($lineCoverage -lt $minimumLineCoverage) { | |
| throw "Web line coverage $lineCoverage% is below baseline $minimumLineCoverage%." | |
| } | |
| - name: Upload web coverage artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a | |
| with: | |
| name: web-coverage | |
| path: resources/webui/upstream/source/coverage | |
| if-no-files-found: warn | |
| - name: Check unused frontend surface | |
| working-directory: resources/webui/upstream/source | |
| run: npm run knip:strict |