gagen 0.5.0 → 0.5.1
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 +125 -0
- package/esm/deps/jsr.io/@std/internal/{1.0.13 → 1.0.14}/build_message.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/internal/{1.0.13 → 1.0.14}/diff.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/internal/{1.0.13 → 1.0.14}/diff_str.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/internal/{1.0.13 → 1.0.14}/format.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/internal/{1.0.13 → 1.0.14}/styles.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/internal/{1.0.13 → 1.0.14}/types.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_chars.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_dumper_state.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_loader_state.d.ts +2 -2
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_loader_state.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_loader_state.js +29 -12
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_schema.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/binary.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/bool.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/float.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/int.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/map.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/merge.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/nil.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/omap.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/pairs.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/regexp.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/seq.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/set.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/str.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/timestamp.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/undefined.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_utils.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/parse.d.ts +7 -5
- package/esm/deps/jsr.io/@std/yaml/1.1.1/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/parse.js +3 -1
- package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/stringify.d.ts.map +1 -1
- package/esm/job.d.ts.map +1 -1
- package/esm/job.js +201 -62
- package/esm/mod.d.ts +1 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/pin.d.ts.map +1 -1
- package/esm/pin.js +17 -8
- package/esm/step.d.ts +48 -1
- package/esm/step.d.ts.map +1 -1
- package/esm/step.js +117 -3
- package/esm/workflow.js +2 -2
- package/package.json +1 -1
- package/esm/deps/jsr.io/@std/yaml/1.1.0/parse.d.ts.map +0 -1
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_chars.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_chars.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_dumper_state.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_dumper_state.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_schema.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_schema.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/binary.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/binary.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/bool.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/bool.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/float.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/float.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/int.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/int.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/map.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/map.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/merge.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/merge.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/nil.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/nil.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/omap.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/omap.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/pairs.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/pairs.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/regexp.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/regexp.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/seq.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/seq.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/set.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/set.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/str.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/str.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/timestamp.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/timestamp.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/undefined.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type/undefined.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_type.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_utils.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/_utils.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/stringify.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.1.0 → 1.1.1}/stringify.js +0 -0
package/esm/job.js
CHANGED
|
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _Job_instances, _Job_id, _Job_config, _Job_leafItems, _Job_outputDefs, _Job_cachedGraph, _Job_cachedLeafSteps, _Job_buildGraph;
|
|
12
|
+
var _Job_instances, _Job_id, _Job_config, _Job_leafItems, _Job_outputDefs, _Job_cachedGraph, _Job_cachedLeafSteps, _Job_cachedMembership, _Job_buildGraph, _Job_resolveUnits;
|
|
13
13
|
import { Condition, ExpressionValue, isAlwaysFalse, isAlwaysTrue, } from "./expression.js";
|
|
14
14
|
import { Matrix } from "./matrix.js";
|
|
15
15
|
import { normalizeStepLike, serializeConditionLike, serializeConfigValues, Step, StepRef, toCondition, unwrapSteps, } from "./step.js";
|
|
@@ -59,27 +59,61 @@ function combineAndConditions(a, b) {
|
|
|
59
59
|
return a ?? b;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
* Returns a
|
|
63
|
-
*
|
|
64
|
-
*
|
|
62
|
+
* Returns a condition suitable for passing down to dependencies, or undefined
|
|
63
|
+
* if it references step outputs (which would create circular condition
|
|
64
|
+
* dependencies — a dependency cannot be gated on an output produced by a step
|
|
65
|
+
* that runs after it).
|
|
65
66
|
*/
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
if (configIf == null)
|
|
67
|
+
function propagatableCondition(condition) {
|
|
68
|
+
if (condition == null)
|
|
69
69
|
return undefined;
|
|
70
|
-
if (
|
|
71
|
-
for (const source of
|
|
70
|
+
if (condition instanceof Condition) {
|
|
71
|
+
for (const source of condition.sources) {
|
|
72
72
|
if (source instanceof Step)
|
|
73
73
|
return undefined;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
if (
|
|
77
|
-
for (const source of
|
|
76
|
+
if (condition instanceof ExpressionValue) {
|
|
77
|
+
for (const source of condition.allSources) {
|
|
78
78
|
if (source instanceof Step)
|
|
79
79
|
return undefined;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
return
|
|
82
|
+
return condition;
|
|
83
|
+
}
|
|
84
|
+
/** Returns a step's config.if if it is safe to propagate to dependencies. */
|
|
85
|
+
function propagatableConfigIf(step) {
|
|
86
|
+
return propagatableCondition(step.config.if);
|
|
87
|
+
}
|
|
88
|
+
function recordMember(membership, group, step) {
|
|
89
|
+
const c = step.config;
|
|
90
|
+
if (c.background || c.wait != null || c.waitAll || c.cancel != null) {
|
|
91
|
+
// a parallel block already runs each member as a background step with an
|
|
92
|
+
// implicit wait-all, so background/wait/wait-all/cancel members make no sense
|
|
93
|
+
throw new Error("A parallel group member cannot be a background, wait, wait-all, or " +
|
|
94
|
+
"cancel step.");
|
|
95
|
+
}
|
|
96
|
+
if (membership.memberToGroup.has(step))
|
|
97
|
+
return;
|
|
98
|
+
membership.memberToGroup.set(step, group);
|
|
99
|
+
let members = membership.groupMembers.get(group);
|
|
100
|
+
if (!members) {
|
|
101
|
+
members = [];
|
|
102
|
+
membership.groupMembers.set(group, members);
|
|
103
|
+
}
|
|
104
|
+
members.push(step);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Rejects a composite step used directly as a parallel group member. Members
|
|
108
|
+
* run concurrently with no ordering, so a member cannot itself be a nested
|
|
109
|
+
* parallel group or a sequential group of steps.
|
|
110
|
+
*/
|
|
111
|
+
function throwInvalidParallelMember(composite) {
|
|
112
|
+
if (composite.kind === "parallel") {
|
|
113
|
+
throw new Error("Parallel groups cannot be nested.");
|
|
114
|
+
}
|
|
115
|
+
throw new Error("A parallel group member cannot itself be a group of steps — " +
|
|
116
|
+
"each member must be a single step.");
|
|
83
117
|
}
|
|
84
118
|
/**
|
|
85
119
|
* Recursively flattens a StepLike tree into a flat graph of Steps with
|
|
@@ -93,22 +127,28 @@ function propagatableConfigIf(step) {
|
|
|
93
127
|
* collected in `deferredAfterDeps` and resolved later, so that comesAfter
|
|
94
128
|
* only adds ordering edges for steps already present in the graph.
|
|
95
129
|
*/
|
|
96
|
-
function flattenStepLike(rawItem, graph, isLeaf, leafSteps, deferredAfterDeps, contextCondition) {
|
|
130
|
+
function flattenStepLike(rawItem, graph, isLeaf, leafSteps, deferredAfterDeps, membership, contextCondition, parallelGroup) {
|
|
97
131
|
const item = normalizeStepLike(rawItem);
|
|
98
132
|
if (item instanceof StepRef) {
|
|
99
133
|
const step = item.step;
|
|
100
134
|
// AND this StepRef's condition with the parent context
|
|
101
135
|
const newContext = combineAndConditions(contextCondition, item.condition);
|
|
102
136
|
if (step.children.length > 0) {
|
|
103
|
-
// StepRef wrapping composite step: recurse with combined context
|
|
137
|
+
// StepRef wrapping composite step: recurse with combined context.
|
|
138
|
+
// a parallel composite makes its children concurrent members.
|
|
139
|
+
if (parallelGroup != null)
|
|
140
|
+
throwInvalidParallelMember(step);
|
|
141
|
+
const childGroup = step.kind === "parallel" ? step : parallelGroup;
|
|
104
142
|
const contributed = [];
|
|
105
143
|
for (const child of step.children) {
|
|
106
|
-
contributed.push(...flattenStepLike(child, graph, isLeaf, leafSteps, deferredAfterDeps, newContext));
|
|
144
|
+
contributed.push(...flattenStepLike(child, graph, isLeaf, leafSteps, deferredAfterDeps, membership, newContext, childGroup));
|
|
107
145
|
}
|
|
108
|
-
// compute aggregate dep context:
|
|
146
|
+
// compute aggregate dep context: context AND (OR of children's
|
|
109
147
|
// config.ifs). If any child is unconditional, or the OR is a tautology,
|
|
110
|
-
// just use
|
|
111
|
-
|
|
148
|
+
// just use the context. The context is filtered so an output-referencing
|
|
149
|
+
// condition doesn't propagate to dependencies (circular dependency).
|
|
150
|
+
const depBaseCtx = propagatableCondition(newContext);
|
|
151
|
+
let compositeDepsCtx = depBaseCtx;
|
|
112
152
|
if (item.dependencies.length > 0) {
|
|
113
153
|
const childIfs = [];
|
|
114
154
|
let allConditional = true;
|
|
@@ -123,13 +163,14 @@ function flattenStepLike(rawItem, graph, isLeaf, leafSteps, deferredAfterDeps, c
|
|
|
123
163
|
if (allConditional && childIfs.length > 0) {
|
|
124
164
|
const orCond = simplifyOrConditions(childIfs.map((c) => toCondition(c)));
|
|
125
165
|
if (orCond != null) {
|
|
126
|
-
compositeDepsCtx = combineAndConditions(
|
|
166
|
+
compositeDepsCtx = combineAndConditions(depBaseCtx, orCond);
|
|
127
167
|
}
|
|
128
168
|
}
|
|
129
169
|
}
|
|
130
|
-
// apply deps once with aggregate context, add to all children's dep sets
|
|
170
|
+
// apply deps once with aggregate context, add to all children's dep sets.
|
|
171
|
+
// deps are not group members — they are hoisted to run before the group.
|
|
131
172
|
for (const dep of item.dependencies) {
|
|
132
|
-
const depSteps = flattenStepLike(dep, graph, false, [], deferredAfterDeps, compositeDepsCtx);
|
|
173
|
+
const depSteps = flattenStepLike(dep, graph, false, [], deferredAfterDeps, membership, compositeDepsCtx);
|
|
133
174
|
for (const s of contributed) {
|
|
134
175
|
const entry = graph.get(s);
|
|
135
176
|
for (const ds of depSteps)
|
|
@@ -147,11 +188,15 @@ function flattenStepLike(rawItem, graph, isLeaf, leafSteps, deferredAfterDeps, c
|
|
|
147
188
|
const entry = ensureEntry(graph, step);
|
|
148
189
|
if (isLeaf)
|
|
149
190
|
leafSteps.push(step);
|
|
191
|
+
if (parallelGroup)
|
|
192
|
+
recordMember(membership, parallelGroup, step);
|
|
150
193
|
applyContextCondition(entry, newContext);
|
|
151
|
-
// include step's config.if in the dep context
|
|
152
|
-
|
|
194
|
+
// include step's config.if in the dep context. both the context and the
|
|
195
|
+
// config.if are filtered so output-referencing conditions don't propagate
|
|
196
|
+
// to dependencies (which would create a circular condition dependency).
|
|
197
|
+
const depContext = combineAndConditions(propagatableCondition(newContext), propagatableConfigIf(step));
|
|
153
198
|
for (const dep of item.dependencies) {
|
|
154
|
-
flattenDep(dep, entry.deps, graph, deferredAfterDeps, depContext);
|
|
199
|
+
flattenDep(dep, entry.deps, graph, deferredAfterDeps, membership, depContext);
|
|
155
200
|
}
|
|
156
201
|
for (const dep of item.afterDependencies) {
|
|
157
202
|
deferredAfterDeps.push({ step, target: dep });
|
|
@@ -160,10 +205,14 @@ function flattenStepLike(rawItem, graph, isLeaf, leafSteps, deferredAfterDeps, c
|
|
|
160
205
|
}
|
|
161
206
|
// Step (leaf or composite)
|
|
162
207
|
if (item.children.length > 0) {
|
|
163
|
-
// composite step: recurse into children with same context
|
|
208
|
+
// composite step: recurse into children with same context.
|
|
209
|
+
// a parallel composite makes its children concurrent members.
|
|
210
|
+
if (parallelGroup != null)
|
|
211
|
+
throwInvalidParallelMember(item);
|
|
212
|
+
const childGroup = item.kind === "parallel" ? item : parallelGroup;
|
|
164
213
|
const contributed = [];
|
|
165
214
|
for (const child of item.children) {
|
|
166
|
-
contributed.push(...flattenStepLike(child, graph, isLeaf, leafSteps, deferredAfterDeps, contextCondition));
|
|
215
|
+
contributed.push(...flattenStepLike(child, graph, isLeaf, leafSteps, deferredAfterDeps, membership, contextCondition, childGroup));
|
|
167
216
|
}
|
|
168
217
|
return contributed;
|
|
169
218
|
}
|
|
@@ -171,12 +220,14 @@ function flattenStepLike(rawItem, graph, isLeaf, leafSteps, deferredAfterDeps, c
|
|
|
171
220
|
const entry = ensureEntry(graph, item);
|
|
172
221
|
if (isLeaf)
|
|
173
222
|
leafSteps.push(item);
|
|
223
|
+
if (parallelGroup)
|
|
224
|
+
recordMember(membership, parallelGroup, item);
|
|
174
225
|
applyContextCondition(entry, contextCondition);
|
|
175
226
|
return [item];
|
|
176
227
|
}
|
|
177
228
|
/** Flattens a dependency target into the graph and adds it to a dep set. */
|
|
178
|
-
function flattenDep(dep, targetSet, graph, deferredAfterDeps, contextCondition) {
|
|
179
|
-
const steps = flattenStepLike(dep, graph, false, [], deferredAfterDeps, contextCondition);
|
|
229
|
+
function flattenDep(dep, targetSet, graph, deferredAfterDeps, membership, contextCondition) {
|
|
230
|
+
const steps = flattenStepLike(dep, graph, false, [], deferredAfterDeps, membership, contextCondition);
|
|
180
231
|
for (const s of steps) {
|
|
181
232
|
targetSet.add(s);
|
|
182
233
|
}
|
|
@@ -225,6 +276,7 @@ export class Job {
|
|
|
225
276
|
// cached graph — built lazily
|
|
226
277
|
_Job_cachedGraph.set(this, void 0);
|
|
227
278
|
_Job_cachedLeafSteps.set(this, void 0);
|
|
279
|
+
_Job_cachedMembership.set(this, void 0);
|
|
228
280
|
__classPrivateFieldSet(this, _Job_id, id, "f");
|
|
229
281
|
__classPrivateFieldSet(this, _Job_config, config, "f");
|
|
230
282
|
if (init?.steps) {
|
|
@@ -245,29 +297,8 @@ export class Job {
|
|
|
245
297
|
}
|
|
246
298
|
resolveSteps() {
|
|
247
299
|
const { graph, leafSteps } = __classPrivateFieldGet(this, _Job_instances, "m", _Job_buildGraph).call(this);
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
// leaf step that transitively depends on it (directly or via
|
|
251
|
-
// condition sources). This makes the topo sort respect steps order.
|
|
252
|
-
const priority = new Map();
|
|
253
|
-
const assignPriority = (s, p) => {
|
|
254
|
-
const current = priority.get(s);
|
|
255
|
-
if (current !== undefined && current <= p)
|
|
256
|
-
return;
|
|
257
|
-
priority.set(s, p);
|
|
258
|
-
const entry = graph.get(s);
|
|
259
|
-
if (!entry)
|
|
260
|
-
return;
|
|
261
|
-
for (const dep of entry.deps) {
|
|
262
|
-
if (allSteps.has(dep)) {
|
|
263
|
-
assignPriority(dep, p);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
for (let i = 0; i < leafSteps.length; i++) {
|
|
268
|
-
assignPriority(leafSteps[i], i);
|
|
269
|
-
}
|
|
270
|
-
return topoSort(allSteps, priority, graph);
|
|
300
|
+
const priority = computePriorities(graph, leafSteps);
|
|
301
|
+
return topoSort(new Set(graph.keys()), priority, graph);
|
|
271
302
|
}
|
|
272
303
|
inferNeeds(stepOwners) {
|
|
273
304
|
const config = __classPrivateFieldGet(this, _Job_config, "f");
|
|
@@ -438,26 +469,49 @@ export class Job {
|
|
|
438
469
|
}
|
|
439
470
|
// steps
|
|
440
471
|
const { graph } = __classPrivateFieldGet(this, _Job_instances, "m", _Job_buildGraph).call(this);
|
|
441
|
-
const
|
|
442
|
-
const effectiveConditions = computeEffectiveConditions(
|
|
443
|
-
|
|
444
|
-
.filter((s) => {
|
|
472
|
+
const units = __classPrivateFieldGet(this, _Job_instances, "m", _Job_resolveUnits).call(this);
|
|
473
|
+
const effectiveConditions = computeEffectiveConditions(units.flatMap((u) => u.steps), graph);
|
|
474
|
+
const isVisible = (s) => {
|
|
445
475
|
const cond = effectiveConditions.get(s);
|
|
446
476
|
return cond == null || !isAlwaysFalse(cond);
|
|
447
|
-
}
|
|
448
|
-
|
|
477
|
+
};
|
|
478
|
+
const serialize = (s) => s.toYaml(effectiveConditions.get(s));
|
|
479
|
+
const steps = [];
|
|
480
|
+
for (const unit of units) {
|
|
481
|
+
const visible = unit.steps.filter(isVisible);
|
|
482
|
+
if (visible.length === 0)
|
|
483
|
+
continue;
|
|
484
|
+
// a parallel block only makes sense with more than one step; collapse a
|
|
485
|
+
// single remaining step back to a normal sequential step
|
|
486
|
+
if (unit.parallel && visible.length > 1) {
|
|
487
|
+
steps.push({ parallel: visible.map(serialize) });
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
for (const s of visible)
|
|
491
|
+
steps.push(serialize(s));
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
result.steps = steps;
|
|
449
495
|
return result;
|
|
450
496
|
}
|
|
451
497
|
}
|
|
452
|
-
_Job_id = new WeakMap(), _Job_config = new WeakMap(), _Job_leafItems = new WeakMap(), _Job_outputDefs = new WeakMap(), _Job_cachedGraph = new WeakMap(), _Job_cachedLeafSteps = new WeakMap(), _Job_instances = new WeakSet(), _Job_buildGraph = function _Job_buildGraph() {
|
|
453
|
-
if (__classPrivateFieldGet(this, _Job_cachedGraph, "f") && __classPrivateFieldGet(this, _Job_cachedLeafSteps, "f")) {
|
|
454
|
-
return {
|
|
498
|
+
_Job_id = new WeakMap(), _Job_config = new WeakMap(), _Job_leafItems = new WeakMap(), _Job_outputDefs = new WeakMap(), _Job_cachedGraph = new WeakMap(), _Job_cachedLeafSteps = new WeakMap(), _Job_cachedMembership = new WeakMap(), _Job_instances = new WeakSet(), _Job_buildGraph = function _Job_buildGraph() {
|
|
499
|
+
if (__classPrivateFieldGet(this, _Job_cachedGraph, "f") && __classPrivateFieldGet(this, _Job_cachedLeafSteps, "f") && __classPrivateFieldGet(this, _Job_cachedMembership, "f")) {
|
|
500
|
+
return {
|
|
501
|
+
graph: __classPrivateFieldGet(this, _Job_cachedGraph, "f"),
|
|
502
|
+
leafSteps: __classPrivateFieldGet(this, _Job_cachedLeafSteps, "f"),
|
|
503
|
+
membership: __classPrivateFieldGet(this, _Job_cachedMembership, "f"),
|
|
504
|
+
};
|
|
455
505
|
}
|
|
456
506
|
const graph = new Map();
|
|
457
507
|
const leafSteps = [];
|
|
458
508
|
const deferredAfterDeps = [];
|
|
509
|
+
const membership = {
|
|
510
|
+
memberToGroup: new Map(),
|
|
511
|
+
groupMembers: new Map(),
|
|
512
|
+
};
|
|
459
513
|
for (const item of __classPrivateFieldGet(this, _Job_leafItems, "f")) {
|
|
460
|
-
flattenStepLike(item, graph, true, leafSteps, deferredAfterDeps);
|
|
514
|
+
flattenStepLike(item, graph, true, leafSteps, deferredAfterDeps, membership);
|
|
461
515
|
}
|
|
462
516
|
addConditionSourceDeps(graph);
|
|
463
517
|
// resolve deferred after-deps: only add ordering edges for steps
|
|
@@ -471,7 +525,65 @@ _Job_id = new WeakMap(), _Job_config = new WeakMap(), _Job_leafItems = new WeakM
|
|
|
471
525
|
}
|
|
472
526
|
__classPrivateFieldSet(this, _Job_cachedGraph, graph, "f");
|
|
473
527
|
__classPrivateFieldSet(this, _Job_cachedLeafSteps, leafSteps, "f");
|
|
474
|
-
|
|
528
|
+
__classPrivateFieldSet(this, _Job_cachedMembership, membership, "f");
|
|
529
|
+
return { graph, leafSteps, membership };
|
|
530
|
+
}, _Job_resolveUnits = function _Job_resolveUnits() {
|
|
531
|
+
const { graph, leafSteps, membership } = __classPrivateFieldGet(this, _Job_instances, "m", _Job_buildGraph).call(this);
|
|
532
|
+
const { memberToGroup, groupMembers } = membership;
|
|
533
|
+
const priority = computePriorities(graph, leafSteps);
|
|
534
|
+
// representative node of a step: its parallel group, or the step itself
|
|
535
|
+
const repOf = (s) => memberToGroup.get(s) ?? s;
|
|
536
|
+
// build a contracted graph with one node per group + each free step
|
|
537
|
+
const nodes = new Set();
|
|
538
|
+
for (const s of graph.keys())
|
|
539
|
+
nodes.add(repOf(s));
|
|
540
|
+
const contracted = new Map();
|
|
541
|
+
for (const node of nodes) {
|
|
542
|
+
contracted.set(node, {
|
|
543
|
+
deps: new Set(),
|
|
544
|
+
afterDeps: new Set(),
|
|
545
|
+
contexts: [],
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
for (const [s, entry] of graph) {
|
|
549
|
+
const from = repOf(s);
|
|
550
|
+
const cEntry = contracted.get(from);
|
|
551
|
+
for (const dep of entry.deps) {
|
|
552
|
+
const to = repOf(dep);
|
|
553
|
+
if (to === from) {
|
|
554
|
+
if (s !== dep) {
|
|
555
|
+
throw new Error(`Steps in a parallel group cannot depend on each other: ${stepLabel(dep)} → ${stepLabel(s)}`);
|
|
556
|
+
}
|
|
557
|
+
continue;
|
|
558
|
+
}
|
|
559
|
+
cEntry.deps.add(to);
|
|
560
|
+
}
|
|
561
|
+
for (const dep of entry.afterDeps) {
|
|
562
|
+
const to = repOf(dep);
|
|
563
|
+
if (to === from) {
|
|
564
|
+
if (s !== dep) {
|
|
565
|
+
throw new Error(`Steps in a parallel group cannot be ordered after each other: ${stepLabel(dep)} → ${stepLabel(s)}`);
|
|
566
|
+
}
|
|
567
|
+
continue;
|
|
568
|
+
}
|
|
569
|
+
cEntry.afterDeps.add(to);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
// contracted priority = best (minimum) priority among the node's members
|
|
573
|
+
const contractedPriority = new Map();
|
|
574
|
+
for (const [s, p] of priority) {
|
|
575
|
+
const node = repOf(s);
|
|
576
|
+
const current = contractedPriority.get(node);
|
|
577
|
+
if (current === undefined || p < current) {
|
|
578
|
+
contractedPriority.set(node, p);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
return topoSort(nodes, contractedPriority, contracted).map((node) => {
|
|
582
|
+
const members = groupMembers.get(node);
|
|
583
|
+
return members
|
|
584
|
+
? { parallel: true, steps: members }
|
|
585
|
+
: { parallel: false, steps: [node] };
|
|
586
|
+
});
|
|
475
587
|
};
|
|
476
588
|
// --- effective conditions ---
|
|
477
589
|
/**
|
|
@@ -751,6 +863,33 @@ function extractCommonFactors(terms) {
|
|
|
751
863
|
return result;
|
|
752
864
|
}
|
|
753
865
|
// --- topological sort ---
|
|
866
|
+
/**
|
|
867
|
+
* Computes step priorities: each step gets the minimum leaf index of any leaf
|
|
868
|
+
* step that transitively depends on it (directly or via condition sources).
|
|
869
|
+
* This makes the topological sort respect the declared `steps` order.
|
|
870
|
+
*/
|
|
871
|
+
function computePriorities(graph, leafSteps) {
|
|
872
|
+
const allSteps = new Set(graph.keys());
|
|
873
|
+
const priority = new Map();
|
|
874
|
+
const assignPriority = (s, p) => {
|
|
875
|
+
const current = priority.get(s);
|
|
876
|
+
if (current !== undefined && current <= p)
|
|
877
|
+
return;
|
|
878
|
+
priority.set(s, p);
|
|
879
|
+
const entry = graph.get(s);
|
|
880
|
+
if (!entry)
|
|
881
|
+
return;
|
|
882
|
+
for (const dep of entry.deps) {
|
|
883
|
+
if (allSteps.has(dep)) {
|
|
884
|
+
assignPriority(dep, p);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
for (let i = 0; i < leafSteps.length; i++) {
|
|
889
|
+
assignPriority(leafSteps[i], i);
|
|
890
|
+
}
|
|
891
|
+
return priority;
|
|
892
|
+
}
|
|
754
893
|
function topoSort(steps, priority, graph) {
|
|
755
894
|
// build in-degree map (only counting unique predecessors within our set)
|
|
756
895
|
const inDegree = new Map();
|
package/esm/mod.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./_dnt.polyfills.js";
|
|
2
2
|
export { Step, step, StepRef } from "./step.js";
|
|
3
|
-
export type { ConditionLike, ConfigValue, StepBuilder, StepConfig, StepFunction, StepLike, } from "./step.js";
|
|
3
|
+
export type { CompositeKind, ConditionLike, ConfigValue, StepBuilder, StepConfig, StepFunction, StepLike, } from "./step.js";
|
|
4
4
|
export { Job, job } from "./job.js";
|
|
5
5
|
export type { JobConfig, JobDef, ReusableJobConfig, ReusableJobDef, RunsOn, ServiceContainer, StepsJobConfig, StepsJobDef, } from "./job.js";
|
|
6
6
|
export { isLinting, Workflow, workflow } from "./workflow.js";
|
package/esm/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAChD,YAAY,EACV,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,YAAY,EACZ,QAAQ,GACT,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,GAAG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AM,CAAC;IAAC,OAAO,EAAE,aAAa,EAAE,CAAA;CAAE,CAY/C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,QAAQ,EAAE,GACf,OAAO,CAsCT"}
|
package/esm/pin.js
CHANGED
|
@@ -200,19 +200,28 @@ export function unpinParsedYaml(obj, pins) {
|
|
|
200
200
|
hashToOriginal.has(jobObj.uses)) {
|
|
201
201
|
jobObj.uses = hashToOriginal.get(jobObj.uses);
|
|
202
202
|
}
|
|
203
|
-
// steps
|
|
203
|
+
// steps (including steps nested inside parallel: blocks)
|
|
204
204
|
if (Array.isArray(jobObj.steps)) {
|
|
205
205
|
for (const s of jobObj.steps) {
|
|
206
|
-
|
|
207
|
-
const stepObj = s;
|
|
208
|
-
if (typeof stepObj.uses === "string" &&
|
|
209
|
-
hashToOriginal.has(stepObj.uses)) {
|
|
210
|
-
stepObj.uses = hashToOriginal.get(stepObj.uses);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
206
|
+
unpinStep(s, hashToOriginal);
|
|
213
207
|
}
|
|
214
208
|
}
|
|
215
209
|
}
|
|
216
210
|
}
|
|
217
211
|
return obj;
|
|
218
212
|
}
|
|
213
|
+
/** Reverts a pinned hash on a single step, recursing into `parallel:` blocks. */
|
|
214
|
+
function unpinStep(step, hashToOriginal) {
|
|
215
|
+
if (typeof step !== "object" || step === null)
|
|
216
|
+
return;
|
|
217
|
+
const stepObj = step;
|
|
218
|
+
if (typeof stepObj.uses === "string" &&
|
|
219
|
+
hashToOriginal.has(stepObj.uses)) {
|
|
220
|
+
stepObj.uses = hashToOriginal.get(stepObj.uses);
|
|
221
|
+
}
|
|
222
|
+
if (Array.isArray(stepObj.parallel)) {
|
|
223
|
+
for (const child of stepObj.parallel) {
|
|
224
|
+
unpinStep(child, hashToOriginal);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
package/esm/step.d.ts
CHANGED
|
@@ -14,9 +14,32 @@ export interface StepConfig<O extends string = never> {
|
|
|
14
14
|
readonly continueOnError?: boolean | string;
|
|
15
15
|
readonly timeoutMinutes?: number;
|
|
16
16
|
readonly outputs?: readonly O[];
|
|
17
|
+
/** Runs the step asynchronously so the job continues without waiting for it. */
|
|
18
|
+
readonly background?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Makes this a `wait` step that blocks until the referenced background
|
|
21
|
+
* step(s) finish. Prefer `step.waitFor(...)`, which also wires up ordering.
|
|
22
|
+
*/
|
|
23
|
+
readonly wait?: StepLike | readonly StepLike[];
|
|
24
|
+
/**
|
|
25
|
+
* Makes this a `wait-all` step that blocks until all active background steps
|
|
26
|
+
* finish. Prefer `step.waitForAll()`.
|
|
27
|
+
*/
|
|
28
|
+
readonly waitAll?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Makes this a `cancel` step that terminates the referenced background step.
|
|
31
|
+
* Prefer `step.cancel(...)`, which also wires up ordering.
|
|
32
|
+
*/
|
|
33
|
+
readonly cancel?: StepLike;
|
|
17
34
|
}
|
|
18
35
|
export declare function resetStepCounter(): void;
|
|
19
36
|
export type StepLike = Step<string> | StepRef<string> | StepConfig;
|
|
37
|
+
/**
|
|
38
|
+
* How a composite step's children relate to each other. "sequential" children
|
|
39
|
+
* run one after another (the default); "parallel" children run concurrently and
|
|
40
|
+
* serialize to a GitHub Actions `parallel:` block.
|
|
41
|
+
*/
|
|
42
|
+
export type CompositeKind = "sequential" | "parallel";
|
|
20
43
|
export declare class Step<O extends string = never> implements ExpressionSource {
|
|
21
44
|
#private;
|
|
22
45
|
readonly config: StepConfig<O>;
|
|
@@ -26,8 +49,10 @@ export declare class Step<O extends string = never> implements ExpressionSource
|
|
|
26
49
|
readonly _crossJobDeps: readonly Step<string>[];
|
|
27
50
|
readonly children: readonly StepLike[];
|
|
28
51
|
constructor(config: StepConfig<O>, crossJobDeps?: Step<string>[]);
|
|
29
|
-
constructor(children: readonly StepLike[]);
|
|
52
|
+
constructor(children: readonly StepLike[], kind?: CompositeKind);
|
|
30
53
|
get id(): string;
|
|
54
|
+
/** Whether this composite's children run sequentially or in parallel. */
|
|
55
|
+
get kind(): CompositeKind;
|
|
31
56
|
dependsOn(...deps: StepLike[]): StepRef<O>;
|
|
32
57
|
comesAfter(...deps: StepLike[]): StepRef<O>;
|
|
33
58
|
if(condition: ConditionLike): StepRef<O>;
|
|
@@ -38,12 +63,34 @@ export interface StepBuilder {
|
|
|
38
63
|
if(condition: ConditionLike): StepBuilder;
|
|
39
64
|
dependsOn(...deps: StepLike[]): StepBuilder;
|
|
40
65
|
comesAfter(...deps: StepLike[]): StepBuilder;
|
|
66
|
+
/** Builds a parallel group from the args, carrying this builder's deps/condition. */
|
|
67
|
+
parallel(...args: (StepConfig | Step<string> | StepRef<string>)[]): StepRef<string>;
|
|
41
68
|
}
|
|
42
69
|
export interface StepFunction {
|
|
43
70
|
<const O extends string = never>(...args: (StepConfig<O> | Step<string> | StepRef<string>)[]): Step<O>;
|
|
44
71
|
if(condition: ConditionLike): StepBuilder;
|
|
45
72
|
dependsOn(...deps: StepLike[]): StepBuilder;
|
|
46
73
|
comesAfter(...deps: StepLike[]): StepBuilder;
|
|
74
|
+
/**
|
|
75
|
+
* Groups steps into a parallel block. The steps run concurrently and
|
|
76
|
+
* serialize to a GitHub Actions `parallel:` block. Shared dependencies
|
|
77
|
+
* (pulled in via `dependsOn`) are hoisted to run before the block.
|
|
78
|
+
*/
|
|
79
|
+
parallel(...args: (StepConfig | Step<string> | StepRef<string>)[]): Step<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Creates a `wait` step that blocks until the given background step(s)
|
|
82
|
+
* finish. The referenced steps are ordered before this one and must each be
|
|
83
|
+
* a background step with an explicit `id`.
|
|
84
|
+
*/
|
|
85
|
+
waitFor(...steps: (Step<string> | StepRef<string>)[]): StepRef<string>;
|
|
86
|
+
/** Creates a `wait-all` step that blocks until all background steps finish. */
|
|
87
|
+
waitForAll(): Step<string>;
|
|
88
|
+
/**
|
|
89
|
+
* Creates a `cancel` step that terminates the given background step. The
|
|
90
|
+
* referenced step is ordered before this one and must be a background step
|
|
91
|
+
* with an explicit `id`.
|
|
92
|
+
*/
|
|
93
|
+
cancel(target: Step<string> | StepRef<string>): StepRef<string>;
|
|
47
94
|
}
|
|
48
95
|
export declare const step: StepFunction;
|
|
49
96
|
export declare class StepRef<O extends string = never> {
|
package/esm/step.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../src/step.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,eAAe,EAIhB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,eAAe,GAAG,MAAM,CAAC;AACjE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,eAAe,CAAC;AAEtE,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK;IAClD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IACtD,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,eAAe,CAA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