Sync vendored sb3-creator (dead-code fix in dval) #38
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: [develop] | |
| paths-ignore: ['**.md', 'docs/**'] | |
| pull_request: | |
| paths-ignore: ['**.md', 'docs/**'] | |
| workflow_dispatch: | |
| # A new push to the same branch/PR cancels the previous (still-building) run | |
| # instead of queuing another 8 GB webpack build behind it. | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Lint + build smoke test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| # --ignore-scripts dodges the upstream prepublish.mjs micro:bit-firmware | |
| # download (often times out); --include=dev is required because Vercel / | |
| # CI default NODE_ENV=production strips devDependencies, including | |
| # webpack-cli. | |
| # --legacy-peer-deps tolerates the copy-webpack-plugin@14 / webpack@4 | |
| # peer-dep mismatch that the npm audit fix introduced (we're stuck on | |
| # webpack 4 until a real upstream-modernisation pass). | |
| - name: Install | |
| run: npm install --ignore-scripts --include=dev --legacy-peer-deps --no-audit --no-fund | |
| # eslint-config-scratch 9.x requires @babel/eslint-parser but the | |
| # project's package.json still pins the older babel-eslint. Install | |
| # @babel/eslint-parser on the side so test:lint can resolve. | |
| - name: Install ESLint parser missing from package.json | |
| run: npm install --no-save --legacy-peer-deps --no-audit --no-fund @babel/eslint-parser | |
| # Informational: flag if the vendored SB3 Creator compiler/examples have | |
| # drifted from the source repo. Fix with `npm run sync:sb3creator`. | |
| - name: Check vendored sb3-creator is in sync | |
| continue-on-error: true | |
| run: npm run sync:sb3creator:check | |
| # The micro:bit firmware-flasher imports a generated file that is not | |
| # produced by --ignore-scripts. Stub it; the flasher path won't function | |
| # but every other code path is unaffected. | |
| - name: Stub micro:bit firmware URL | |
| run: | | |
| mkdir -p src/generated | |
| printf "module.exports = '';\n" > src/generated/microbit-hex-url.cjs | |
| # Informational only — the upstream TurboWarp scratch-gui codebase has | |
| # hundreds of pre-existing lint errors (valid-jsdoc, no-unused-vars, | |
| # react/prop-types, …) that we inherit unchanged. Surfacing the count | |
| # in the CI summary without gating PRs on it. | |
| - name: Lint (informational) | |
| continue-on-error: true | |
| run: npm run test:lint | |
| - name: Build (CI=true to suppress webpack ProgressPlugin output flood) | |
| env: | |
| CI: "true" | |
| NODE_ENV: production | |
| NODE_OPTIONS: "--max-old-space-size=8192" | |
| run: npx webpack --bail | |
| - name: Sanity-check build output | |
| run: | | |
| set -e | |
| test -s build/index.html | |
| test -s build/editor.html | |
| test -s build/player.html | |
| # index.html should load the editor chunk (post-splash-relocation) | |
| grep -q 'js/pentapod/editor\.[a-z0-9]\+\.js' build/index.html || ( | |
| echo "index.html does not load the editor chunk"; exit 1 | |
| ) | |
| - name: Unit tests | |
| run: npm run test:unit |