Skip to content

Commit 1cca109

Browse files
author
ci-bot
committed
test again
1 parent 000c847 commit 1cca109

File tree

3 files changed

+148
-25
lines changed

3 files changed

+148
-25
lines changed

.circleci/config.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ parameters:
1414
default: ""
1515
run_file_tests_keyword:
1616
type: enum
17-
enum: ["", "blockchain", "bottom-bar", "circom", "code_format", "compile_run_widget", "compiler_api", "contract_flattener", "contract_verification", "debugger", "defaultLayout", "deploy_vefiry", "dgit_github", "dgit_local", "editor", "editorHoverContext", "editorReferences", "editor_error_marker", "editor_line_text", "eip1153", "eip7702", "environment-account", "erc721", "etherscan_api", "expandAllFolders", "fileExplorer", "fileManager_api", "file_decorator", "file_explorer_context_menu", "file_explorer_dragdrop", "file_explorer_multiselect", "generalSettings", "gist", "homeTab", "importFromGithub", "layout", "learneth", "libraryDeployment", "matomo-bot-detection", "matomo-consent", "metamask", "migrateFileSystem", "noir", "pinned_contracts", "pinned_plugin", "pluginManager", "plugin_api", "providers", "proxy_oz_v4", "proxy_oz_v5", "proxy_oz_v5_non_shanghai_runtime", "publishContract", "quickDapp_metamask", "recorder", "remixd", "runAndDeploy", "sauce", "script-runner", "search", "signingMessage", "sol2uml", "solidityImport", "solidityUnittests", "specialFunctions", "staticAnalysis", "stressEditor", "templates", "terminal", "transactionExecution", "txListener", "uniswap_v4_core", "url", "usingWebWorker", "verticalIconsPanel", "vm_state", "vyper_api", "walkthrough", "workspace", "workspace_git"]
17+
enum: ["", "ai_panel", "ballot", "ballot_0_4_14", "blockchain", "bottom-bar", "circom", "code_format", "compile_run_widget", "compiler_api", "contract_flattener", "contract_verification", "debugger", "defaultLayout", "deploy_vefiry", "dgit_github", "dgit_local", "editor", "editorHoverContext", "editorReferences", "editor_error_marker", "editor_line_text", "eip1153", "eip7702", "environment-account", "erc721", "etherscan_api", "expandAllFolders", "fileExplorer", "fileManager_api", "file_decorator", "file_explorer_context_menu", "file_explorer_dragdrop", "file_explorer_multiselect", "generalSettings", "gist", "homeTab", "importFromGithub", "layout", "learneth", "libraryDeployment", "matomo-bot-detection", "matomo-consent", "metamask", "migrateFileSystem", "noir", "pinned_contracts", "pinned_plugin", "pluginManager", "plugin_api", "providers", "proxy_oz_v4", "proxy_oz_v5", "proxy_oz_v5_non_shanghai_runtime", "publishContract", "quickDapp_metamask", "recorder", "remixd", "runAndDeploy", "script-runner", "search", "signingMessage", "sol2uml", "solidityImport", "solidityUnittests", "specialFunctions", "staticAnalysis", "stressEditor", "templates", "terminal", "transactionExecution", "txListener", "uniswap_v4_core", "url", "usingWebWorker", "verticalIconsPanel", "vm_state", "vyper_api", "walkthrough", "workspace", "workspace_git"]
1818
default: ""
1919
run_flaky_tests:
2020
type: boolean
@@ -632,29 +632,29 @@ workflows:
632632
requires:
633633
- build
634634

635-
run_file_keyword:
636-
when: << pipeline.parameters.run_file_tests_keyword >>
637-
jobs:
638-
- check-flaky-or-pr-tests:
639-
pattern: "<< pipeline.parameters.run_file_tests_keyword >>"
640-
- build:
641-
requires:
642-
- check-flaky-or-pr-tests
643-
- remix-ide-browser:
644-
requires:
645-
- build
646-
matrix:
647-
parameters:
648-
browser: ["chrome"]
649-
script: ["singletest.sh"]
650-
job: ["nogroup"]
651-
jobsize: ["1"]
652-
parallelism: [1]
653-
scriptparameter: ["<< pipeline.parameters.run_file_tests_keyword >>"]
654-
skip_timings: [true]
655-
- post-failed-report:
656-
requires:
657-
- build
635+
run_file_keyword:
636+
when: << pipeline.parameters.run_file_tests_keyword >>
637+
jobs:
638+
- check-flaky-or-pr-tests:
639+
pattern: "<< pipeline.parameters.run_file_tests_keyword >>"
640+
- build:
641+
requires:
642+
- check-flaky-or-pr-tests
643+
- remix-ide-browser:
644+
requires:
645+
- build
646+
matrix:
647+
parameters:
648+
browser: ["chrome"]
649+
script: ["singletest.sh"]
650+
job: ["nogroup"]
651+
jobsize: ["1"]
652+
parallelism: [1]
653+
scriptparameter: ["<< pipeline.parameters.run_file_tests_keyword >>"]
654+
skip_timings: [true]
655+
- post-failed-report:
656+
requires:
657+
- build
658658

659659
run_pr_tests:
660660
when: << pipeline.parameters.run_pr_tests >>

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@
9090
"ci:timings": "node scripts/circleci-timings.js",
9191
"ci:plan-shard": "node scripts/plan-shards.js",
9292
"ci:failed-report": "node scripts/generate-failed-report.js --workflow web --out reports/ci-latest-failed",
93-
"ci:post-pr-report": "node scripts/post-pr-report.js reports/ci-latest-failed"
93+
"ci:post-pr-report": "node scripts/post-pr-report.js reports/ci-latest-failed",
94+
"update:e2e-keywords": "node scripts/update-e2e-keywords.js"
9495
},
9596
"dependencies": {
9697
"@octokit/auth-app": "^7.1.3",

scripts/update-e2e-keywords.js

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#!/usr/bin/env node
2+
/**
3+
* Update the enum list for parameters.run_file_tests_keyword in .circleci/config.yml
4+
* based on the "main keywords" inferred from e2e test filenames.
5+
*
6+
* Heuristics:
7+
* - Scan apps/remix-ide-e2e/src/tests for test files:
8+
* - *.test.ts, *.test.js, *.spec.ts, *.spec.js
9+
* - Explicitly include plugin_api*.ts (plugin API tests that are not marked as *.test.*)
10+
* - For each basename (without extension):
11+
* - Strip trailing .flaky or .pr markers
12+
* - Strip trailing _group<digits>
13+
* - Resulting name is considered a keyword candidate
14+
* - Deduplicate and sort keywords (case-sensitive, ASCII sort)
15+
* - Prepend an empty string "" as first enum item (to keep current behavior)
16+
* - Replace only the enum: [ ... ] line within the run_file_tests_keyword parameter block
17+
*/
18+
19+
const fs = require('fs');
20+
const path = require('path');
21+
22+
const REPO_ROOT = path.resolve(__dirname, '..');
23+
const TESTS_DIR = path.join(REPO_ROOT, 'apps', 'remix-ide-e2e', 'src', 'tests');
24+
const CIRCLE_CONFIG = path.join(REPO_ROOT, '.circleci', 'config.yml');
25+
26+
/** Read directory and return keyword set */
27+
function collectKeywords() {
28+
const entries = fs.readdirSync(TESTS_DIR, { withFileTypes: true });
29+
const keywords = new Set();
30+
31+
for (const ent of entries) {
32+
if (!ent.isFile()) continue;
33+
const full = path.join(TESTS_DIR, ent.name);
34+
const ext = path.extname(ent.name); // .ts or .js
35+
const base = path.basename(ent.name, ext);
36+
37+
// Only include test files, except allowlist plugin_api*.ts
38+
const isTest = /\.(test|spec)$/i.test(base);
39+
const isPluginApi = /^plugin_api([_-].*)?$/i.test(base);
40+
if (!isTest && !isPluginApi) continue;
41+
42+
let name = base;
43+
// Strip known markers that appear before extension
44+
name = name.replace(/\.(flaky|pr)$/i, '');
45+
// Strip trailing .test or .spec
46+
name = name.replace(/\.(test|spec)$/i, '');
47+
// Strip trailing _group<digits>
48+
name = name.replace(/_group\d+$/i, '');
49+
// If the name still contains a trailing dot fragment (after prior replace), clean again
50+
name = name.replace(/\.$/, '');
51+
52+
// Special case: some sources may embed additional dot markers before extension (handled above)
53+
// Keep hyphens and underscores as-is; they are meaningful in current enum.
54+
55+
if (name) keywords.add(name);
56+
}
57+
58+
// Build sorted array; keep natural ASCII sort
59+
const list = Array.from(keywords);
60+
list.sort();
61+
// Prepend empty string, as the enum currently allows ""
62+
return ["", ...list];
63+
}
64+
65+
/** Update only the enum line inside run_file_tests_keyword parameter block */
66+
function updateConfigYaml(newEnumArray) {
67+
const yaml = fs.readFileSync(CIRCLE_CONFIG, 'utf8');
68+
const lines = yaml.split(/\r?\n/);
69+
70+
// Locate the run_file_tests_keyword block
71+
let i = 0;
72+
let startIdx = -1;
73+
for (; i < lines.length; i++) {
74+
if (/^\s*run_file_tests_keyword:\s*$/.test(lines[i])) {
75+
startIdx = i;
76+
break;
77+
}
78+
}
79+
if (startIdx === -1) {
80+
throw new Error('Could not find parameters.run_file_tests_keyword block in .circleci/config.yml');
81+
}
82+
83+
// Within the next ~20 lines, find the enum line to replace
84+
let enumIdx = -1;
85+
for (let j = startIdx; j < Math.min(lines.length, startIdx + 50); j++) {
86+
// Stop if we reach the next top-level parameter key at the same indentation level
87+
if (j > startIdx && /^\s*[A-Za-z0-9_-]+:\s*$/.test(lines[j]) && /^\s{2}/.test(lines[j]) && !/^\s{4}/.test(lines[j])) {
88+
// Likely stepped out of the run_file_tests_keyword sub-block
89+
break;
90+
}
91+
if (/^\s*enum:\s*\[.*\]\s*$/.test(lines[j])) {
92+
enumIdx = j;
93+
break;
94+
}
95+
}
96+
if (enumIdx === -1) {
97+
throw new Error('Found run_file_tests_keyword but could not locate its enum: [ ... ] line');
98+
}
99+
100+
// Preserve indentation from current enum line
101+
const indentMatch = lines[enumIdx].match(/^(\s*)enum:\s*\[/);
102+
const indent = indentMatch ? indentMatch[1] : '';
103+
const serialized = `${indent}enum: [${newEnumArray.map(k => JSON.stringify(k)).join(', ')}]`;
104+
lines[enumIdx] = serialized;
105+
106+
fs.writeFileSync(CIRCLE_CONFIG, lines.join('\n'));
107+
}
108+
109+
function main() {
110+
const keywords = collectKeywords();
111+
updateConfigYaml(keywords);
112+
console.log(`Updated run_file_tests_keyword enum with ${keywords.length - 1} keyword(s)`);
113+
}
114+
115+
if (require.main === module) {
116+
try {
117+
main();
118+
} catch (err) {
119+
console.error(err && err.message ? err.message : err);
120+
process.exit(1);
121+
}
122+
}

0 commit comments

Comments
 (0)