forked from scratchfoundation/scratch-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (91 loc) · 4.16 KB
/
Copy pathnode.js.yml
File metadata and controls
105 lines (91 loc) · 4.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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