refactor(core): simplify model JSON parsing #9106
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| main: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [24.13.0] | |
| # do NOT provide API keys here. The test cases should not rely on any API keys. | |
| # env: | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@eae0cfeb286e66ffb5155f1a79b90583a127a68b # v2.4.1 | |
| with: | |
| version: 9.3.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: '24.13.0' | |
| - name: Cache Puppeteer dependencies | |
| uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0 | |
| id: cache-puppeteer | |
| with: | |
| path: ~/.cache/puppeteer | |
| key: ${{ runner.os }}-puppeteer-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-puppeteer- | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile --ignore-scripts | |
| - name: Install puppeteer dependencies | |
| run: | | |
| cd packages/web-integration | |
| npx puppeteer browsers install chrome | |
| - name: Check tsconfig references | |
| run: pnpm run check:references | |
| - name: Build project | |
| run: pnpm run build | |
| - name: Check CLI CJS bundle on minimum supported Node | |
| run: | | |
| node - <<'EOF' | |
| const { readdirSync, readFileSync, statSync } = require('node:fs'); | |
| const { join } = require('node:path'); | |
| const root = 'packages/cli/dist/lib'; | |
| const files = []; | |
| const collectJsFiles = (dir) => { | |
| for (const entry of readdirSync(dir)) { | |
| const file = join(dir, entry); | |
| if (statSync(file).isDirectory()) { | |
| collectJsFiles(file); | |
| } else if (file.endsWith('.js')) { | |
| files.push(file); | |
| } | |
| } | |
| }; | |
| collectJsFiles(root); | |
| const staticRequirePatterns = [ | |
| { | |
| name: '@rstest/core', | |
| pattern: /require\((['"])@rstest\/core(?:\/[^'"]*)?\1\)/, | |
| }, | |
| { | |
| name: '@rsbuild/core', | |
| pattern: /require\((['"])@rsbuild\/core(?:\/[^'"]*)?\1\)/, | |
| }, | |
| ]; | |
| for (const file of files) { | |
| const content = readFileSync(file, 'utf8'); | |
| for (const { name, pattern } of staticRequirePatterns) { | |
| if (pattern.test(content)) { | |
| throw new Error(`${file} contains a static require("${name}")`); | |
| } | |
| } | |
| } | |
| EOF | |
| npx -y node@20.19.0 packages/cli/dist/lib/index.js --version | |
| - name: Type check tests | |
| run: pnpm run type-check:tests | |
| - name: Run tests with coverage | |
| run: pnpm run test:coverage | |
| - name: Upload coverage reports | |
| id: upload-coverage | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: coverage | |
| path: coverage | |
| if-no-files-found: ignore | |
| - name: Write coverage summary | |
| if: always() | |
| env: | |
| COVERAGE_ARTIFACT_URL: ${{ steps.upload-coverage.outputs.artifact-url }} | |
| run: node scripts/github-coverage-summary.js |