ci + vercel: --legacy-peer-deps to tolerate webpack 4 / copy-webpack-… #27
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] | |
| pull_request: | |
| workflow_dispatch: | |
| 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 | |
| # 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 | |
| - name: Lint | |
| 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 |