@@ -34346,6 +34346,7 @@ const child_process_1 = __nccwpck_require__(2081);
34346
34346
const fs = __importStar(__nccwpck_require__(5630));
34347
34347
const githubHelper_1 = __nccwpck_require__(2179);
34348
34348
const k6OutputParser_1 = __nccwpck_require__(5035);
34349
+ const k6helper_1 = __nccwpck_require__(1034);
34349
34350
const TEST_PIDS = [];
34350
34351
run();
34351
34352
/**
@@ -34359,8 +34360,28 @@ async function run() {
34359
34360
const failFast = core.getInput('fail-fast', { required: false }) === 'true';
34360
34361
const flags = core.getInput('flags', { required: false });
34361
34362
const cloudRunLocally = core.getInput('cloud-run-locally', { required: false }) === 'true';
34363
+ const onlyVerifyScripts = core.getInput('only-verify-scripts', { required: false }) === 'true';
34362
34364
const shouldCommentCloudTestRunUrlOnPR = core.getInput('cloud-comment-on-pr', { required: false }) === 'true';
34363
34365
const allPromises = [];
34366
+ core.debug(`🔍 Found following ${testPaths.length} test run files:`);
34367
+ testPaths.forEach((testPath, index) => {
34368
+ core.debug(`${index + 1}. ${testPath}`);
34369
+ });
34370
+ if (testPaths.length === 0) {
34371
+ throw new Error('No test files found');
34372
+ }
34373
+ const verifiedTestPaths = await (0, k6helper_1.validateTestPaths)(testPaths);
34374
+ if (verifiedTestPaths.length === 0) {
34375
+ throw new Error('No valid test files found');
34376
+ }
34377
+ console.log(`🧪 Found ${verifiedTestPaths.length} valid K6 tests out of total ${testPaths.length} test files.`);
34378
+ verifiedTestPaths.forEach((testPath, index) => {
34379
+ console.log(` ${index + 1}. ${testPath}`);
34380
+ });
34381
+ if (onlyVerifyScripts) {
34382
+ console.log('🔍 Only verifying scripts. Skipping test execution');
34383
+ return;
34384
+ }
34364
34385
const isCloud = await isCloudIntegrationEnabled();
34365
34386
const commands = testPaths.map(testPath => generateCommand(testPath)), TOTAL_TEST_RUNS = commands.length, TEST_RESULT_URLS_MAP = new Proxy({}, {
34366
34387
set: (target, key, value) => {
@@ -34375,9 +34396,6 @@ async function run() {
34375
34396
}
34376
34397
});
34377
34398
;
34378
- if (commands.length === 0) {
34379
- throw new Error('No test files found');
34380
- }
34381
34399
let allTestsPassed = true;
34382
34400
if (parallel) {
34383
34401
const childProcesses = [];
@@ -34665,6 +34683,45 @@ function parseK6Output(data, testRunUrlsMap, totalTestRuns) {
34665
34683
exports.parseK6Output = parseK6Output;
34666
34684
34667
34685
34686
+ /***/ }),
34687
+
34688
+ /***/ 1034:
34689
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
34690
+
34691
+ "use strict";
34692
+
34693
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
34694
+ exports.validateTestPaths = void 0;
34695
+ // Common helper functions used in the action
34696
+ const child_process_1 = __nccwpck_require__(2081);
34697
+ async function validateTestPaths(testPaths) {
34698
+ if (testPaths.length === 0) {
34699
+ throw new Error('No test files found');
34700
+ }
34701
+ console.log(`🔍 Validating test run files.`);
34702
+ const validK6TestPaths = [], command = "k6", defaultArgs = ["inspect", "--execution-requirements"];
34703
+ const allPromises = [];
34704
+ testPaths.forEach(async (testPath) => {
34705
+ const args = [...defaultArgs, testPath];
34706
+ const child = (0, child_process_1.spawn)(command, args, {
34707
+ stdio: ['inherit', 'ignore', 'inherit'], // 'ignore' is for stdout
34708
+ detached: false,
34709
+ });
34710
+ allPromises.push(new Promise(resolve => {
34711
+ child.on('exit', (code, signal) => {
34712
+ if (code === 0) {
34713
+ validK6TestPaths.push(testPath);
34714
+ }
34715
+ resolve();
34716
+ });
34717
+ }));
34718
+ });
34719
+ await Promise.all(allPromises);
34720
+ return validK6TestPaths;
34721
+ }
34722
+ exports.validateTestPaths = validateTestPaths;
34723
+
34724
+
34668
34725
/***/ }),
34669
34726
34670
34727
/***/ 9491:
0 commit comments