@smoothbricks/nx-plugin 0.7.12 → 0.7.14
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/README.md +91 -27
- package/dist/.build-inputs.json +20 -12
- package/dist/built-output-packages.d.ts +27 -0
- package/dist/built-output-packages.d.ts.map +1 -0
- package/dist/built-output-packages.js +97 -0
- package/dist/cross-check-policy.d.ts +13 -1
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +13 -1
- package/dist/executors/bounded-exec/admission-queue.d.ts +68 -0
- package/dist/executors/bounded-exec/admission-queue.d.ts.map +1 -0
- package/dist/executors/bounded-exec/admission-queue.js +131 -0
- package/dist/executors/bounded-exec/cpu-grant.d.ts +14 -0
- package/dist/executors/bounded-exec/cpu-grant.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-grant.js +18 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +1 -14
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +2 -49
- package/dist/executors/bounded-exec/executor.d.ts +5 -12
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +51 -154
- package/dist/executors/bounded-exec/memory-retry.d.ts +39 -0
- package/dist/executors/bounded-exec/memory-retry.d.ts.map +1 -0
- package/dist/executors/bounded-exec/memory-retry.js +33 -0
- package/dist/executors/bounded-exec/parent-grant.d.ts +43 -0
- package/dist/executors/bounded-exec/parent-grant.d.ts.map +1 -0
- package/dist/executors/bounded-exec/parent-grant.js +37 -0
- package/dist/executors/bounded-exec/peak-charge.d.ts +17 -0
- package/dist/executors/bounded-exec/peak-charge.d.ts.map +1 -0
- package/dist/executors/bounded-exec/peak-charge.js +20 -0
- package/dist/executors/bounded-exec/pool-environment.d.ts +25 -0
- package/dist/executors/bounded-exec/pool-environment.d.ts.map +1 -0
- package/dist/executors/bounded-exec/pool-environment.js +34 -0
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +3 -18
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +4 -25
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +97 -31
- package/dist/managed-files/ci-workflow.d.ts +29 -5
- package/dist/managed-files/ci-workflow.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.js +111 -16
- package/dist/managed-files/context.d.ts.map +1 -1
- package/dist/managed-files/context.js +1 -0
- package/dist/managed-files/files.d.ts +3 -1
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +2 -0
- package/dist/managed-files/publish-workflow.d.ts +6 -1
- package/dist/managed-files/publish-workflow.d.ts.map +1 -1
- package/dist/managed-files/publish-workflow.js +16 -11
- package/dist/owned-installation.d.ts.map +1 -1
- package/dist/owned-installation.js +48 -14
- package/dist/typecheck-route.d.ts +28 -0
- package/dist/typecheck-route.d.ts.map +1 -0
- package/dist/typecheck-route.js +109 -0
- package/dist/workspace-manifest.d.ts +50 -5
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/executors.json +10 -0
- package/managed/raw/patches/ttsc@0.34.1.patch +93 -8
- package/managed/raw/tooling/direnv/apple-developer.sh +8 -1
- package/managed/raw/tooling/direnv/compiler-variables.sh +1 -1
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +4 -2
- package/managed/raw/tooling/direnv/secret-references.ts +19 -5
- package/managed/raw/tooling/git-hooks/pre-push.sh +20 -10
- package/managed/templates/github/actions/forgejo-artifact.cjs +9 -9
- package/managed/templates/github/actions/setup-devenv/action.yml +53 -0
- package/package.json +2 -2
- package/src/built-output-packages.ts +125 -0
- package/src/cross-check-policy.ts +14 -1
- package/src/executors/bounded-exec/admission-queue.ts +163 -0
- package/src/executors/bounded-exec/cpu-grant.ts +32 -0
- package/src/executors/bounded-exec/cpu-pool.ts +2 -33
- package/src/executors/bounded-exec/executor.ts +60 -201
- package/src/executors/bounded-exec/memory-retry.ts +63 -0
- package/src/executors/bounded-exec/parent-grant.ts +75 -0
- package/src/executors/bounded-exec/peak-charge.ts +25 -0
- package/src/executors/bounded-exec/pool-environment.ts +45 -0
- package/src/executors/bounded-exec/run-cpu-pool.ts +2 -1
- package/src/executors/bounded-exec/verdict.ts +7 -35
- package/src/index.ts +105 -31
- package/src/managed-files/ci-workflow.ts +143 -16
- package/src/managed-files/context.ts +1 -0
- package/src/managed-files/files.ts +5 -0
- package/src/managed-files/publish-workflow.ts +26 -10
- package/src/owned-installation.ts +63 -14
- package/src/typecheck-route.ts +64 -0
- package/src/workspace-manifest.ts +56 -5
- package/test-timings.json +141 -139
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import typia from 'typia';
|
|
4
|
+
import type { CpuGrantRecord } from './cpu-grant.js';
|
|
5
|
+
import { parseCpuGrant } from './cpu-grant.js';
|
|
4
6
|
import type { CpuWaitRow } from './lease-wait.js';
|
|
5
7
|
import { describeHolders, type LockWait, type Opener } from './lock-wait.js';
|
|
6
8
|
import type { MbxQueuedRequest } from './mbx-queue.js';
|
|
@@ -88,14 +90,10 @@ export interface BoundedExecRecord {
|
|
|
88
90
|
/**
|
|
89
91
|
* The parent CPU pool's grant the run started under: tokens granted of those asked for, and
|
|
90
92
|
* how long it waited for the pool. Absent when it ran ungranted. Its tokens are the parallelism the run's
|
|
91
|
-
* `peakBytes` was measured under, which the task's next run reads (`readLastPeak
|
|
93
|
+
* `peakBytes` was measured under, which the task's next run reads (`readLastPeak`, peak-charge.ts) to charge that peak in proportion
|
|
92
94
|
* to the parallelism it is lent.
|
|
93
95
|
*/
|
|
94
|
-
readonly cpu?:
|
|
95
|
-
readonly tokens: number;
|
|
96
|
-
readonly want: number;
|
|
97
|
-
readonly waitedMs: number;
|
|
98
|
-
};
|
|
96
|
+
readonly cpu?: CpuGrantRecord;
|
|
99
97
|
/**
|
|
100
98
|
* The parent CPU pool's wait that expired and refused the run: its code, bound and elapsed time, the last heartbeat
|
|
101
99
|
* sequence it read, and the pool's socket and pid (specs/cowshed/05_gateway.md, "Deadlines"). Absent when no wait
|
|
@@ -496,24 +494,6 @@ export async function readRecord(directory: string): Promise<BoundedExecRecord |
|
|
|
496
494
|
return parseRecord(JSON.parse(text));
|
|
497
495
|
}
|
|
498
496
|
|
|
499
|
-
/**
|
|
500
|
-
* The peak the task's last record in `directory` names: its charge in its run's pool. Null when the task has no record
|
|
501
|
-
* or its record no peak; a record that cannot be read is an error naming it, never a charge of nothing.
|
|
502
|
-
*/
|
|
503
|
-
export async function readLastPeak(
|
|
504
|
-
directory: string,
|
|
505
|
-
): Promise<{ ok: true; peakBytes: number | null; parallelism: number | null } | { ok: false; error: string }> {
|
|
506
|
-
try {
|
|
507
|
-
const record = await readRecord(directory);
|
|
508
|
-
return { ok: true, peakBytes: record?.peakBytes ?? null, parallelism: record?.cpu?.tokens ?? null };
|
|
509
|
-
} catch (error) {
|
|
510
|
-
return {
|
|
511
|
-
ok: false,
|
|
512
|
-
error: `the task's last record ${join(directory, VERDICT_FILE)} cannot be read: ${error instanceof Error ? error.message : String(error)}`,
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
|
|
517
497
|
/** The JUnit report a command wrote into `directory`, or `null` when it wrote none. */
|
|
518
498
|
export async function readJunitReport(
|
|
519
499
|
directory: string,
|
|
@@ -542,23 +522,15 @@ function parseRecord(value: unknown): BoundedExecRecord {
|
|
|
542
522
|
if (!(peakBytes === null || (typeof peakBytes === 'number' && Number.isSafeInteger(peakBytes) && peakBytes >= 0))) {
|
|
543
523
|
throw new Error(`not a bounded-exec record: ${JSON.stringify(value)}`);
|
|
544
524
|
}
|
|
545
|
-
const cpu = value.cpu;
|
|
546
|
-
if (cpu ===
|
|
547
|
-
return { task: value.task, hash: value.hash, verdict: parseVerdict(value.verdict), peakBytes };
|
|
548
|
-
}
|
|
549
|
-
if (
|
|
550
|
-
!isObject(cpu) ||
|
|
551
|
-
!(typeof cpu.tokens === 'number' && Number.isSafeInteger(cpu.tokens) && cpu.tokens >= 1) ||
|
|
552
|
-
!(typeof cpu.want === 'number' && Number.isSafeInteger(cpu.want) && cpu.want >= 1) ||
|
|
553
|
-
!(typeof cpu.waitedMs === 'number' && Number.isFinite(cpu.waitedMs) && cpu.waitedMs >= 0)
|
|
554
|
-
) {
|
|
525
|
+
const cpu = parseCpuGrant(value.cpu);
|
|
526
|
+
if (cpu === 'malformed') {
|
|
555
527
|
throw new Error(`not a bounded-exec record: ${JSON.stringify(value)}`);
|
|
556
528
|
}
|
|
557
529
|
return {
|
|
558
530
|
task: value.task,
|
|
559
531
|
hash: value.hash,
|
|
560
532
|
verdict: parseVerdict(value.verdict),
|
|
561
|
-
cpu
|
|
533
|
+
...(cpu === undefined ? {} : { cpu }),
|
|
562
534
|
peakBytes,
|
|
563
535
|
};
|
|
564
536
|
}
|
package/src/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ import { AggregateCreateNodesError } from 'nx/src/project-graph/error-types.js';
|
|
|
25
25
|
import { parse as parseToml } from 'smol-toml';
|
|
26
26
|
import { BOUNDED_TEST_IDLE_TIMEOUT_MS, BOUNDED_TEST_KILL_AFTER_MS } from './bounded-test-policy.js';
|
|
27
27
|
import { refuseOverlappingOutputs } from './build-state-output-policy.js';
|
|
28
|
+
import { builtOutputLockfileDependencies, builtOutputLockfileNodes } from './built-output-packages.js';
|
|
28
29
|
import { bunLockDependencies, bunLockInput, bunLockNode } from './bun-lock-scope.js';
|
|
29
30
|
import {
|
|
30
31
|
CARGO_CLOSURE_INPUT,
|
|
@@ -104,6 +105,7 @@ import {
|
|
|
104
105
|
} from './test-timings.js';
|
|
105
106
|
import { assertUpstreamBasePrecondition } from './test-walk-policy.js';
|
|
106
107
|
import { type NativeTools, nativeToolCommand, nativeToolDependsOn, resolveNativeTools } from './tool-bins.js';
|
|
108
|
+
import { typecheckRoute } from './typecheck-route.js';
|
|
107
109
|
import {
|
|
108
110
|
isBuildOutputTargetName,
|
|
109
111
|
isTestNamespaceTargetName,
|
|
@@ -130,15 +132,14 @@ const TYPESCRIPT_PATCH_INPUTS = ['{workspaceRoot}/patches/**/*', '!{workspaceRoo
|
|
|
130
132
|
const WORKSPACE_TSCONFIG_BASE_INPUT = '{workspaceRoot}/tsconfig.base.json';
|
|
131
133
|
|
|
132
134
|
/**
|
|
133
|
-
* The native compiler a typecheck runs
|
|
134
|
-
* from a pinned source revision and exports its path. The typecheck targets run it
|
|
135
|
-
* not through ttsc: ttsc auto-loads a dependency's transform plugin (typia) and then checks
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* variable: falling back would check with another compiler under the same key.
|
|
135
|
+
* The native compiler a typecheck runs unless a dependency declares a dialect (typecheck-route.ts), apart from the one
|
|
136
|
+
* emit runs: devenv.smoo.nix builds it from a pinned source revision and exports its path. The typecheck targets run it
|
|
137
|
+
* directly, not through ttsc: ttsc auto-loads a dependency's transform plugin (typia) and then checks inside that
|
|
138
|
+
* plugin's host, which links ttsc's own compiler and never runs the pinned one. Transform diagnostics stay enforced
|
|
139
|
+
* where the transform runs: for the lib program in `tsc-js`'s emit, for test files when the test runner transforms
|
|
140
|
+
* them. A test file no test executes has its types checked here but its transform calls checked nowhere. Hashed by the
|
|
141
|
+
* store path, which carries the revision, so a compiler bump misses the cache. The command refuses an unset variable:
|
|
142
|
+
* falling back would check with another compiler under the same key.
|
|
142
143
|
*/
|
|
143
144
|
const TYPECHECK_COMPILER_ENV = 'SMOO_TYPECHECK_TSC';
|
|
144
145
|
const TYPECHECK_COMPILER_INPUT = { env: TYPECHECK_COMPILER_ENV };
|
|
@@ -146,6 +147,29 @@ function typecheckCommand(args: string): string {
|
|
|
146
147
|
return `"\${${TYPECHECK_COMPILER_ENV}:?is unset, enter the devenv shell (devenv.smoo.nix builds the typecheck compiler)}" ${args}`;
|
|
147
148
|
}
|
|
148
149
|
|
|
150
|
+
/** How one project's typecheck targets run: their command, the compiler input they hash, and what they wait for. */
|
|
151
|
+
interface TypecheckTargets {
|
|
152
|
+
readonly command: (args: string) => string;
|
|
153
|
+
readonly inputs: readonly NonNullable<TargetConfiguration['inputs']>[number][];
|
|
154
|
+
readonly dependsOn: readonly string[];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* A project's typecheck targets. A project whose direct dependency declares a dialect typechecks through ttsc, whose
|
|
159
|
+
* linked plugin lowers the dialect and withdraws the checker's refusals of it; its compiler is the installed ttsc,
|
|
160
|
+
* which bun.lock and the patches in its check inputs already key, and it waits for the targets the declaring package
|
|
161
|
+
* names to prepare the plugin binaries ttsc loads. Every other project runs the pinned native compiler.
|
|
162
|
+
*/
|
|
163
|
+
function typecheckTargets(packageJsonPath: string, packageJson: PackageJson): TypecheckTargets {
|
|
164
|
+
const route = typecheckRoute(packageJsonPath, [
|
|
165
|
+
...Object.keys(packageJson.dependencies ?? {}),
|
|
166
|
+
...Object.keys(packageJson.devDependencies ?? {}),
|
|
167
|
+
]);
|
|
168
|
+
return route.declaredBy.length === 0
|
|
169
|
+
? { command: typecheckCommand, inputs: [TYPECHECK_COMPILER_INPUT], dependsOn: [] }
|
|
170
|
+
: { command: (args) => `ttsc ${args}`, inputs: [], dependsOn: route.dependsOn };
|
|
171
|
+
}
|
|
172
|
+
|
|
149
173
|
/**
|
|
150
174
|
* The release-rewritten root manifest hashed by field instead of by byte, for
|
|
151
175
|
* a check that only reads it.
|
|
@@ -156,17 +180,36 @@ function typecheckCommand(args: string): string {
|
|
|
156
180
|
* node and the project's through its `^` input, so a release's rewrite of the
|
|
157
181
|
* lockfile's `workspaces` mirror re-keys nothing.
|
|
158
182
|
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
183
|
+
* No check reads the root's scripts, developer-link configuration or Nx
|
|
184
|
+
* configuration; Nx already hashes the resolved project configuration. Nor
|
|
185
|
+
* does a check read install-only dependency ranges, overrides or catalogs:
|
|
186
|
+
* the bun lock-scope nodes key the installed packages they resolve to, and
|
|
187
|
+
* patch files key the patch bytes. Keeping those pins here would re-key every
|
|
188
|
+
* check on a catalog bump even when a built-output package's bytes agree.
|
|
189
|
+
* Resolution fields (type, imports, exports) and workspace member patterns
|
|
190
|
+
* remain inputs; only the catalogs nested beside those patterns are dropped.
|
|
167
191
|
*/
|
|
168
192
|
const VERSIONLESS_TOOLCHAIN_MANIFEST_INPUTS = [
|
|
169
|
-
{
|
|
193
|
+
{
|
|
194
|
+
json: '{workspaceRoot}/package.json',
|
|
195
|
+
excludeFields: [
|
|
196
|
+
'version',
|
|
197
|
+
'scripts',
|
|
198
|
+
'smoo',
|
|
199
|
+
'nx',
|
|
200
|
+
'dependencies',
|
|
201
|
+
'devDependencies',
|
|
202
|
+
'optionalDependencies',
|
|
203
|
+
'peerDependencies',
|
|
204
|
+
'overrides',
|
|
205
|
+
'resolutions',
|
|
206
|
+
'patchedDependencies',
|
|
207
|
+
'catalog',
|
|
208
|
+
'catalogs',
|
|
209
|
+
'workspaces.catalog',
|
|
210
|
+
'workspaces.catalogs',
|
|
211
|
+
],
|
|
212
|
+
},
|
|
170
213
|
];
|
|
171
214
|
|
|
172
215
|
/** A path segment Nx's workspace file map never carries, so a fileset naming it hashes nothing. */
|
|
@@ -1131,12 +1174,13 @@ function supportsJsonInputs(): boolean {
|
|
|
1131
1174
|
type CreateNodesHandler = CreateNodesV2[1];
|
|
1132
1175
|
|
|
1133
1176
|
function createNodesHandler(hostPlatform: NapiPlatform | null): CreateNodesHandler {
|
|
1134
|
-
return async (projectConfigurationFiles,
|
|
1177
|
+
return async (projectConfigurationFiles, options, context) => {
|
|
1135
1178
|
const results: CreateNodesResultV2 = [];
|
|
1136
1179
|
const errors: Array<[file: string | null, error: Error]> = [];
|
|
1137
1180
|
let cargoWorkspaces: CargoWorkspace[];
|
|
1138
1181
|
let eslint: EslintWorkspace | null;
|
|
1139
1182
|
let nativeTools: NativeTools | null;
|
|
1183
|
+
let lockfileNodes: Record<string, ProjectGraphExternalNode>;
|
|
1140
1184
|
try {
|
|
1141
1185
|
cargoWorkspaces = await resolveCargoWorkspaces(projectConfigurationFiles, context.workspaceRoot, hostPlatform);
|
|
1142
1186
|
eslint = await eslintWorkspace(context.workspaceRoot);
|
|
@@ -1149,6 +1193,7 @@ function createNodesHandler(hostPlatform: NapiPlatform | null): CreateNodesHandl
|
|
|
1149
1193
|
EXECUTABLE_PLATFORM_DIRECTORY[hostPlatform.targetFamily][hostPlatform.architecture],
|
|
1150
1194
|
scriptcTargetName(hostPlatform),
|
|
1151
1195
|
);
|
|
1196
|
+
lockfileNodes = builtOutputLockfileNodes(options, context);
|
|
1152
1197
|
} catch (error) {
|
|
1153
1198
|
throw new AggregateCreateNodesError([[null, error instanceof Error ? error : new Error(String(error))]], results);
|
|
1154
1199
|
}
|
|
@@ -1185,6 +1230,20 @@ function createNodesHandler(hostPlatform: NapiPlatform | null): CreateNodesHandl
|
|
|
1185
1230
|
}),
|
|
1186
1231
|
);
|
|
1187
1232
|
|
|
1233
|
+
// The root manifest's result carries the lockfile's package nodes, as it carries the root's lock-scope node.
|
|
1234
|
+
if (Object.keys(lockfileNodes).length > 0) {
|
|
1235
|
+
const rootIndex = results.findIndex(([file]) => file === 'package.json');
|
|
1236
|
+
const rootResult = results[rootIndex];
|
|
1237
|
+
if (rootResult === undefined) {
|
|
1238
|
+
errors.push([
|
|
1239
|
+
null,
|
|
1240
|
+
new Error('builtOutputPackages needs a root package.json to publish the lockfile nodes on'),
|
|
1241
|
+
]);
|
|
1242
|
+
} else {
|
|
1243
|
+
const [file, result] = rootResult;
|
|
1244
|
+
results[rootIndex] = [file, { ...result, externalNodes: { ...lockfileNodes, ...result.externalNodes } }];
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1188
1247
|
if (errors.length > 0) {
|
|
1189
1248
|
throw new AggregateCreateNodesError(errors, results);
|
|
1190
1249
|
}
|
|
@@ -1241,8 +1300,14 @@ export const postTasksExecution: PostTasksExecution<ProducerReceiptsOptions> = a
|
|
|
1241
1300
|
await postCargoRetention(options, context);
|
|
1242
1301
|
};
|
|
1243
1302
|
|
|
1244
|
-
/**
|
|
1245
|
-
|
|
1303
|
+
/**
|
|
1304
|
+
* The lock-scope nodes' edges: each bun node's to the packages and members its manifest resolves; and, for a workspace
|
|
1305
|
+
* that names built-output packages, the lockfile's package edges (`built-output-packages.ts`).
|
|
1306
|
+
*/
|
|
1307
|
+
export const createDependencies: CreateDependencies = (options, context) => [
|
|
1308
|
+
...bunLockDependencies(context),
|
|
1309
|
+
...builtOutputLockfileDependencies(options, context),
|
|
1310
|
+
];
|
|
1246
1311
|
|
|
1247
1312
|
/** Nx invokes this only after merging inferred/declarative targets and every plugin's project dependencies. */
|
|
1248
1313
|
export const createMetadata: CreateMetadata = (graph, _options, context) => {
|
|
@@ -1255,6 +1320,7 @@ export default { createNodesV2, createDependencies, createMetadata, postTasksExe
|
|
|
1255
1320
|
|
|
1256
1321
|
interface PackageJson {
|
|
1257
1322
|
bin?: unknown;
|
|
1323
|
+
dependencies?: Record<string, unknown>;
|
|
1258
1324
|
devDependencies?: Record<string, unknown>;
|
|
1259
1325
|
name?: string;
|
|
1260
1326
|
napi?: Record<string, unknown>;
|
|
@@ -1559,6 +1625,7 @@ async function createProjectTargets(
|
|
|
1559
1625
|
const projectRoot = dirname(packageJsonPath);
|
|
1560
1626
|
const absoluteProjectRoot = join(workspaceRoot, projectRoot);
|
|
1561
1627
|
const packageJson = await readPackageJson(join(workspaceRoot, packageJsonPath));
|
|
1628
|
+
const typecheck = typecheckTargets(join(workspaceRoot, packageJsonPath), packageJson);
|
|
1562
1629
|
const projectName = packageJson.nx?.name ?? packageJson.name;
|
|
1563
1630
|
if (typeof projectName !== 'string' || projectName.length === 0) {
|
|
1564
1631
|
throw new Error(`${packageJsonPath} must declare a non-empty package or nx project name`);
|
|
@@ -1591,7 +1658,13 @@ async function createProjectTargets(
|
|
|
1591
1658
|
const versionlessProjectInputs =
|
|
1592
1659
|
versionless === null
|
|
1593
1660
|
? []
|
|
1594
|
-
: [
|
|
1661
|
+
: [
|
|
1662
|
+
...(projectRoot === '.'
|
|
1663
|
+
? ['!{projectRoot}/package.json', ...VERSIONLESS_TOOLCHAIN_MANIFEST_INPUTS]
|
|
1664
|
+
: VERSIONLESS_PACKAGE_INPUTS),
|
|
1665
|
+
...crateInputs,
|
|
1666
|
+
...(projectRoot === '.' ? ROOT_LOCKFILE_EXCLUSIONS : []),
|
|
1667
|
+
];
|
|
1595
1668
|
// The options a TypeScript task's answer really depends on, which is the
|
|
1596
1669
|
// whole `extends` chain of the configs its commands name and not just those
|
|
1597
1670
|
// two files. Resolved once per project: every target below shares it.
|
|
@@ -1669,13 +1742,13 @@ async function createProjectTargets(
|
|
|
1669
1742
|
selfProduction,
|
|
1670
1743
|
dependencyProduction,
|
|
1671
1744
|
...checkInputs,
|
|
1672
|
-
|
|
1745
|
+
...typecheck.inputs,
|
|
1673
1746
|
'{projectRoot}/tsconfig.lib.json',
|
|
1674
1747
|
],
|
|
1675
1748
|
outputs: [],
|
|
1676
|
-
dependsOn: ['^*-js', ...(cargoWasmConfig ? ['cargo-wasm'] : [])],
|
|
1749
|
+
dependsOn: ['^*-js', ...(cargoWasmConfig ? ['cargo-wasm'] : []), ...typecheck.dependsOn],
|
|
1677
1750
|
options: {
|
|
1678
|
-
command:
|
|
1751
|
+
command: typecheck.command('-p tsconfig.lib.json --noEmit'),
|
|
1679
1752
|
cwd: projectRoot,
|
|
1680
1753
|
},
|
|
1681
1754
|
};
|
|
@@ -1693,12 +1766,12 @@ async function createProjectTargets(
|
|
|
1693
1766
|
selfDefault,
|
|
1694
1767
|
dependencyProduction,
|
|
1695
1768
|
...checkInputs,
|
|
1696
|
-
|
|
1769
|
+
...typecheck.inputs,
|
|
1697
1770
|
'{projectRoot}/tsconfig.test.json',
|
|
1698
1771
|
],
|
|
1699
|
-
dependsOn: ['typecheck'],
|
|
1772
|
+
dependsOn: ['typecheck', ...typecheck.dependsOn],
|
|
1700
1773
|
options: {
|
|
1701
|
-
command:
|
|
1774
|
+
command: typecheck.command('-p tsconfig.test.json --noEmit'),
|
|
1702
1775
|
cwd: projectRoot,
|
|
1703
1776
|
},
|
|
1704
1777
|
};
|
|
@@ -1706,7 +1779,7 @@ async function createProjectTargets(
|
|
|
1706
1779
|
executor: 'nx:run-commands',
|
|
1707
1780
|
continuous: true,
|
|
1708
1781
|
options: {
|
|
1709
|
-
command:
|
|
1782
|
+
command: typecheck.command('-p tsconfig.test.json --noEmit --watch'),
|
|
1710
1783
|
cwd: projectRoot,
|
|
1711
1784
|
},
|
|
1712
1785
|
};
|
|
@@ -2296,9 +2369,9 @@ async function createProjectTargets(
|
|
|
2296
2369
|
// Test configs may resolve the package's own `./index.js` through dist, so the
|
|
2297
2370
|
// current-project declaration output is rebuilt first, not only the
|
|
2298
2371
|
// dependency-project outputs reached through typecheck.
|
|
2299
|
-
targets['typecheck-tests'].dependsOn = ['tsc-js', 'typecheck'];
|
|
2372
|
+
targets['typecheck-tests'].dependsOn = ['tsc-js', 'typecheck', ...typecheck.dependsOn];
|
|
2300
2373
|
} else if (targets.build) {
|
|
2301
|
-
targets['typecheck-tests'].dependsOn = ['build'];
|
|
2374
|
+
targets['typecheck-tests'].dependsOn = ['build', ...typecheck.dependsOn];
|
|
2302
2375
|
}
|
|
2303
2376
|
}
|
|
2304
2377
|
|
|
@@ -2913,6 +2986,7 @@ async function readPackageJson(packageJsonPath: string): Promise<PackageJson> {
|
|
|
2913
2986
|
const rawNx = isRecord(parsed.nx) ? parsed.nx : undefined;
|
|
2914
2987
|
return {
|
|
2915
2988
|
...('bin' in parsed ? { bin: parsed.bin } : {}),
|
|
2989
|
+
...(isRecord(parsed.dependencies) ? { dependencies: parsed.dependencies } : {}),
|
|
2916
2990
|
...(isRecord(parsed.devDependencies) ? { devDependencies: parsed.devDependencies } : {}),
|
|
2917
2991
|
...(typeof parsed.name === 'string' ? { name: parsed.name } : {}),
|
|
2918
2992
|
...(isRecord(parsed.napi) ? { napi: parsed.napi } : {}),
|
|
@@ -9,14 +9,17 @@ import {
|
|
|
9
9
|
} from '../cross-check-policy.js';
|
|
10
10
|
import { PRODUCTION_PUSH_DEPLOY_TAG } from '../deploy-policy.js';
|
|
11
11
|
import type {
|
|
12
|
+
LiteralCacheOrigin,
|
|
12
13
|
NonEmptyArray,
|
|
13
14
|
PackageCargoCredentialsConfig,
|
|
14
15
|
PackageCargoGitOrigin,
|
|
16
|
+
PackageMbxRemoteConfig,
|
|
15
17
|
PackagePrivateNpmConfig,
|
|
16
18
|
PackageRemoteCacheConfig,
|
|
17
19
|
PackageSmooGithub,
|
|
18
20
|
PackageSmooGithubEnvironments,
|
|
19
21
|
PackageSourceCheckoutConfig,
|
|
22
|
+
VariableCacheOrigin,
|
|
20
23
|
} from '../workspace-manifest.js';
|
|
21
24
|
import { renderRunsOnLine } from './github-runs-on.js';
|
|
22
25
|
|
|
@@ -146,6 +149,11 @@ export interface CiWorkflowDefinitionOptions extends DeployStepSecretConfig {
|
|
|
146
149
|
* cache serves the whole fleet. Absent means each runner caches locally.
|
|
147
150
|
*/
|
|
148
151
|
remoteCache?: PackageRemoteCacheConfig;
|
|
152
|
+
/**
|
|
153
|
+
* Declared mbx remote cache (package.json `smoo.mbxRemote`). Every job carries mbx's remote settings, which is
|
|
154
|
+
* what makes setup-devenv route Cargo through mbx. Absent means Cargo builds without mbx.
|
|
155
|
+
*/
|
|
156
|
+
mbxRemote?: PackageMbxRemoteConfig;
|
|
149
157
|
/** GitHub Environments: staging for the validate/e2e jobs, production for the production-on-push job. */
|
|
150
158
|
environments?: PackageSmooGithubEnvironments;
|
|
151
159
|
/** Secrets for the e2e-deployment step, env var name → repository secret name. */
|
|
@@ -316,7 +324,10 @@ jobs:
|
|
|
316
324
|
${renderRunsOnLine(options.runsOn)}
|
|
317
325
|
timeout-minutes: 45
|
|
318
326
|
${
|
|
319
|
-
options.privateNpm?.readTokenEnv ||
|
|
327
|
+
options.privateNpm?.readTokenEnv ||
|
|
328
|
+
options.cargoCredentials !== undefined ||
|
|
329
|
+
options.remoteCache !== undefined ||
|
|
330
|
+
options.mbxRemote !== undefined
|
|
320
331
|
? ` # Fork PRs receive no secrets, so neither a private dependency install nor an
|
|
321
332
|
# authenticated remote cache read can run there.
|
|
322
333
|
if: \${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
|
|
@@ -330,7 +341,7 @@ ${
|
|
|
330
341
|
: ''
|
|
331
342
|
} env:
|
|
332
343
|
GH_TOKEN: ${githubExpression('github.token')}
|
|
333
|
-
${remoteCacheJobEnvLines(options.remoteCache)}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
344
|
+
${remoteCacheJobEnvLines(options.remoteCache, 'internal')}${mbxRemoteJobEnvLines(options.mbxRemote, 'internal')}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
334
345
|
`;
|
|
335
346
|
}
|
|
336
347
|
|
|
@@ -679,30 +690,58 @@ export function normalizeSourceCheckout(config: PackageSourceCheckoutConfig): Pa
|
|
|
679
690
|
* fail every task on 401, which is why the job carries the same fork-PR gate
|
|
680
691
|
* as a private dependency install (see `renderCiWorkflowHeader`).
|
|
681
692
|
*
|
|
682
|
-
* A declared `internalServer` is the address
|
|
683
|
-
*
|
|
684
|
-
*
|
|
693
|
+
* A declared `internalServer` is the address the repository's own runners use, exactly as a git origin's
|
|
694
|
+
* `internalMirror` is: both say those runners sit inside that network. A job on any other runner — a GitHub-hosted
|
|
695
|
+
* one, a macOS label — sits outside it and reaches the public `server`, as a developer shell does. Each job names
|
|
696
|
+
* its reach, so no job is pointed at an address its runner cannot route to.
|
|
685
697
|
* Mechanism errors surface at managed-file render time, never inside CI.
|
|
686
698
|
*/
|
|
687
|
-
export function remoteCacheJobEnvLines(config: PackageRemoteCacheConfig | undefined): string {
|
|
699
|
+
export function remoteCacheJobEnvLines(config: PackageRemoteCacheConfig | undefined, reach: CacheReach): string {
|
|
688
700
|
if (config === undefined) {
|
|
689
701
|
return '';
|
|
690
702
|
}
|
|
691
703
|
const normalized = normalizeRemoteCache(config);
|
|
704
|
+
const server =
|
|
705
|
+
reach === 'internal' ? (normalized.internalServer ?? publicCacheOrigin(normalized)) : publicCacheOrigin(normalized);
|
|
692
706
|
return [
|
|
693
|
-
` NX_SELF_HOSTED_REMOTE_CACHE_SERVER: ${
|
|
707
|
+
` NX_SELF_HOSTED_REMOTE_CACHE_SERVER: ${server}\n`,
|
|
694
708
|
` NX_SELF_HOSTED_REMOTE_CACHE_ACCESS_TOKEN: ${githubExpression(`secrets.${normalized.tokenSecret}`)}\n`,
|
|
695
709
|
].join('');
|
|
696
710
|
}
|
|
697
711
|
|
|
712
|
+
/**
|
|
713
|
+
* Which origin of a declared remote cache a job reaches: `internal` for a job on the repository's own runners
|
|
714
|
+
* (`smoo.github.runsOn`), inside the network `internalServer` names; `public` for any other runner, which reaches
|
|
715
|
+
* only `server`.
|
|
716
|
+
*/
|
|
717
|
+
export type CacheReach = 'internal' | 'public';
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* The public origin as a job env value: the declared origin, or the expression that reads the repository variable
|
|
721
|
+
* naming it.
|
|
722
|
+
*/
|
|
723
|
+
function publicCacheOrigin(config: LiteralCacheOrigin | VariableCacheOrigin): string {
|
|
724
|
+
return 'serverVariable' in config ? githubExpression(`vars.${config.serverVariable}`) : config.server;
|
|
725
|
+
}
|
|
726
|
+
|
|
698
727
|
/** Mechanism errors surface at managed-file render time, never inside CI. */
|
|
699
728
|
export function normalizeRemoteCache(config: PackageRemoteCacheConfig): PackageRemoteCacheConfig {
|
|
700
|
-
|
|
729
|
+
const literal = 'server' in config ? config.server : undefined;
|
|
730
|
+
if ('server' in config && 'serverVariable' in config) {
|
|
731
|
+
throw new Error('smoo.remoteCache names its public origin twice; declare server or serverVariable, not both');
|
|
732
|
+
}
|
|
733
|
+
if (literal !== undefined) {
|
|
734
|
+
assertCacheOrigin('smoo.remoteCache', 'server', literal);
|
|
735
|
+
} else if (!('serverVariable' in config) || !/^[A-Z_][A-Z0-9_]*$/.test(config.serverVariable)) {
|
|
736
|
+
throw new Error(
|
|
737
|
+
`smoo.remoteCache needs server, or an upper-case repository variable name for serverVariable, got ${JSON.stringify(config)}`,
|
|
738
|
+
);
|
|
739
|
+
}
|
|
701
740
|
if (config.internalServer !== undefined) {
|
|
702
|
-
assertCacheOrigin('internalServer', config.internalServer);
|
|
703
|
-
if (config.internalServer ===
|
|
741
|
+
assertCacheOrigin('smoo.remoteCache', 'internalServer', config.internalServer);
|
|
742
|
+
if (config.internalServer === literal) {
|
|
704
743
|
throw new Error(
|
|
705
|
-
`smoo.remoteCache internalServer repeats server ${
|
|
744
|
+
`smoo.remoteCache internalServer repeats server ${literal}; drop internalServer or point it at the address internal runners reach`,
|
|
706
745
|
);
|
|
707
746
|
}
|
|
708
747
|
}
|
|
@@ -720,7 +759,7 @@ export function normalizeRemoteCache(config: PackageRemoteCacheConfig): PackageR
|
|
|
720
759
|
* slash the server routes nowhere, and a path or credential would be dropped
|
|
721
760
|
* or leaked rather than honored.
|
|
722
761
|
*/
|
|
723
|
-
function assertCacheOrigin(field: 'server' | 'internalServer', value: string): void {
|
|
762
|
+
function assertCacheOrigin(declaration: string, field: 'server' | 'internalServer', value: string): void {
|
|
724
763
|
let url: URL | null = null;
|
|
725
764
|
try {
|
|
726
765
|
url = new URL(value);
|
|
@@ -738,7 +777,95 @@ function assertCacheOrigin(field: 'server' | 'internalServer', value: string): v
|
|
|
738
777
|
url.hash !== ''
|
|
739
778
|
) {
|
|
740
779
|
throw new Error(
|
|
741
|
-
|
|
780
|
+
`${declaration} ${field} needs a credential-free http(s) origin with no path and no trailing slash, got ${JSON.stringify(value)}`,
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* The default branch's own runs: a push to it, or a workflow dispatched on it (a release). These are the only lanes
|
|
787
|
+
* given the mbx write token. A pull request's ref is never the default branch, and `pull_request_target` is left out
|
|
788
|
+
* because its ref is the base branch while the code it runs is not.
|
|
789
|
+
*/
|
|
790
|
+
const DEFAULT_BRANCH_LANE =
|
|
791
|
+
"(github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)";
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Job env lines carrying the declared mbx remote cache (`smoo.mbxRemote`). setup-devenv routes Cargo through mbx's
|
|
795
|
+
* Cargo shim when `MBX_REMOTE_URL` is set, so these lines are what turn mbx on for the job; `reach` picks the origin
|
|
796
|
+
* exactly as for the Nx cache. The token is chosen by lane: the write token and `MBX_REMOTE_TRUST_WRITES` on the
|
|
797
|
+
* default branch's own runs, the read-only token everywhere else. mbx's own write policy cannot make that call here:
|
|
798
|
+
* it requires `GITHUB_REF_PROTECTED`, which Forgejo Actions never sets, and it reads a release's `workflow_dispatch`
|
|
799
|
+
* as untrusted. The server's grant on the token is what stops any other job publishing.
|
|
800
|
+
* Mechanism errors surface at managed-file render time, never inside CI.
|
|
801
|
+
*/
|
|
802
|
+
export function mbxRemoteJobEnvLines(config: PackageMbxRemoteConfig | undefined, reach: CacheReach): string {
|
|
803
|
+
if (config === undefined) {
|
|
804
|
+
return '';
|
|
805
|
+
}
|
|
806
|
+
const normalized = normalizeMbxRemote(config);
|
|
807
|
+
const server =
|
|
808
|
+
reach === 'internal' ? (normalized.internalServer ?? publicCacheOrigin(normalized)) : publicCacheOrigin(normalized);
|
|
809
|
+
const token = `${DEFAULT_BRANCH_LANE} && secrets.${normalized.writeTokenSecret} || secrets.${normalized.readTokenSecret}`;
|
|
810
|
+
return [
|
|
811
|
+
` MBX_REMOTE_URL: ${server}\n`,
|
|
812
|
+
` MBX_REMOTE_NAMESPACE: ${normalized.namespace}\n`,
|
|
813
|
+
// One expression per line: a folded scalar would split the lane condition, and Prettier refolds it otherwise.
|
|
814
|
+
' # prettier-ignore\n',
|
|
815
|
+
` MBX_REMOTE_TOKEN: ${githubExpression(token)}\n`,
|
|
816
|
+
' # prettier-ignore\n',
|
|
817
|
+
` MBX_REMOTE_TRUST_WRITES: ${githubExpression(DEFAULT_BRANCH_LANE)}\n`,
|
|
818
|
+
].join('');
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/** Mechanism errors surface at managed-file render time, never inside CI. */
|
|
822
|
+
export function normalizeMbxRemote(config: PackageMbxRemoteConfig): PackageMbxRemoteConfig {
|
|
823
|
+
if ('server' in config && 'serverVariable' in config) {
|
|
824
|
+
throw new Error('smoo.mbxRemote names its public origin twice; declare server or serverVariable, not both');
|
|
825
|
+
}
|
|
826
|
+
if ('server' in config) {
|
|
827
|
+
assertMbxOrigin('server', config.server);
|
|
828
|
+
} else if (!/^[A-Z_][A-Z0-9_]*$/.test(config.serverVariable)) {
|
|
829
|
+
throw new Error(
|
|
830
|
+
`smoo.mbxRemote needs server, or an upper-case repository variable name for serverVariable, got ${JSON.stringify(config)}`,
|
|
831
|
+
);
|
|
832
|
+
}
|
|
833
|
+
if (config.internalServer !== undefined) {
|
|
834
|
+
assertMbxOrigin('internalServer', config.internalServer);
|
|
835
|
+
}
|
|
836
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]*(\/[A-Za-z0-9][A-Za-z0-9._-]*)*$/.test(config.namespace)) {
|
|
837
|
+
throw new Error(
|
|
838
|
+
`smoo.mbxRemote namespace must be slash-separated segments of letters, digits, '.', '_' and '-', got ${JSON.stringify(config.namespace)}`,
|
|
839
|
+
);
|
|
840
|
+
}
|
|
841
|
+
for (const [field, name] of [
|
|
842
|
+
['writeTokenSecret', config.writeTokenSecret],
|
|
843
|
+
['readTokenSecret', config.readTokenSecret],
|
|
844
|
+
] as const) {
|
|
845
|
+
if (!/^[A-Z_][A-Z0-9_]*$/.test(name)) {
|
|
846
|
+
throw new Error(`smoo.mbxRemote needs an upper-case secret name for ${field}, got ${JSON.stringify(name)}`);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
if (config.writeTokenSecret === config.readTokenSecret) {
|
|
850
|
+
throw new Error(
|
|
851
|
+
`smoo.mbxRemote writeTokenSecret and readTokenSecret both name ${config.writeTokenSecret}; untrusted jobs would hold the write token`,
|
|
852
|
+
);
|
|
853
|
+
}
|
|
854
|
+
return config;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* An mbx origin is a cache origin mbx will send its token to: HTTPS, or plain HTTP to a loopback address only, which
|
|
859
|
+
* is mbx's own rule (it refuses the remote otherwise), checked here so a bad declaration fails at render time.
|
|
860
|
+
*/
|
|
861
|
+
function assertMbxOrigin(field: 'server' | 'internalServer', value: string): void {
|
|
862
|
+
assertCacheOrigin('smoo.mbxRemote', field, value);
|
|
863
|
+
const url = new URL(value);
|
|
864
|
+
const loopback =
|
|
865
|
+
url.hostname === 'localhost' || url.hostname === '[::1]' || /^127\.\d+\.\d+\.\d+$/.test(url.hostname);
|
|
866
|
+
if (url.protocol === 'http:' && !loopback) {
|
|
867
|
+
throw new Error(
|
|
868
|
+
`smoo.mbxRemote ${field} ${JSON.stringify(value)} is plain HTTP to a non-loopback host; mbx sends its token only over HTTPS or to loopback`,
|
|
742
869
|
);
|
|
743
870
|
}
|
|
744
871
|
}
|
|
@@ -1268,7 +1395,7 @@ ${options.macosRunsOn === undefined ? ' runs-on: macos-latest' : renderRunsOn
|
|
|
1268
1395
|
if: \${{ needs.main.result == 'success' }}
|
|
1269
1396
|
env:
|
|
1270
1397
|
GH_TOKEN: \${{ github.token }}
|
|
1271
|
-
${remoteCacheJobEnvLines(options.remoteCache)}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
1398
|
+
${remoteCacheJobEnvLines(options.remoteCache, 'public')}${mbxRemoteJobEnvLines(options.mbxRemote, 'public')}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
1272
1399
|
${renderCiWorkflowSteps(followUpSetupSteps(options, numbers), options)}
|
|
1273
1400
|
${renderCiWorkflowSteps(middleSteps, options)}
|
|
1274
1401
|
${renderCiWorkflowSteps(followUpCleanupStep(numbers), options)}`;
|
|
@@ -1366,7 +1493,7 @@ ${renderRunsOnLine(options.runsOn)}
|
|
|
1366
1493
|
${environmentLine(options.environments?.staging)} if: \${{ needs.main.result == 'success' && needs.main.outputs.deployment-stage != '' }}
|
|
1367
1494
|
env:
|
|
1368
1495
|
GH_TOKEN: \${{ github.token }}
|
|
1369
|
-
${remoteCacheJobEnvLines(options.remoteCache)}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
1496
|
+
${remoteCacheJobEnvLines(options.remoteCache, 'internal')}${mbxRemoteJobEnvLines(options.mbxRemote, 'internal')}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
1370
1497
|
${renderCiWorkflowSteps(followUpSetupSteps(options, numbers), options)}
|
|
1371
1498
|
# Step ${numbers.middle}
|
|
1372
1499
|
- name: E2E Tests (Deployed Stage)
|
|
@@ -1398,7 +1525,7 @@ ${renderRunsOnLine(options.runsOn)}
|
|
|
1398
1525
|
if: \${{ !cancelled() && github.event_name == 'push' && github.ref == ${stagingRefLiteral(options)} && needs.main.result == 'success'${e2eGate} }}
|
|
1399
1526
|
${environmentLine(options.environments?.production)} env:
|
|
1400
1527
|
GH_TOKEN: \${{ github.token }}
|
|
1401
|
-
${remoteCacheJobEnvLines(options.remoteCache)}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
1528
|
+
${remoteCacheJobEnvLines(options.remoteCache, 'internal')}${mbxRemoteJobEnvLines(options.mbxRemote, 'internal')}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
1402
1529
|
${renderCiWorkflowSteps(followUpSetupSteps(options, numbers), options)}
|
|
1403
1530
|
# Step ${numbers.middle}
|
|
1404
1531
|
- name: 🚀 Deploy Production
|
|
@@ -77,6 +77,7 @@ export function deriveManagedFileContext(
|
|
|
77
77
|
sourceCheckouts,
|
|
78
78
|
cargoCredentials,
|
|
79
79
|
remoteCache: manifest?.smoo?.remoteCache,
|
|
80
|
+
mbxRemote: manifest?.smoo?.mbxRemote,
|
|
80
81
|
macosPlatformArchitectures: MACOS_PLATFORM_TARGET_GLOBS.some((glob) => releasePlatformTargetGlobs.includes(glob))
|
|
81
82
|
? macosPlatformArchitecturesForTest(targetNames)
|
|
82
83
|
: [],
|
|
@@ -4,6 +4,7 @@ import { managedAssetsRoot } from '../managed-assets.js';
|
|
|
4
4
|
import type {
|
|
5
5
|
NonEmptyArray,
|
|
6
6
|
PackageCargoCredentialsConfig,
|
|
7
|
+
PackageMbxRemoteConfig,
|
|
7
8
|
PackagePrivateNpmConfig,
|
|
8
9
|
PackageRemoteCacheConfig,
|
|
9
10
|
PackageSmooGithub,
|
|
@@ -59,6 +60,8 @@ export interface ManagedFileContext {
|
|
|
59
60
|
cargoCredentials?: PackageCargoCredentialsConfig;
|
|
60
61
|
/** Declared self-hosted Nx remote cache from the root smoo config; absent means local caching only. */
|
|
61
62
|
remoteCache?: PackageRemoteCacheConfig;
|
|
63
|
+
/** Declared mbx remote cache from the root smoo config; absent means Cargo builds without mbx. */
|
|
64
|
+
mbxRemote?: PackageMbxRemoteConfig;
|
|
62
65
|
/**
|
|
63
66
|
* Cross-built test archives the graph can produce, one per foreign target
|
|
64
67
|
* triple the cargo workspace declares. Empty for a repository that declares
|
|
@@ -380,6 +383,7 @@ function getManagedContent(file: ManagedFileDescriptor, context: ManagedFileCont
|
|
|
380
383
|
sourceCheckouts: context.sourceCheckouts,
|
|
381
384
|
cargoCredentials: context.cargoCredentials,
|
|
382
385
|
remoteCache: context.remoteCache,
|
|
386
|
+
mbxRemote: context.mbxRemote,
|
|
383
387
|
environments: context.ciEnvironments,
|
|
384
388
|
deploySecrets: context.ciDeploySecrets,
|
|
385
389
|
e2eSecrets: context.ciE2eSecrets,
|
|
@@ -407,6 +411,7 @@ function getManagedContent(file: ManagedFileDescriptor, context: ManagedFileCont
|
|
|
407
411
|
sourceCheckouts: context.sourceCheckouts,
|
|
408
412
|
cargoCredentials: context.cargoCredentials,
|
|
409
413
|
remoteCache: context.remoteCache,
|
|
414
|
+
mbxRemote: context.mbxRemote,
|
|
410
415
|
deploySecrets: context.ciDeploySecrets,
|
|
411
416
|
});
|
|
412
417
|
}
|