@argos-ci/core 5.1.3 → 5.2.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/dist/index.d.mts +15 -2
- package/dist/index.mjs +43 -17
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -118,9 +118,9 @@ interface Config {
|
|
|
118
118
|
*/
|
|
119
119
|
skipped?: boolean;
|
|
120
120
|
/**
|
|
121
|
-
*
|
|
121
|
+
* Pull request numbers aggregated by the merge queue build.
|
|
122
122
|
*/
|
|
123
|
-
|
|
123
|
+
mergeQueuePrNumbers?: number[] | null;
|
|
124
124
|
/**
|
|
125
125
|
* Whether this build contains only a subset of screenshots.
|
|
126
126
|
* This is useful when a build is created from an incomplete test suite where some tests are skipped.
|
|
@@ -152,6 +152,14 @@ declare function finalize(params: FinalizeParameters): Promise<{
|
|
|
152
152
|
builds: {
|
|
153
153
|
id: string;
|
|
154
154
|
number: number;
|
|
155
|
+
head: {
|
|
156
|
+
sha: string;
|
|
157
|
+
branch: string;
|
|
158
|
+
};
|
|
159
|
+
base: {
|
|
160
|
+
sha: string;
|
|
161
|
+
branch: string;
|
|
162
|
+
} | null;
|
|
155
163
|
status: ("accepted" | "rejected") | ("no-changes" | "changes-detected") | ("expired" | "pending" | "progress" | "error" | "aborted");
|
|
156
164
|
conclusion: ("no-changes" | "changes-detected") | null;
|
|
157
165
|
stats: {
|
|
@@ -278,6 +286,11 @@ interface UploadParameters {
|
|
|
278
286
|
* @default false
|
|
279
287
|
*/
|
|
280
288
|
subset?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Pull request numbers aggregated by the merge queue build.
|
|
291
|
+
* Providing this enables merge queue mode for the build.
|
|
292
|
+
*/
|
|
293
|
+
mergeQueuePrNumbers?: number[];
|
|
281
294
|
}
|
|
282
295
|
interface Screenshot {
|
|
283
296
|
hash: string;
|
package/dist/index.mjs
CHANGED
|
@@ -167,8 +167,7 @@ const service$7 = {
|
|
|
167
167
|
prNumber: getPrNumber$2({ env }),
|
|
168
168
|
prHeadCommit: null,
|
|
169
169
|
prBaseBranch: null,
|
|
170
|
-
nonce: env.BITRISEIO_PIPELINE_ID || null
|
|
171
|
-
mergeQueue: false
|
|
170
|
+
nonce: env.BITRISEIO_PIPELINE_ID || null
|
|
172
171
|
};
|
|
173
172
|
},
|
|
174
173
|
getMergeBaseCommitSha: getMergeBaseCommitSha$1,
|
|
@@ -212,8 +211,7 @@ const service$6 = {
|
|
|
212
211
|
prNumber: env.BUILDKITE_PULL_REQUEST ? Number(env.BUILDKITE_PULL_REQUEST) : null,
|
|
213
212
|
prHeadCommit: null,
|
|
214
213
|
prBaseBranch: null,
|
|
215
|
-
nonce: env.BUILDKITE_BUILD_ID || null
|
|
216
|
-
mergeQueue: false
|
|
214
|
+
nonce: env.BUILDKITE_BUILD_ID || null
|
|
217
215
|
};
|
|
218
216
|
},
|
|
219
217
|
getMergeBaseCommitSha: getMergeBaseCommitSha$1,
|
|
@@ -237,8 +235,7 @@ const service$5 = {
|
|
|
237
235
|
prNumber: null,
|
|
238
236
|
prHeadCommit: null,
|
|
239
237
|
prBaseBranch: null,
|
|
240
|
-
nonce: env.HEROKU_TEST_RUN_ID || null
|
|
241
|
-
mergeQueue: false
|
|
238
|
+
nonce: env.HEROKU_TEST_RUN_ID || null
|
|
242
239
|
}),
|
|
243
240
|
getMergeBaseCommitSha: getMergeBaseCommitSha$1,
|
|
244
241
|
listParentCommits: listParentCommits$1
|
|
@@ -377,6 +374,15 @@ function getMergeGroupPayload(payload) {
|
|
|
377
374
|
if (payload && process.env.GITHUB_EVENT_NAME === "merge_group" && "action" in payload && payload.action === "checks_requested") return payload;
|
|
378
375
|
return null;
|
|
379
376
|
}
|
|
377
|
+
function getMergeQueuePrNumbers(args) {
|
|
378
|
+
const { mergeGroupPayload, pullRequest } = args;
|
|
379
|
+
if (!mergeGroupPayload) return null;
|
|
380
|
+
if (pullRequest) return [pullRequest.number];
|
|
381
|
+
const headRef = mergeGroupPayload.merge_group.head_ref;
|
|
382
|
+
const prNumberFromBranch = getPRNumberFromMergeGroupBranch(headRef);
|
|
383
|
+
if (prNumberFromBranch != null) return [prNumberFromBranch];
|
|
384
|
+
return [];
|
|
385
|
+
}
|
|
380
386
|
/**
|
|
381
387
|
* Get the branch from the local context.
|
|
382
388
|
*/
|
|
@@ -496,7 +502,10 @@ const service$4 = {
|
|
|
496
502
|
prNumber: pullRequest?.number || null,
|
|
497
503
|
prHeadCommit: pullRequest?.head.sha ?? null,
|
|
498
504
|
prBaseBranch: pullRequest?.base.ref ?? null,
|
|
499
|
-
|
|
505
|
+
mergeQueuePrNumbers: getMergeQueuePrNumbers({
|
|
506
|
+
mergeGroupPayload,
|
|
507
|
+
pullRequest
|
|
508
|
+
})
|
|
500
509
|
};
|
|
501
510
|
},
|
|
502
511
|
getMergeBaseCommitSha: getMergeBaseCommitSha$1,
|
|
@@ -537,8 +546,7 @@ const service$3 = {
|
|
|
537
546
|
prNumber: getPrNumber$1({ env }),
|
|
538
547
|
prHeadCommit: null,
|
|
539
548
|
prBaseBranch: null,
|
|
540
|
-
nonce: env.CIRCLE_WORKFLOW_ID || env.CIRCLE_BUILD_NUM || null
|
|
541
|
-
mergeQueue: false
|
|
549
|
+
nonce: env.CIRCLE_WORKFLOW_ID || env.CIRCLE_BUILD_NUM || null
|
|
542
550
|
};
|
|
543
551
|
},
|
|
544
552
|
getMergeBaseCommitSha: getMergeBaseCommitSha$1,
|
|
@@ -577,8 +585,7 @@ const service$2 = {
|
|
|
577
585
|
prNumber: getPrNumber(ctx),
|
|
578
586
|
prHeadCommit: null,
|
|
579
587
|
prBaseBranch: null,
|
|
580
|
-
nonce: env.TRAVIS_BUILD_ID || null
|
|
581
|
-
mergeQueue: false
|
|
588
|
+
nonce: env.TRAVIS_BUILD_ID || null
|
|
582
589
|
};
|
|
583
590
|
},
|
|
584
591
|
getMergeBaseCommitSha: getMergeBaseCommitSha$1,
|
|
@@ -612,8 +619,7 @@ const service$1 = {
|
|
|
612
619
|
prNumber: null,
|
|
613
620
|
prHeadCommit: null,
|
|
614
621
|
prBaseBranch: null,
|
|
615
|
-
nonce: env.CI_PIPELINE_ID || null
|
|
616
|
-
mergeQueue: false
|
|
622
|
+
nonce: env.CI_PIPELINE_ID || null
|
|
617
623
|
};
|
|
618
624
|
},
|
|
619
625
|
getMergeBaseCommitSha: getMergeBaseCommitSha$1,
|
|
@@ -653,8 +659,7 @@ const services = [
|
|
|
653
659
|
prNumber: null,
|
|
654
660
|
prHeadCommit: null,
|
|
655
661
|
prBaseBranch: null,
|
|
656
|
-
nonce: null
|
|
657
|
-
mergeQueue: false
|
|
662
|
+
nonce: null
|
|
658
663
|
};
|
|
659
664
|
},
|
|
660
665
|
getMergeBaseCommitSha: getMergeBaseCommitSha$1,
|
|
@@ -736,6 +741,11 @@ const toInt = (value) => {
|
|
|
736
741
|
return num;
|
|
737
742
|
};
|
|
738
743
|
const toFloat = (value) => parseFloat(value);
|
|
744
|
+
const toIntArray = (value) => {
|
|
745
|
+
if (Array.isArray(value)) return value;
|
|
746
|
+
if (value === "") return null;
|
|
747
|
+
return value.split(",").map(toInt);
|
|
748
|
+
};
|
|
739
749
|
convict.addFormat({
|
|
740
750
|
name: "parallel-total",
|
|
741
751
|
validate: minInteger(-1),
|
|
@@ -753,6 +763,15 @@ convict.addFormat({
|
|
|
753
763
|
},
|
|
754
764
|
coerce: toFloat
|
|
755
765
|
});
|
|
766
|
+
convict.addFormat({
|
|
767
|
+
name: "int-array",
|
|
768
|
+
validate: (value) => {
|
|
769
|
+
if (value === null) return;
|
|
770
|
+
if (!Array.isArray(value)) throw new Error("must be an array");
|
|
771
|
+
for (const item of value) if (!Number.isInteger(item)) throw new Error("must be an array of integers");
|
|
772
|
+
},
|
|
773
|
+
coerce: toIntArray
|
|
774
|
+
});
|
|
756
775
|
const schema = {
|
|
757
776
|
apiBaseUrl: {
|
|
758
777
|
env: "ARGOS_API_BASE_URL",
|
|
@@ -886,6 +905,12 @@ const schema = {
|
|
|
886
905
|
format: Boolean,
|
|
887
906
|
default: false
|
|
888
907
|
},
|
|
908
|
+
mergeQueuePrNumbers: {
|
|
909
|
+
env: "ARGOS_MERGE_QUEUE_PRS",
|
|
910
|
+
format: "int-array",
|
|
911
|
+
default: null,
|
|
912
|
+
nullable: true
|
|
913
|
+
},
|
|
889
914
|
mergeQueue: {
|
|
890
915
|
format: Boolean,
|
|
891
916
|
default: false
|
|
@@ -937,7 +962,7 @@ async function readConfig(options = {}) {
|
|
|
937
962
|
previewBaseUrl: defaultConfig.previewBaseUrl || null,
|
|
938
963
|
skipped: options.skipped ?? defaultConfig.skipped ?? false,
|
|
939
964
|
subset: options.subset ?? defaultConfig.subset ?? false,
|
|
940
|
-
|
|
965
|
+
mergeQueuePrNumbers: options.mergeQueuePrNumbers ?? defaultConfig.mergeQueuePrNumbers ?? ciEnv?.mergeQueuePrNumbers ?? null
|
|
941
966
|
});
|
|
942
967
|
if (!config.get("branch") || !config.get("commit")) throw new Error("Argos requires a branch and a commit to be set. If you are running in a non-git environment consider setting ARGOS_BRANCH and ARGOS_COMMIT environment variables.");
|
|
943
968
|
config.validate();
|
|
@@ -1282,7 +1307,8 @@ async function upload(params) {
|
|
|
1282
1307
|
ciProvider: config.ciProvider,
|
|
1283
1308
|
runId: config.runId,
|
|
1284
1309
|
runAttempt: config.runAttempt,
|
|
1285
|
-
mergeQueue: config.
|
|
1310
|
+
mergeQueue: Boolean(config.mergeQueuePrNumbers),
|
|
1311
|
+
mergeQueuePrNumbers: config.mergeQueuePrNumbers,
|
|
1286
1312
|
subset: config.subset
|
|
1287
1313
|
} });
|
|
1288
1314
|
if (createBuildResponse.error) throwAPIError(createBuildResponse.error);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/core",
|
|
3
3
|
"description": "Node.js SDK for visual testing with Argos.",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@argos-ci/api-client": "0.
|
|
42
|
+
"@argos-ci/api-client": "0.17.0",
|
|
43
43
|
"@argos-ci/util": "3.4.0",
|
|
44
44
|
"convict": "^6.2.5",
|
|
45
45
|
"debug": "^4.4.3",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"lint": "eslint .",
|
|
68
68
|
"test": "vitest"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "82add1422f689642095d43a9e3bb0d2a008728af"
|
|
71
71
|
}
|