Repository navigation
222 lines (192 loc) · 9.7 KB
/
Copy pathnode.js.yml
File metadata and controls
222 lines (192 loc) · 9.7 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: Node.js CI
on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]
jobs:
# Installs, builds, runs the unit tests, lint and typechecks once per OS, then hands the built workspace to the
# end-to-end jobs below, which run in parallel
build:
runs-on: ${{ matrix.os }}
permissions:
# Required to checkout the code
contents: read
strategy:
matrix:
node-version: [24.x]
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: |
package-lock.json
packages/multiplayer-template/package-lock.json
- name: Build and test
run: |
npm ci
npm run build
npm run test
- name: Lint
run: npm run lint
- name: Typecheck bootstrap
run: npm run typecheck
working-directory: ./packages/bootstrap
# Needs core's dist from the build step, the snapshot types come from there
- name: Typecheck cli
run: npm run typecheck
working-directory: ./packages/cli
- name: Typecheck http-monitoring plugin
run: npm run typecheck
working-directory: ./packages/plugins/http-monitoring
- name: Typecheck sqlite plugin
run: npm run typecheck
working-directory: ./packages/plugins/sqlite
- name: Typecheck mail plugin
run: npm run typecheck
working-directory: ./packages/plugins/mail
- name: Typecheck notifications plugin
run: npm run typecheck
working-directory: ./packages/plugins/notifications
# Run the built file directly: npm ci runs before the build, so npm skipped
# linking the `mavonengine` bin (its target didn't exist yet) and npx would
# fall back to looking it up on the registry
- name: Smoke test cli binary
run: |
node dist/index.js --version
node dist/index.js --help
node dist/index.js dashboard --help
node dist/index.js doctor --help
node dist/index.js upgrade --help
working-directory: ./packages/cli
- name: npm link core locally
run: |
npm link
working-directory: ./packages/core
# The template's `npm run dev` is `mavonengine dev`, so it runs this repository's CLI
- name: npm link cli locally
run: |
npm link
working-directory: ./packages/cli
- name: npm link editor locally
run: |
npm link
working-directory: ./packages/editor
# multiplayer-template has its own nested workspaces (client/server) that npm
# workspaces does not handle recursively, so we need a separate npm ci here.
# Both in one call: each `npm link <pkg>` replaces the links of an earlier one.
# The editor is linked for the editor dist test; the other steps alias it to its src/
- name: Build multiplayer-template
run: |
npm link @mavonengine/core @mavonengine/cli @mavonengine/editor
npm run typecheck
npm run build
npm run lint
working-directory: ./packages/multiplayer-template
# `npm run dev` is `mavonengine dev`; without a terminal it runs the dev:server script without the dashboard
- name: Start dev servers and verify startup
timeout-minutes: 2
run: node e2e/dev-startup.mjs
# Links don't survive an archive on every OS: this records and removes them, the e2e jobs put them back.
# Fails if the template doesn't use the local build of core, cli and editor
- name: Pack the built workspace
shell: bash
run: |
node e2e/ci-workspace.mjs save
tar -cf workspace.tar --exclude=.git --exclude=workspace.tar .
- name: Upload the built workspace
uses: actions/upload-artifact@v7
with:
name: workspace-${{ matrix.os }}
path: workspace.tar
retention-days: 1
e2e:
name: e2e ${{ matrix.test.name }} (${{ matrix.os }})
needs: build
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
# One failing test doesn't cancel the others
fail-fast: false
matrix:
node-version: [24.x]
os: [ubuntu-latest, windows-latest]
test:
# Installs e2e/plugin/hello-plugin into the template with `mavonengine install`, then checks it on the
# dev server, in `mavonengine build`'s release and on the production server. Uses an npm stub for the
# install, since a real one would replace the npm-linked @mavonengine/core
- { name: plugin, dir: plugin }
# Generates a plugin in the template with `mavonengine make:plugin`, typechecks it, then checks that the dev
# server runs its TypeScript server entry as it is and Vite compiles its client entry, without a build step
- { name: make-plugin, dir: make-plugin }
# Boots the template's game server in production with @mavonengine/http-monitoring and an htpasswd
# login, then opens the dashboard in the runner's preinstalled Chrome and goes through every tab
- { name: monitoring, dir: http-monitoring }
# Boots the template's game server with the built @mavonengine/sqlite and a plugin that migrates and writes:
# the database file, ctx.db, GET /api/game/database, the data after a restart, and the server without the plugin
- { name: sqlite, dir: sqlite }
# Boots the template's game server with a stub auth plugin and sends geckos' connection request the way a client
# does: refused tokens get the plugin's status, the right one its identity, and a missing auth plugin locks everyone out.
# Then the built @mavonengine/auth on sqlite: register, connect as the account, a restart, disabling the account.
# Last, in the runner's Chrome: a tab without a session is refused, a registered player and a guest join the game
- { name: auth, dir: auth }
# Boots the template's game server with the built queue, mail, notifications and auth plugins on sqlite, mailing
# over SMTP to a small SMTP server in the test: confirming an email and resetting a password with the mailed links,
# a notification kept and mailed, a layout published with asset:publish, and a mail that waits on the queue in the
# database while the mail server is down, through a restart
- { name: mail, dir: mail }
# Boots the template's game server in dev, which loads scenes/main.json, and in the runner's Chrome: a player
# gets the scene and the server's trees, an editor drops out as a player, and saving the scene in the editor
# reloads it on the server and in both clients. Last, an editor opened from the main menu without joining
- { name: scenes, dir: scenes }
# Boots the template's game server in dev, joins in the runner's Chrome and drives `mavonengine mcp`
# over stdio like an AI assistant: server and client tools, the dev bridge and compare_entity
- { name: mcp, dir: mcp }
# The template aliases core and the editor to their src/, so nothing above loads their dist/. This runs
# the template against the built packages, like a project that installed them, and opens the editor
- { name: editor-dist, dir: editor-dist }
# `mavonengine doctor` on the template, against a fake npm registry in the test that knows a newer core and two
# versions of a fixture plugin: a plugin made for a newer core fails it and gets pointed to the version that fits,
# the game server warns about it and loads it anyway, and a registry that can't be reached is only a warning
- { name: doctor, dir: doctor }
# `mavonengine upgrade` on the template turned back into a project from before core 0.0.22, with the doctor test's
# fake registry and npm as a recorder: the dry run changes nothing, --yes installs the registry's versions, writes
# and records both migrations and passes doctor, a second run has nothing to do, and the client builds with its title
- { name: upgrade, dir: upgrade }
# Boots the template's game server in dev and plays it in VR, with an emulated Meta Quest 3 (iwer) in the runner's
# Chrome: the Enter VR button, rendering through the session, both controllers, walking the character through
# the server with the left stick, the chase view following it, a snap turn, and the desktop controls after leaving
- { name: xr, dir: xr }
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
- name: Download the built workspace
uses: actions/download-artifact@v8
with:
name: workspace-${{ matrix.os }}
# Puts the links back and fails if the template doesn't resolve core, cli and editor to the local build
- name: Unpack the built workspace
shell: bash
run: |
tar -xf workspace.tar
rm workspace.tar
node e2e/ci-workspace.mjs restore
# Windows runners render in software and compile shaders far slower: the scenes test alone waits for three page
# loads that may each take two minutes there, and ran out of 5 minutes on its last section
- name: End-to-end test
timeout-minutes: ${{ matrix.os == 'windows-latest' && 10 || 5 }}
run: npm run test:${{ matrix.test.name }}-e2e
- name: Upload screenshots
if: failure()
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.test.name }}-e2e-screenshots-${{ matrix.os }}
path: e2e/${{ matrix.test.dir }}/screenshots
if-no-files-found: ignore