From a2f09719a3820089fb337da161a313b627dc1932 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Thu, 4 Apr 2024 16:27:34 -0400 Subject: [PATCH 1/2] Rename ZE repo and update coverage config Signed-off-by: Timothy Johnson --- coverage-config.yaml | 59 +++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 37 deletions(-) diff --git a/coverage-config.yaml b/coverage-config.yaml index dcf2268..b85a8e5 100644 --- a/coverage-config.yaml +++ b/coverage-config.yaml @@ -1,65 +1,50 @@ projects: - "zowe/perf-timing": - unit: - junit-artifact: perf-timing.yml/ubuntu-latest-18.x-results/unit/junit - lcov-artifact: perf-timing.yml/ubuntu-latest-18.x-results/unit/coverage - "zowe/imperative": - unit: - junit-artifact: imperative.yml/ubuntu-latest-18.x-results/unit/junit - lcov-artifact: imperative.yml/ubuntu-latest-18.x-results/unit/coverage - integration: - junit-artifact: imperative.yml/ubuntu-latest-18.x-results/integration/junit - system: - test-count: npm-jest "zowe/zowe-cli": unit: - junit-artifact: zowe-cli.yml/ubuntu-latest-18.x-results/unit - lcov-artifact: zowe-cli.yml/ubuntu-latest-18.x-results/unit/coverage + junit-artifact: zowe-cli.yml/ubuntu-latest-20.x-results/unit + lcov-artifact: zowe-cli.yml/ubuntu-latest-20.x-results/unit/coverage integration: - junit-artifact: zowe-cli.yml/ubuntu-latest-18.x-results/integration + junit-artifact: zowe-cli.yml/ubuntu-latest-20.x-results/integration system: test-count: npm-jest - "zowe/zowe-cli-cics-plugin": - unit: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit - lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit/coverage + "zowe/cics-for-zowe-client#main": + unit-cli: + junit-artifact: main.yml/ubuntu-latest-20.x-results/cli/__tests__/__results__/unit + lcov-artifact: main.yml/ubuntu-latest-20.x-results/cli/__tests__/__results__/unit/coverage + unit-sdk: + junit-artifact: main.yml/ubuntu-latest-20.x-results/sdk/__tests__/__results__/unit + lcov-artifact: main.yml/ubuntu-latest-20.x-results/sdk/__tests__/__results__/unit/coverage + unit-vsce: + junit-artifact: main.yml/ubuntu-latest-20.x-results/vsce/__tests__/__results__/unit system: test-count: npm-jest "zowe/zowe-cli-db2-plugin": unit: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit - lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit/coverage + junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit + lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit/coverage system: test-count: npm-jest "zowe/zowe-cli-ftp-plugin": unit: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit - lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit/coverage - system: - test-count: npm-jest - "zowe/zowe-cli-ims-plugin": - unit: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit - lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit/coverage - integration: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/integration + junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit + lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit/coverage system: test-count: npm-jest "zowe/zowe-cli-mq-plugin": unit: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit - lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit/coverage + junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit + lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit/coverage integration: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/integration + junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/integration system: test-count: npm-jest "zowe/zowe-cli-scs-plugin": unit: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit - lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit/coverage + junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit + lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit/coverage system: test-count: npm-jest - "zowe/vscode-extension-for-zowe#main": + "zowe/zowe-explorer-vscode#main": unit: junit-artifact: zowe-explorer-ci.yml/zowe-explorer-results/unit lcov-artifact: zowe-explorer-ci.yml/zowe-explorer-results/unit/coverage From 7bd36a7c314983df780255cba67a0bd95f79664a Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Thu, 4 Apr 2024 16:50:01 -0400 Subject: [PATCH 2/2] Fix coverage report for cics repo Signed-off-by: Timothy Johnson --- coverage-config.yaml | 2 +- scripts/coverage-report.js | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/coverage-config.yaml b/coverage-config.yaml index b85a8e5..13e2090 100644 --- a/coverage-config.yaml +++ b/coverage-config.yaml @@ -17,7 +17,7 @@ projects: unit-vsce: junit-artifact: main.yml/ubuntu-latest-20.x-results/vsce/__tests__/__results__/unit system: - test-count: npm-jest + test-count: npm-jest:packages/cli:packages/sdk "zowe/zowe-cli-db2-plugin": unit: junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit diff --git a/scripts/coverage-report.js b/scripts/coverage-report.js index 1487e72..7a6e614 100644 --- a/scripts/coverage-report.js +++ b/scripts/coverage-report.js @@ -103,14 +103,17 @@ async function checkLcovArtifact(repo, type, workflow, artifact, dirname) { return { lineCoverage, hitLines, foundLines, branchCoverage, hitBranches, foundBranches }; }; -async function checkTestCount(repo, type, tools) { +async function checkTestCount(repo, type, tools, ...subDirs) { const tempDir = await gitCloneDir(repo); await exec.exec("npm", ["install", "--ignore-scripts", "--silent"], { cwd: tempDir }); - const output = await exec.getExecOutput("npm", ["run", `test:${type}`, "--", "--listTests"], { cwd: tempDir }); let numTests = 0; - for (const testFile of output.stdout.trim().split("\n").filter(line => line.includes(tempDir))) { - const testContents = stripComments(fs.readFileSync(testFile, "utf-8")); - numTests += (testContents.match(/\bit\(/g) || []).length; + for (const subDir of (subDirs.length ? subDirs : [""])) { + const output = await exec.getExecOutput("npm", ["run", `test:${type}`, "--", "--listTests"], + { cwd: path.join(tempDir, subDir) }); + for (const testFile of output.stdout.trim().split("\n").filter(line => line.includes(tempDir))) { + const testContents = stripComments(fs.readFileSync(testFile, "utf-8")); + numTests += (testContents.match(/\bit\(/g) || []).length; + } } return { numTests }; }; @@ -132,7 +135,7 @@ async function checkTestCount(repo, type, tools) { covData = { ...covData, ...await checkLcovArtifact(repoName, testType, ...splitAndAppend(covConfig, "/", 3)) }; break; case "test-count": - covData = { ...covData, ...await checkTestCount(repoName, testType, covConfig) }; + covData = { ...covData, ...await checkTestCount(repoName, testType, ...covConfig.split(":")) }; break; default: throw new Error("Unsupported coverage type " + covType);