@quenty/nevermore-cli 4.41.1 → 4.42.1-canary.783.30683193716.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/args/global-args.d.ts +13 -0
- package/dist/args/global-args.d.ts.map +1 -1
- package/dist/commands/batch-command/batch-deploy-command.d.ts +3 -0
- package/dist/commands/batch-command/batch-deploy-command.d.ts.map +1 -1
- package/dist/commands/batch-command/batch-deploy-command.js +90 -1
- package/dist/commands/batch-command/batch-deploy-command.js.map +1 -1
- package/dist/commands/batch-command/batch-test-command.d.ts.map +1 -1
- package/dist/commands/batch-command/batch-test-command.js +25 -4
- package/dist/commands/batch-command/batch-test-command.js.map +1 -1
- package/dist/commands/deploy-command/deploy-init.js +1 -1
- package/dist/commands/deploy-command/deploy-init.js.map +1 -1
- package/dist/commands/deploy-command/index.d.ts +3 -0
- package/dist/commands/deploy-command/index.d.ts.map +1 -1
- package/dist/commands/deploy-command/index.js +297 -60
- package/dist/commands/deploy-command/index.js.map +1 -1
- package/dist/commands/deploy-command/select-target.js +1 -1
- package/dist/commands/deploy-command/select-target.js.map +1 -1
- package/dist/commands/deploy-command/version-command.d.ts.map +1 -1
- package/dist/commands/deploy-command/version-command.js +138 -12
- package/dist/commands/deploy-command/version-command.js.map +1 -1
- package/dist/commands/test-command/test-command.d.ts.map +1 -1
- package/dist/commands/test-command/test-command.js +23 -11
- package/dist/commands/test-command/test-command.js.map +1 -1
- package/dist/nevermore.js +17 -0
- package/dist/nevermore.js.map +1 -1
- package/dist/utils/batch/changed-packages-utils.d.ts +1 -1
- package/dist/utils/batch/changed-packages-utils.d.ts.map +1 -1
- package/dist/utils/batch/changed-packages-utils.js +1 -1
- package/dist/utils/batch/changed-packages-utils.js.map +1 -1
- package/dist/utils/build/base-place-resolver-factory.d.ts +25 -0
- package/dist/utils/build/base-place-resolver-factory.d.ts.map +1 -0
- package/dist/utils/build/base-place-resolver-factory.js +40 -0
- package/dist/utils/build/base-place-resolver-factory.js.map +1 -0
- package/dist/utils/build/build.d.ts +13 -2
- package/dist/utils/build/build.d.ts.map +1 -1
- package/dist/utils/build/build.js.map +1 -1
- package/dist/utils/build/upload.d.ts +1 -1
- package/dist/utils/build/upload.d.ts.map +1 -1
- package/dist/utils/deploy/deploy-metadata.d.ts +1 -1
- package/dist/utils/deploy/deploy-metadata.d.ts.map +1 -1
- package/dist/utils/job-context/base-job-context.d.ts +3 -1
- package/dist/utils/job-context/base-job-context.d.ts.map +1 -1
- package/dist/utils/job-context/base-job-context.js +45 -6
- package/dist/utils/job-context/base-job-context.js.map +1 -1
- package/dist/utils/job-context/batch-script-job-context.d.ts +6 -0
- package/dist/utils/job-context/batch-script-job-context.d.ts.map +1 -1
- package/dist/utils/job-context/batch-script-job-context.js +13 -0
- package/dist/utils/job-context/batch-script-job-context.js.map +1 -1
- package/dist/utils/job-context/cloud-job-context.d.ts +2 -1
- package/dist/utils/job-context/cloud-job-context.d.ts.map +1 -1
- package/dist/utils/job-context/cloud-job-context.js +2 -2
- package/dist/utils/job-context/cloud-job-context.js.map +1 -1
- package/dist/utils/job-context/local-job-context.d.ts +2 -1
- package/dist/utils/job-context/local-job-context.d.ts.map +1 -1
- package/dist/utils/job-context/local-job-context.js +2 -2
- package/dist/utils/job-context/local-job-context.js.map +1 -1
- package/dist/utils/open-cloud/open-cloud-client.d.ts +20 -2
- package/dist/utils/open-cloud/open-cloud-client.d.ts.map +1 -1
- package/dist/utils/open-cloud/open-cloud-client.js +78 -21
- package/dist/utils/open-cloud/open-cloud-client.js.map +1 -1
- package/dist/utils/open-cloud/open-cloud-client.test.js +89 -12
- package/dist/utils/open-cloud/open-cloud-client.test.js.map +1 -1
- package/dist/utils/testing/parsers/batch-log-parser.d.ts +13 -5
- package/dist/utils/testing/parsers/batch-log-parser.d.ts.map +1 -1
- package/dist/utils/testing/parsers/batch-log-parser.js +114 -68
- package/dist/utils/testing/parsers/batch-log-parser.js.map +1 -1
- package/dist/utils/testing/parsers/batch-log-parser.test.js +57 -5
- package/dist/utils/testing/parsers/batch-log-parser.test.js.map +1 -1
- package/dist/utils/testing/parsers/traceback-parser.d.ts +31 -0
- package/dist/utils/testing/parsers/traceback-parser.d.ts.map +1 -0
- package/dist/utils/testing/parsers/traceback-parser.js +91 -0
- package/dist/utils/testing/parsers/traceback-parser.js.map +1 -0
- package/dist/utils/testing/parsers/traceback-parser.test.d.ts +2 -0
- package/dist/utils/testing/parsers/traceback-parser.test.d.ts.map +1 -0
- package/dist/utils/testing/parsers/traceback-parser.test.js +45 -0
- package/dist/utils/testing/parsers/traceback-parser.test.js.map +1 -0
- package/dist/utils/testing/runner/combined-project-generator.d.ts +1 -1
- package/dist/utils/testing/runner/combined-project-generator.d.ts.map +1 -1
- package/dist/utils/testing/runner/test-runner.d.ts +9 -1
- package/dist/utils/testing/runner/test-runner.d.ts.map +1 -1
- package/dist/utils/testing/runner/test-runner.js +28 -3
- package/dist/utils/testing/runner/test-runner.js.map +1 -1
- package/dist/utils/testing/runner/test-runner.test.d.ts +2 -0
- package/dist/utils/testing/runner/test-runner.test.d.ts.map +1 -0
- package/dist/utils/testing/runner/test-runner.test.js +18 -0
- package/dist/utils/testing/runner/test-runner.test.js.map +1 -0
- package/dist/utils/testing/test-log-parser.d.ts +32 -1
- package/dist/utils/testing/test-log-parser.d.ts.map +1 -1
- package/dist/utils/testing/test-log-parser.js +53 -9
- package/dist/utils/testing/test-log-parser.js.map +1 -1
- package/dist/utils/testing/test-log-parser.test.d.ts +2 -0
- package/dist/utils/testing/test-log-parser.test.d.ts.map +1 -0
- package/dist/utils/testing/test-log-parser.test.js +56 -0
- package/dist/utils/testing/test-log-parser.test.js.map +1 -0
- package/dist/utils/watch/github-context.d.ts +50 -0
- package/dist/utils/watch/github-context.d.ts.map +1 -0
- package/dist/utils/watch/github-context.js +125 -0
- package/dist/utils/watch/github-context.js.map +1 -0
- package/dist/utils/watch/github-context.test.d.ts +2 -0
- package/dist/utils/watch/github-context.test.d.ts.map +1 -0
- package/dist/utils/watch/github-context.test.js +112 -0
- package/dist/utils/watch/github-context.test.js.map +1 -0
- package/dist/utils/watch/http-watch-registry.d.ts +40 -0
- package/dist/utils/watch/http-watch-registry.d.ts.map +1 -0
- package/dist/utils/watch/http-watch-registry.js +262 -0
- package/dist/utils/watch/http-watch-registry.js.map +1 -0
- package/dist/utils/watch/http-watch-registry.test.d.ts +2 -0
- package/dist/utils/watch/http-watch-registry.test.d.ts.map +1 -0
- package/dist/utils/watch/http-watch-registry.test.js +211 -0
- package/dist/utils/watch/http-watch-registry.test.js.map +1 -0
- package/dist/utils/watch/local-watch-loop.d.ts +50 -0
- package/dist/utils/watch/local-watch-loop.d.ts.map +1 -0
- package/dist/utils/watch/local-watch-loop.js +103 -0
- package/dist/utils/watch/local-watch-loop.js.map +1 -0
- package/dist/utils/watch/local-watch-loop.test.d.ts +2 -0
- package/dist/utils/watch/local-watch-loop.test.d.ts.map +1 -0
- package/dist/utils/watch/local-watch-loop.test.js +170 -0
- package/dist/utils/watch/local-watch-loop.test.js.map +1 -0
- package/dist/utils/watch/register-notify-watches.d.ts +41 -0
- package/dist/utils/watch/register-notify-watches.d.ts.map +1 -0
- package/dist/utils/watch/register-notify-watches.js +159 -0
- package/dist/utils/watch/register-notify-watches.js.map +1 -0
- package/dist/utils/watch/register-notify-watches.test.d.ts +2 -0
- package/dist/utils/watch/register-notify-watches.test.d.ts.map +1 -0
- package/dist/utils/watch/register-notify-watches.test.js +225 -0
- package/dist/utils/watch/register-notify-watches.test.js.map +1 -0
- package/dist/utils/watch/register-watches.d.ts +68 -0
- package/dist/utils/watch/register-watches.d.ts.map +1 -0
- package/dist/utils/watch/register-watches.js +221 -0
- package/dist/utils/watch/register-watches.js.map +1 -0
- package/dist/utils/watch/register-watches.test.d.ts +2 -0
- package/dist/utils/watch/register-watches.test.d.ts.map +1 -0
- package/dist/utils/watch/register-watches.test.js +576 -0
- package/dist/utils/watch/register-watches.test.js.map +1 -0
- package/dist/utils/watch/stream-watch-loop.d.ts +54 -0
- package/dist/utils/watch/stream-watch-loop.d.ts.map +1 -0
- package/dist/utils/watch/stream-watch-loop.js +282 -0
- package/dist/utils/watch/stream-watch-loop.js.map +1 -0
- package/dist/utils/watch/stream-watch-loop.test.d.ts +2 -0
- package/dist/utils/watch/stream-watch-loop.test.d.ts.map +1 -0
- package/dist/utils/watch/stream-watch-loop.test.js +392 -0
- package/dist/utils/watch/stream-watch-loop.test.js.map +1 -0
- package/dist/utils/watch/websocket-watch-stream.d.ts +25 -0
- package/dist/utils/watch/websocket-watch-stream.d.ts.map +1 -0
- package/dist/utils/watch/websocket-watch-stream.js +306 -0
- package/dist/utils/watch/websocket-watch-stream.js.map +1 -0
- package/dist/utils/watch/websocket-watch-stream.test.d.ts +2 -0
- package/dist/utils/watch/websocket-watch-stream.test.d.ts.map +1 -0
- package/dist/utils/watch/websocket-watch-stream.test.js +475 -0
- package/dist/utils/watch/websocket-watch-stream.test.js.map +1 -0
- package/package.json +7 -4
- package/src/args/global-args.ts +13 -0
- package/src/commands/batch-command/batch-deploy-command.ts +105 -1
- package/src/commands/batch-command/batch-test-command.ts +86 -60
- package/src/commands/deploy-command/deploy-init.ts +1 -1
- package/src/commands/deploy-command/index.ts +327 -32
- package/src/commands/deploy-command/select-target.ts +1 -1
- package/src/commands/deploy-command/version-command.ts +215 -21
- package/src/commands/test-command/test-command.ts +31 -22
- package/src/nevermore.ts +19 -0
- package/src/utils/batch/changed-packages-utils.ts +1 -1
- package/src/utils/build/base-place-resolver-factory.ts +49 -0
- package/src/utils/build/build.ts +13 -2
- package/src/utils/build/upload.ts +1 -1
- package/src/utils/deploy/deploy-metadata.ts +1 -1
- package/src/utils/job-context/base-job-context.ts +68 -6
- package/src/utils/job-context/batch-script-job-context.ts +18 -0
- package/src/utils/job-context/cloud-job-context.ts +7 -2
- package/src/utils/job-context/local-job-context.ts +7 -2
- package/src/utils/open-cloud/open-cloud-client.test.ts +133 -14
- package/src/utils/open-cloud/open-cloud-client.ts +131 -35
- package/src/utils/testing/parsers/batch-log-parser.test.ts +70 -5
- package/src/utils/testing/parsers/batch-log-parser.ts +141 -80
- package/src/utils/testing/parsers/traceback-parser.test.ts +64 -0
- package/src/utils/testing/parsers/traceback-parser.ts +122 -0
- package/src/utils/testing/runner/combined-project-generator.ts +1 -1
- package/src/utils/testing/runner/test-runner.test.ts +29 -0
- package/src/utils/testing/runner/test-runner.ts +36 -4
- package/src/utils/testing/test-log-parser.test.ts +70 -0
- package/src/utils/testing/test-log-parser.ts +80 -10
- package/src/utils/watch/github-context.test.ts +154 -0
- package/src/utils/watch/github-context.ts +184 -0
- package/src/utils/watch/http-watch-registry.test.ts +330 -0
- package/src/utils/watch/http-watch-registry.ts +341 -0
- package/src/utils/watch/local-watch-loop.test.ts +197 -0
- package/src/utils/watch/local-watch-loop.ts +190 -0
- package/src/utils/watch/register-notify-watches.test.ts +282 -0
- package/src/utils/watch/register-notify-watches.ts +226 -0
- package/src/utils/watch/register-watches.test.ts +696 -0
- package/src/utils/watch/register-watches.ts +369 -0
- package/src/utils/watch/stream-watch-loop.test.ts +625 -0
- package/src/utils/watch/stream-watch-loop.ts +411 -0
- package/src/utils/watch/websocket-watch-stream.test.ts +581 -0
- package/src/utils/watch/websocket-watch-stream.ts +403 -0
- package/tsconfig.json +19 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/build/deploy-config.d.ts +0 -71
- package/dist/utils/build/deploy-config.d.ts.map +0 -1
- package/dist/utils/build/deploy-config.js +0 -164
- package/dist/utils/build/deploy-config.js.map +0 -1
- package/dist/utils/build/deploy-config.test.d.ts +0 -2
- package/dist/utils/build/deploy-config.test.d.ts.map +0 -1
- package/dist/utils/build/deploy-config.test.js +0 -126
- package/dist/utils/build/deploy-config.test.js.map +0 -1
- package/src/utils/build/deploy-config.test.ts +0 -149
- package/src/utils/build/deploy-config.ts +0 -259
|
@@ -28,6 +28,10 @@ import {
|
|
|
28
28
|
import { OpenCloudClient } from '../../utils/open-cloud/open-cloud-client.js';
|
|
29
29
|
import { RateLimiter } from '../../utils/open-cloud/rate-limiter.js';
|
|
30
30
|
import { CloudJobContext } from '../../utils/job-context/cloud-job-context.js';
|
|
31
|
+
import {
|
|
32
|
+
createBasePlaceResolver,
|
|
33
|
+
createLockOnlyBasePlaceResolver,
|
|
34
|
+
} from '../../utils/build/base-place-resolver-factory.js';
|
|
31
35
|
import {
|
|
32
36
|
type BatchTarget,
|
|
33
37
|
discoverAllTargetPackagesAsync,
|
|
@@ -39,6 +43,8 @@ import {
|
|
|
39
43
|
readPackageVersionAsync,
|
|
40
44
|
} from '../../utils/nevermore-cli-utils.js';
|
|
41
45
|
import { parseTestLogs } from '../../utils/testing/test-log-parser.js';
|
|
46
|
+
import { parseWatchOption } from '@quenty/nevermore-deploy';
|
|
47
|
+
import { registerWatchesAsync } from '../../utils/watch/register-watches.js';
|
|
42
48
|
|
|
43
49
|
const SMOKE_TEST_SCRIPT_PATH = resolvePackagePath(
|
|
44
50
|
import.meta.url,
|
|
@@ -57,6 +63,9 @@ interface BatchDeployArgs extends NevermoreGlobalArgs {
|
|
|
57
63
|
logs?: boolean;
|
|
58
64
|
target?: string;
|
|
59
65
|
smokeTest?: boolean;
|
|
66
|
+
watch?: string;
|
|
67
|
+
watchShareApiKey?: boolean;
|
|
68
|
+
watchUseGhAuth?: boolean;
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
export const batchDeployCommand: CommandModule<
|
|
@@ -115,6 +124,28 @@ export const batchDeployCommand: CommandModule<
|
|
|
115
124
|
'(executes server scripts via Open Cloud and waits for errors)',
|
|
116
125
|
type: 'boolean',
|
|
117
126
|
default: false,
|
|
127
|
+
})
|
|
128
|
+
.option('watch', {
|
|
129
|
+
describe:
|
|
130
|
+
'After deploying, register a cloud watch for every place with a "watch" field, ' +
|
|
131
|
+
'so it rebuilds when its base place changes. Takes the register endpoint ' +
|
|
132
|
+
'URL, ending in the lease: https://<watch-service>/v1/register/7d',
|
|
133
|
+
type: 'string',
|
|
134
|
+
})
|
|
135
|
+
.option('watch-use-gh-auth', {
|
|
136
|
+
describe:
|
|
137
|
+
'Let the GitHub CLI supply the watch token when no environment variable does. ' +
|
|
138
|
+
'Off by default: registering sends the token to the watch service, so it should be one you handed over.',
|
|
139
|
+
type: 'boolean',
|
|
140
|
+
default: false,
|
|
141
|
+
})
|
|
142
|
+
.option('watch-share-api-key', {
|
|
143
|
+
describe:
|
|
144
|
+
'Share the Open Cloud API key with the watch service, so it can read private base places, ' +
|
|
145
|
+
'see "saved" versions, and report versions in the same vocabulary as the lock file. ' +
|
|
146
|
+
'Off by default — the key is stored by the service.',
|
|
147
|
+
type: 'boolean',
|
|
148
|
+
default: false,
|
|
118
149
|
});
|
|
119
150
|
},
|
|
120
151
|
handler: async (args) => {
|
|
@@ -129,6 +160,9 @@ export const batchDeployCommand: CommandModule<
|
|
|
129
160
|
|
|
130
161
|
async function _runAsync(args: BatchDeployArgs): Promise<void> {
|
|
131
162
|
const targetName = args.target ?? 'test';
|
|
163
|
+
// Parsed up front so a typo'd duration fails before anything is deployed.
|
|
164
|
+
const watchOption =
|
|
165
|
+
args.watch == null ? undefined : parseWatchOption(args.watch);
|
|
132
166
|
|
|
133
167
|
const discovered = args.all
|
|
134
168
|
? await discoverAllTargetPackagesAsync(targetName)
|
|
@@ -159,6 +193,46 @@ async function _runAsync(args: BatchDeployArgs): Promise<void> {
|
|
|
159
193
|
OutputHelper.info(
|
|
160
194
|
`[DRYRUN] Would deploy ${batchTargets.length} targets: ${names}`
|
|
161
195
|
);
|
|
196
|
+
// Registration is idempotent and derives from committed config plus the
|
|
197
|
+
// lock file, so it runs for real even on a dryrun — that is what makes the
|
|
198
|
+
// watch path testable without shipping a build.
|
|
199
|
+
if (watchOption) {
|
|
200
|
+
OutputHelper.info(
|
|
201
|
+
'[DRYRUN] Registering separate dryrun watches and firing them, to ' +
|
|
202
|
+
'prove routing works. This does not build or upload here — but ' +
|
|
203
|
+
'firing really does dispatch the workflow once per package, and ' +
|
|
204
|
+
'each of those runs a real deploy on the runner.'
|
|
205
|
+
);
|
|
206
|
+
if (args.watchShareApiKey) {
|
|
207
|
+
OutputHelper.warn(
|
|
208
|
+
'[DRYRUN] Registering without the Open Cloud key, so a "saved" base ' +
|
|
209
|
+
'place is skipped here even though a real run would watch it.'
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
const allPackages = await discoverAllTargetPackagesAsync(targetName);
|
|
213
|
+
// Under its own monitor name, never the one a real run owns.
|
|
214
|
+
//
|
|
215
|
+
// Re-registering replaces a monitor's entire watch list, and a dryrun
|
|
216
|
+
// cannot reproduce a real registration: the Open Cloud key is resolved
|
|
217
|
+
// after this point, so it would register anonymously — stripping the key
|
|
218
|
+
// from the live monitor, moving every source back to the anonymous
|
|
219
|
+
// driver and its content-hash vocabulary, dropping the baselines, and
|
|
220
|
+
// deleting any "saved" watch outright, because an anonymous
|
|
221
|
+
// registration skips those.
|
|
222
|
+
await registerWatchesAsync({
|
|
223
|
+
option: watchOption,
|
|
224
|
+
monitorName: `${targetName}/dryrun`,
|
|
225
|
+
resolver: createLockOnlyBasePlaceResolver(),
|
|
226
|
+
useGhAuth: args.watchUseGhAuth,
|
|
227
|
+
triggerAfterRegister: true,
|
|
228
|
+
candidates: flattenToBatchTargets(allPackages).map((buildTarget) => ({
|
|
229
|
+
targetName,
|
|
230
|
+
packageName: buildTarget.packageName,
|
|
231
|
+
packagePath: buildTarget.path,
|
|
232
|
+
place: buildTarget.target,
|
|
233
|
+
})),
|
|
234
|
+
});
|
|
235
|
+
}
|
|
162
236
|
return;
|
|
163
237
|
}
|
|
164
238
|
|
|
@@ -214,7 +288,8 @@ async function _runAsync(args: BatchDeployArgs): Promise<void> {
|
|
|
214
288
|
apiKey,
|
|
215
289
|
rateLimiter: new RateLimiter(),
|
|
216
290
|
});
|
|
217
|
-
const
|
|
291
|
+
const basePlaceResolver = createBasePlaceResolver(client, args);
|
|
292
|
+
const context = new CloudJobContext(reporter, client, basePlaceResolver);
|
|
218
293
|
|
|
219
294
|
// Gathered once so every deployed package shares one timestamp and commit.
|
|
220
295
|
const deployGitInfo = gatherGitDeployInfo();
|
|
@@ -309,6 +384,35 @@ async function _runAsync(args: BatchDeployArgs): Promise<void> {
|
|
|
309
384
|
},
|
|
310
385
|
});
|
|
311
386
|
if (results.summary.failed > 0) exitCode = 1;
|
|
387
|
+
|
|
388
|
+
// Only after a clean run, matching `deploy run`. A package that resolved its
|
|
389
|
+
// base place and then failed to upload has a lock naming a version it never
|
|
390
|
+
// shipped; registering that as the baseline tells the service the watch is
|
|
391
|
+
// up to date, so the rebuild never fires and the next successful run
|
|
392
|
+
// re-registers the same wrong baseline. The failure becomes permanent and
|
|
393
|
+
// invisible.
|
|
394
|
+
if (watchOption && results.summary.failed === 0) {
|
|
395
|
+
// Deliberately every package with this target, not just the ones that
|
|
396
|
+
// deployed. One monitor holds the repo's watches for a target and a
|
|
397
|
+
// re-apply replaces its whole list, so registering only what changed
|
|
398
|
+
// would delete the watches of every package that happened not to change
|
|
399
|
+
// this run. Packages that did not deploy still have a lock entry, which
|
|
400
|
+
// is the correct baseline for them.
|
|
401
|
+
const allPackages = await discoverAllTargetPackagesAsync(targetName);
|
|
402
|
+
await registerWatchesAsync({
|
|
403
|
+
option: watchOption,
|
|
404
|
+
monitorName: targetName,
|
|
405
|
+
resolver: basePlaceResolver,
|
|
406
|
+
useGhAuth: args.watchUseGhAuth,
|
|
407
|
+
robloxApiKey: args.watchShareApiKey ? apiKey : undefined,
|
|
408
|
+
candidates: flattenToBatchTargets(allPackages).map((buildTarget) => ({
|
|
409
|
+
targetName,
|
|
410
|
+
packageName: buildTarget.packageName,
|
|
411
|
+
packagePath: buildTarget.path,
|
|
412
|
+
place: buildTarget.target,
|
|
413
|
+
})),
|
|
414
|
+
});
|
|
415
|
+
}
|
|
312
416
|
} catch (err) {
|
|
313
417
|
OutputHelper.error(err instanceof Error ? err.message : String(err));
|
|
314
418
|
exitCode = 1;
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { NevermoreGlobalArgs } from '../../args/global-args.js';
|
|
9
9
|
import { getApiKeyAsync } from '@quenty/nevermore-cli-helpers';
|
|
10
10
|
import { runBatchAsync } from '../../utils/batch/batch-runner.js';
|
|
11
|
+
import { createBasePlaceResolver } from '../../utils/build/base-place-resolver-factory.js';
|
|
11
12
|
import {
|
|
12
13
|
type JobContext,
|
|
13
14
|
BatchScriptJobContext,
|
|
@@ -60,64 +61,84 @@ export const batchTestCommand: CommandModule<
|
|
|
60
61
|
command: 'test',
|
|
61
62
|
describe: 'Run tests for changed packages with test targets',
|
|
62
63
|
builder: (yargs) => {
|
|
63
|
-
return
|
|
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
|
-
|
|
64
|
+
return (
|
|
65
|
+
yargs
|
|
66
|
+
.option('cloud', {
|
|
67
|
+
describe: 'Run tests via Open Cloud instead of locally',
|
|
68
|
+
type: 'boolean',
|
|
69
|
+
default: false,
|
|
70
|
+
})
|
|
71
|
+
.option('api-key', {
|
|
72
|
+
describe: 'Roblox Open Cloud API key (--cloud only)',
|
|
73
|
+
type: 'string',
|
|
74
|
+
})
|
|
75
|
+
.option('all', {
|
|
76
|
+
describe: 'Test all packages with test targets, not just changed',
|
|
77
|
+
type: 'boolean',
|
|
78
|
+
default: false,
|
|
79
|
+
})
|
|
80
|
+
.option('base', {
|
|
81
|
+
describe: 'Git ref to diff against for change detection',
|
|
82
|
+
type: 'string',
|
|
83
|
+
default: 'origin/main',
|
|
84
|
+
})
|
|
85
|
+
.option('concurrency', {
|
|
86
|
+
describe: 'Max parallel tests (0 = unlimited, default: unlimited)',
|
|
87
|
+
type: 'number',
|
|
88
|
+
})
|
|
89
|
+
.option('output', {
|
|
90
|
+
describe: 'Write JSON results to this file',
|
|
91
|
+
type: 'string',
|
|
92
|
+
})
|
|
93
|
+
.option('limit', {
|
|
94
|
+
describe: 'Max number of packages to test (for local debugging)',
|
|
95
|
+
type: 'number',
|
|
96
|
+
})
|
|
97
|
+
.option('logs', {
|
|
98
|
+
describe: 'Show execution logs for all packages (not just failures)',
|
|
99
|
+
type: 'boolean',
|
|
100
|
+
default: false,
|
|
101
|
+
})
|
|
102
|
+
.option('aggregated', {
|
|
103
|
+
describe:
|
|
104
|
+
'Build all packages into a single place and execute one batch script',
|
|
105
|
+
type: 'boolean',
|
|
106
|
+
default: true,
|
|
107
|
+
})
|
|
108
|
+
.option('batch-place-id', {
|
|
109
|
+
describe:
|
|
110
|
+
'Override placeId for the aggregated batch upload (--aggregated only)',
|
|
111
|
+
type: 'number',
|
|
112
|
+
})
|
|
113
|
+
.option('batch-universe-id', {
|
|
114
|
+
describe:
|
|
115
|
+
'Override universeId for the aggregated batch upload (--aggregated only)',
|
|
116
|
+
type: 'number',
|
|
117
|
+
})
|
|
118
|
+
.option('timeout', {
|
|
119
|
+
describe:
|
|
120
|
+
'Max script execution time in seconds for the whole batch. Sent to the Open Cloud API so Roblox cancels server-side on overrun. Max 300s (API limit). (default: 300)',
|
|
121
|
+
type: 'number',
|
|
122
|
+
})
|
|
123
|
+
// Accepted only to fail with a useful message. A batch runs one shared
|
|
124
|
+
// script across packages, so there is nothing for arbitrary Luau to mean
|
|
125
|
+
// here — but yargs strict mode would otherwise reject it with a bare
|
|
126
|
+
// "Unknown argument" that does not say where to go instead.
|
|
127
|
+
.option('script-text', {
|
|
128
|
+
hidden: true,
|
|
129
|
+
type: 'string',
|
|
130
|
+
})
|
|
131
|
+
.check((args) => {
|
|
132
|
+
if (args.scriptText !== undefined) {
|
|
133
|
+
throw new Error(
|
|
134
|
+
'--script-text is not supported by "batch test", which runs one shared script for all packages.\n' +
|
|
135
|
+
'Run it against a single package instead:\n' +
|
|
136
|
+
' cd <package> && nevermore test --cloud --script-text \'print("hi")\''
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
return true;
|
|
140
|
+
})
|
|
141
|
+
);
|
|
121
142
|
},
|
|
122
143
|
handler: async (args) => {
|
|
123
144
|
try {
|
|
@@ -214,9 +235,14 @@ async function _runAsync(args: BatchTestArgs): Promise<void> {
|
|
|
214
235
|
? _createBroadcastReporter(reporter, packageNames)
|
|
215
236
|
: reporter;
|
|
216
237
|
|
|
238
|
+
// Local runs get a resolver too — a package with a basePlace still has to
|
|
239
|
+
// merge it, and the client resolves its API key lazily so a run that never
|
|
240
|
+
// touches one is not prompted for credentials.
|
|
241
|
+
const basePlaceResolver = createBasePlaceResolver(client, args);
|
|
242
|
+
|
|
217
243
|
const innerContext: JobContext = cloud
|
|
218
|
-
? new CloudJobContext(innerReporter, client)
|
|
219
|
-
: new LocalJobContext(innerReporter, client);
|
|
244
|
+
? new CloudJobContext(innerReporter, client, basePlaceResolver)
|
|
245
|
+
: new LocalJobContext(innerReporter, client, basePlaceResolver);
|
|
220
246
|
|
|
221
247
|
const context: JobContext = args.aggregated
|
|
222
248
|
? new BatchScriptJobContext(innerContext, packages, {
|