Bring the simulator to mainline: circuit designer, board engine, tier… #87
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 | |
| # Check out the source repo so the drift check compares against a real | |
| # git tree (deterministic — no raw.githubusercontent CDN lag). | |
| - name: Checkout sb3-creator (source of vendored files) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: CrispStrobe/sb3-creator | |
| path: _sb3creator-src | |
| persist-credentials: false | |
| # Non-gating: emit a warning (not a failing step) if the vendored | |
| # compiler/examples drifted. Fix with `npm run sync:sb3creator`. | |
| - name: Check vendored sb3-creator is in sync | |
| run: | | |
| node scripts/sync-sb3creator.mjs --check --dir _sb3creator-src \ | |
| || echo "::warning::vendored sb3-creator drifted from source — run 'npm run sync:sb3creator'" | |
| # 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. | |
| # The upstream TurboWarp scratch-gui codebase has hundreds of pre-existing | |
| # lint errors (valid-jsdoc, no-unused-vars, react/prop-types, …) under the | |
| # strict eslint-config-scratch. We inherit them unchanged, so lint can't | |
| # gate. Surface it as a warning instead of a failing step (no red ✗). | |
| - name: Lint (informational, non-gating) | |
| run: | | |
| npm run test:lint || echo "::warning::eslint reported issues (pre-existing upstream, non-gating)" | |
| - 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 |