From a0d359f09e42631971272c773a56a5234a38d59a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Weslley=20Ara=C3=BAjo?= <46850407+wellwelwel@users.noreply.github.com> Date: Wed, 20 Aug 2025 08:21:13 -0300 Subject: [PATCH 1/2] ci: adjust tests (#2185) * ci: adjust tests Signed-off-by: wellwelwel <46850407+wellwelwel@users.noreply.github.com> * ci: respect CPU limits Signed-off-by: wellwelwel <46850407+wellwelwel@users.noreply.github.com> * ci: skip envcontext tests Signed-off-by: wellwelwel <46850407+wellwelwel@users.noreply.github.com> * debug: check NEXUS_URL Signed-off-by: wellwelwel <46850407+wellwelwel@users.noreply.github.com> --------- Signed-off-by: wellwelwel <46850407+wellwelwel@users.noreply.github.com> --- .github/workflows/repotests.yml | 2 +- .pokurc.jsonc | 18 +----------------- lib/helpers/envcontext.poku.js | 29 +++++++++++++++++++---------- lib/managers/docker.poku.js | 28 +++++++++++++++------------- package.json | 2 +- 5 files changed, 37 insertions(+), 42 deletions(-) diff --git a/.github/workflows/repotests.yml b/.github/workflows/repotests.yml index 06c47d4cae..55297a24d1 100644 --- a/.github/workflows/repotests.yml +++ b/.github/workflows/repotests.yml @@ -18,7 +18,7 @@ concurrency: cancel-in-progress: true env: - NEXUS_URL: http://pkg.cdxgen.net:8081/repository/npm/ + NEXUS_URL: http://100.73.146.80:8081/repository/npm/ NODE_VERSION: 24.6.0 # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token diff --git a/.pokurc.jsonc b/.pokurc.jsonc index 1eaa5f47e4..f5d08a25e6 100644 --- a/.pokurc.jsonc +++ b/.pokurc.jsonc @@ -1,22 +1,6 @@ { "$schema": "https://poku.io/schemas/configs.json", - "include": [ - "lib/helpers/dotnetutils.poku.js", - "lib/helpers/protobom.poku.js", - "lib/helpers/utils.poku.js", - "lib/helpers/display.poku.js", - "lib/stages/postgen/postgen.poku.js", - "lib/evinser/evinser.poku.js", - "lib/evinser/swiftsem.poku.js", - "lib/server/server.poku.js", - "lib/parsers/iri.poku.js" - ], - "sequential": false, - "debug": false, + "include": ["lib"], "filter": ".poku.js", - "failFast": false, - "concurrency": 0, - "quiet": false, - "platform": "node", "reporter": "verbose" } diff --git a/lib/helpers/envcontext.poku.js b/lib/helpers/envcontext.poku.js index 529cd43ad0..643d23b08c 100644 --- a/lib/helpers/envcontext.poku.js +++ b/lib/helpers/envcontext.poku.js @@ -1,8 +1,9 @@ import { spawnSync } from "node:child_process"; import process from "node:process"; -import { assert, it } from "poku"; +import { assert, it, skip } from "poku"; +import { isWin } from "../managers/docker.js"; import { collectDotnetInfo, collectGccInfo, @@ -22,6 +23,10 @@ import { listFiles, } from "./envcontext.js"; +skip("Skipping envcontext tests due to old logic"); + +const isDarwin = process.platform === "darwin"; + it("git tests", () => { assert.ok(getBranch()); assert.ok(getOriginUrl()); @@ -30,14 +35,18 @@ it("git tests", () => { }); it("tools tests", () => { - assert.ok(collectJavaInfo()); assert.ok(collectDotnetInfo()); assert.ok(collectPythonInfo()); assert.ok(collectNodeInfo()); assert.ok(collectGccInfo()); assert.ok(collectRustInfo()); - assert.ok(collectGoInfo()); - assert.ok(collectSwiftInfo()); + if (!isWin) { + assert.ok(collectSwiftInfo()); + assert.ok(collectJavaInfo()); + } + if (!isDarwin) { + assert.ok(collectGoInfo()); + } }); it("sdkman tests", () => { @@ -62,16 +71,16 @@ it("nvm tests", () => { // expected to be run in CircleCi, where node version is 22.8.0 // as defined in our Dockerfile - assert.deepStrictEqual(getNvmToolDirectory(22), true); - assert.deepStrictEqual(getNvmToolDirectory(14)).toBeFalsy(); + assert.ok(typeof getNvmToolDirectory(22) === "string"); + assert.deepStrictEqual(getNvmToolDirectory(14), false); // now we install nvm tool for a specific verison - assert.deepStrictEqual(getOrInstallNvmTool(14), true); - assert.deepStrictEqual(getNvmToolDirectory(14), true); + assert.ok(getOrInstallNvmTool(14)); + assert.ok(typeof getNvmToolDirectory(14) === "string"); } else { // if this test is failing it would be due to an error in isNvmAvailable() - assert.deepStrictEqual(getNvmToolDirectory(22)).toBeFalsy(); - assert.deepStrictEqual(getOrInstallNvmTool(14)).toBeFalsy(); + assert.deepStrictEqual(getNvmToolDirectory(22), undefined); + assert.deepStrictEqual(getOrInstallNvmTool(14), false); } } }); diff --git a/lib/managers/docker.poku.js b/lib/managers/docker.poku.js index d3497121ab..7c3c14eba4 100644 --- a/lib/managers/docker.poku.js +++ b/lib/managers/docker.poku.js @@ -1,6 +1,6 @@ import process from "node:process"; -import { assert, beforeEach, describe, it } from "poku"; +import { assert, beforeEach, describe, it, skip } from "poku"; import { addSkippedSrcFiles, @@ -12,12 +12,14 @@ import { removeImage, } from "./docker.js"; -it("docker connection", async () => { - if (!(isWin && process.env.CI === "true")) { - const dockerConn = await getConnection(); - if (dockerConn) { - assert.ok(dockerConn); - } +if (process.env.CI === "true" && (isWin || process.platform === "darwin")) { + skip("Skipping Docker tests on Windows and Mac"); +} + +await it("docker connection", async () => { + const dockerConn = await getConnection(); + if (dockerConn) { + assert.ok(dockerConn); } }); @@ -123,9 +125,9 @@ it("parseImageName tests", () => { name: "scan-java", }, ); -}, 120000); +}); -it("docker getImage", async () => { +await it("docker getImage", async () => { if (isWin && process.env.CI === "true") { return; } @@ -136,15 +138,15 @@ it("docker getImage", async () => { assert.ok(removeData); } } -}, 120000); +}); -it("docker getImage", async () => { +await it("docker getImage", async () => { if (isWin && process.env.CI === "true") { return; } const imageData = await exportImage("hello-world:latest"); assert.ok(imageData); -}, 120000); +}); describe("addSkippedSrcFiles tests", () => { let testComponents; @@ -213,4 +215,4 @@ describe("addSkippedSrcFiles tests", () => { assert.deepStrictEqual(testComponents[0].properties.length, 2); }); -}, 120000); +}); diff --git a/package.json b/package.json index f818fbd120..300a8fca94 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "cdx-verify": "bin/verify.js" }, "scripts": { - "test": "poku --parallel", + "test": "poku", "watch": "poku --watch", "lint:check": "biome check", "lint": "biome check --fix", From d7a6d66208954a30af445852e1a1fa4e09dbb603 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 20 Aug 2025 14:23:26 +0200 Subject: [PATCH 2/2] chore(deps): update dependency @biomejs/biome to v2.2.0 (#2178) * chore(deps): update dependency @biomejs/biome to v2.2.0 * Fixed pnpm-lock after renovate update Signed-off-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fixed linting warnings Signed-off-by: Roland Asmann --------- Signed-off-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Roland Asmann Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Roland Asmann --- biome.json | 2 +- lib/cli/index.js | 9 +++-- lib/helpers/utils.js | 28 +++++++++------- lib/managers/docker.js | 9 +++-- lib/server/server.js | 2 +- package.json | 2 +- pnpm-lock.yaml | 74 +++++++++++++++++++++--------------------- 7 files changed, 67 insertions(+), 59 deletions(-) diff --git a/biome.json b/biome.json index dbdb3c4999..2bb7915ebf 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.1.4/schema.json", + "$schema": "https://biomejs.dev/schemas/2.2.0/schema.json", "assist": { "actions": { "source": { diff --git a/lib/cli/index.js b/lib/cli/index.js index 27632d245e..afe3a14cbf 100644 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -2894,7 +2894,8 @@ export async function createNodejsBom(path, options) { `${options.multiProject ? "**/" : ""}package.json`, options, ); - const npmInstallCount = Number.parseInt(process.env.NPM_INSTALL_COUNT) || 2; + const npmInstallCount = + Number.parseInt(process.env.NPM_INSTALL_COUNT, 10) || 2; // Automatic npm install logic. // Only perform npm install for smaller projects (< 2 package.json) without the correct number of lock files if ( @@ -5565,8 +5566,10 @@ export async function createCocoaBom(path, options) { : targetDependencies.keys(), ); if (process.env.COCOA_EXCLUDED_TARGETS) { - process.env.COCOA_EXCLUDED_TARGETS.split(",").forEach((excludedTarget) => - usedTargets.delete(excludedTarget), + process.env.COCOA_EXCLUDED_TARGETS.split(",").forEach( + (excludedTarget) => { + usedTargets.delete(excludedTarget); + }, ); if (!excludeMessageShown) { thoughtLog( diff --git a/lib/helpers/utils.js b/lib/helpers/utils.js index 4a83f711b2..fec4608b04 100644 --- a/lib/helpers/utils.js +++ b/lib/helpers/utils.js @@ -202,11 +202,11 @@ export const DEBUG_MODE = // Timeout milliseconds. Default 20 mins export const TIMEOUT_MS = - Number.parseInt(process.env.CDXGEN_TIMEOUT_MS) || 20 * 60 * 1000; + Number.parseInt(process.env.CDXGEN_TIMEOUT_MS, 10) || 20 * 60 * 1000; // Max buffer for stdout and stderr. Defaults to 100MB export const MAX_BUFFER = - Number.parseInt(process.env.CDXGEN_MAX_BUFFER) || 100 * 1024 * 1024; + Number.parseInt(process.env.CDXGEN_MAX_BUFFER, 10) || 100 * 1024 * 1024; // Metadata cache export let metadata_cache = {}; @@ -12350,10 +12350,14 @@ export function multiChecksumFile(algorithms, path) { const stream = createReadStream(path); stream.on("error", (err) => reject(err)); stream.on("data", (chunk) => - algorithms.forEach((alg) => hashes[alg].update(chunk)), + algorithms.forEach((alg) => { + hashes[alg].update(chunk); + }), ); stream.on("end", () => { - algorithms.forEach((alg) => (hashes[alg] = hashes[alg].digest("hex"))); + algorithms.forEach((alg) => { + hashes[alg] = hashes[alg].digest("hex"); + }); resolve(hashes); }); }); @@ -13193,9 +13197,9 @@ export async function parsePodfileLock(podfileLock, projectPath) { } for (const [dependencyName, dependency] of dependencies) { if (dependency.dependencies) { - dependency.dependencies.forEach( - (dep) => (dep.name = dep.name.split("/")[0]), - ); + dependency.dependencies.forEach((dep) => { + dep.name = dep.name.split("/")[0]; + }); dependency.dependencies = [ ...new Map( dependency.dependencies @@ -13542,13 +13546,15 @@ async function fullScanCocoaPod(dependency, component, options) { if (podspec.authors) { component.authors = []; if (podspec.authors.constructor === Object) { - Object.entries(podspec.authors).forEach(([name, email]) => + Object.entries(podspec.authors).forEach(([name, email]) => { email.includes("@") ? component.authors.push({ name, email }) - : component.authors.push({ name }), - ); + : component.authors.push({ name }); + }); } else if (podspec.authors.constructor === Array) { - podspec.authors.forEach((name) => component.authors.push({ name })); + podspec.authors.forEach((name) => { + component.authors.push({ name }); + }); } else { component.authors.push({ name: podspec.authors }); } diff --git a/lib/managers/docker.js b/lib/managers/docker.js index bcf8f582ff..b76c990f1f 100644 --- a/lib/managers/docker.js +++ b/lib/managers/docker.js @@ -209,13 +209,12 @@ export const getOnlyDirs = (srcpath, dirName) => { getDirectories(srcpath) .map((p) => { try { - if (safeExistsSync(p)) { - if (lstatSync(p).isDirectory()) { - return getOnlyDirs(p, dirName); - } + if (safeExistsSync(p) && lstatSync(p).isDirectory()) { + return getOnlyDirs(p, dirName); } + return []; } catch (_err) { - // ignore + return []; } }) .filter((p) => p !== undefined), diff --git a/lib/server/server.js b/lib/server/server.js index c4478f1825..3725dfb849 100644 --- a/lib/server/server.js +++ b/lib/server/server.js @@ -22,7 +22,7 @@ import { postProcess } from "../stages/postgen/postgen.js"; // Timeout milliseconds. Default 10 mins const TIMEOUT_MS = - Number.parseInt(process.env.CDXGEN_SERVER_TIMEOUT_MS) || 10 * 60 * 1000; + Number.parseInt(process.env.CDXGEN_SERVER_TIMEOUT_MS, 10) || 10 * 60 * 1000; const ALLOWED_PARAMS = [ "type", diff --git a/package.json b/package.json index 300a8fca94..83b6d911ec 100644 --- a/package.json +++ b/package.json @@ -138,7 +138,7 @@ "index.cjs" ], "devDependencies": { - "@biomejs/biome": "2.1.4", + "@biomejs/biome": "2.2.0", "poku": "^3.0.2", "typescript": "^5.9.2" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 71010ceaf9..ff38f75c9d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -139,8 +139,8 @@ importers: version: 2.1.1 devDependencies: '@biomejs/biome': - specifier: 2.1.4 - version: 2.1.4 + specifier: 2.2.0 + version: 2.2.0 poku: specifier: ^3.0.2 version: 3.0.2 @@ -269,59 +269,59 @@ packages: resolution: {integrity: sha512-ruv7Ae4J5dUYULmeXw1gmb7rYRz57OWCPM57pHojnLq/3Z1CK2lNSLTCVjxVk1F/TZHwOZZrOWi0ur95BbLxNQ==} engines: {node: '>=6.9.0'} - '@biomejs/biome@2.1.4': - resolution: {integrity: sha512-QWlrqyxsU0FCebuMnkvBIkxvPqH89afiJzjMl+z67ybutse590jgeaFdDurE9XYtzpjRGTI1tlUZPGWmbKsElA==} + '@biomejs/biome@2.2.0': + resolution: {integrity: sha512-3On3RSYLsX+n9KnoSgfoYlckYBoU6VRM22cw1gB4Y0OuUVSYd/O/2saOJMrA4HFfA1Ff0eacOvMN1yAAvHtzIw==} engines: {node: '>=14.21.3'} hasBin: true - '@biomejs/cli-darwin-arm64@2.1.4': - resolution: {integrity: sha512-sCrNENE74I9MV090Wq/9Dg7EhPudx3+5OiSoQOkIe3DLPzFARuL1dOwCWhKCpA3I5RHmbrsbNSRfZwCabwd8Qg==} + '@biomejs/cli-darwin-arm64@2.2.0': + resolution: {integrity: sha512-zKbwUUh+9uFmWfS8IFxmVD6XwqFcENjZvEyfOxHs1epjdH3wyyMQG80FGDsmauPwS2r5kXdEM0v/+dTIA9FXAg==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [darwin] - '@biomejs/cli-darwin-x64@2.1.4': - resolution: {integrity: sha512-gOEICJbTCy6iruBywBDcG4X5rHMbqCPs3clh3UQ+hRKlgvJTk4NHWQAyHOXvaLe+AxD1/TNX1jbZeffBJzcrOw==} + '@biomejs/cli-darwin-x64@2.2.0': + resolution: {integrity: sha512-+OmT4dsX2eTfhD5crUOPw3RPhaR+SKVspvGVmSdZ9y9O/AgL8pla6T4hOn1q+VAFBHuHhsdxDRJgFCSC7RaMOw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [darwin] - '@biomejs/cli-linux-arm64-musl@2.1.4': - resolution: {integrity: sha512-nYr7H0CyAJPaLupFE2cH16KZmRC5Z9PEftiA2vWxk+CsFkPZQ6dBRdcC6RuS+zJlPc/JOd8xw3uCCt9Pv41WvQ==} + '@biomejs/cli-linux-arm64-musl@2.2.0': + resolution: {integrity: sha512-egKpOa+4FL9YO+SMUMLUvf543cprjevNc3CAgDNFLcjknuNMcZ0GLJYa3EGTCR2xIkIUJDVneBV3O9OcIlCEZQ==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] libc: musl - '@biomejs/cli-linux-arm64@2.1.4': - resolution: {integrity: sha512-juhEkdkKR4nbUi5k/KRp1ocGPNWLgFRD4NrHZSveYrD6i98pyvuzmS9yFYgOZa5JhaVqo0HPnci0+YuzSwT2fw==} + '@biomejs/cli-linux-arm64@2.2.0': + resolution: {integrity: sha512-6eoRdF2yW5FnW9Lpeivh7Mayhq0KDdaDMYOJnH9aT02KuSIX5V1HmWJCQQPwIQbhDh68Zrcpl8inRlTEan0SXw==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] libc: glibc - '@biomejs/cli-linux-x64-musl@2.1.4': - resolution: {integrity: sha512-lvwvb2SQQHctHUKvBKptR6PLFCM7JfRjpCCrDaTmvB7EeZ5/dQJPhTYBf36BE/B4CRWR2ZiBLRYhK7hhXBCZAg==} + '@biomejs/cli-linux-x64-musl@2.2.0': + resolution: {integrity: sha512-I5J85yWwUWpgJyC1CcytNSGusu2p9HjDnOPAFG4Y515hwRD0jpR9sT9/T1cKHtuCvEQ/sBvx+6zhz9l9wEJGAg==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] libc: musl - '@biomejs/cli-linux-x64@2.1.4': - resolution: {integrity: sha512-Eoy9ycbhpJVYuR+LskV9s3uyaIkp89+qqgqhGQsWnp/I02Uqg2fXFblHJOpGZR8AxdB9ADy87oFVxn9MpFKUrw==} + '@biomejs/cli-linux-x64@2.2.0': + resolution: {integrity: sha512-5UmQx/OZAfJfi25zAnAGHUMuOd+LOsliIt119x2soA2gLggQYrVPA+2kMUxR6Mw5M1deUF/AWWP2qpxgH7Nyfw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] libc: glibc - '@biomejs/cli-win32-arm64@2.1.4': - resolution: {integrity: sha512-3WRYte7orvyi6TRfIZkDN9Jzoogbv+gSvR+b9VOXUg1We1XrjBg6WljADeVEaKTvOcpVdH0a90TwyOQ6ue4fGw==} + '@biomejs/cli-win32-arm64@2.2.0': + resolution: {integrity: sha512-n9a1/f2CwIDmNMNkFs+JI0ZjFnMO0jdOyGNtihgUNFnlmd84yIYY2KMTBmMV58ZlVHjgmY5Y6E1hVTnSRieggA==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [win32] - '@biomejs/cli-win32-x64@2.1.4': - resolution: {integrity: sha512-tBc+W7anBPSFXGAoQW+f/+svkpt8/uXfRwDzN1DvnatkRMt16KIYpEi/iw8u9GahJlFv98kgHcIrSsZHZTR0sw==} + '@biomejs/cli-win32-x64@2.2.0': + resolution: {integrity: sha512-Nawu5nHjP/zPKTIryh2AavzTc/KEg4um/MxWdXW0A6P/RZOyIpa7+QSjeXwAwX/utJGaCoXRPWtF3m5U/bB3Ww==} engines: {node: '>=14.21.3'} cpu: [x64] os: [win32] @@ -1804,39 +1804,39 @@ snapshots: '@babel/helper-string-parser': 7.27.1 '@babel/helper-validator-identifier': 7.27.1 - '@biomejs/biome@2.1.4': + '@biomejs/biome@2.2.0': optionalDependencies: - '@biomejs/cli-darwin-arm64': 2.1.4 - '@biomejs/cli-darwin-x64': 2.1.4 - '@biomejs/cli-linux-arm64': 2.1.4 - '@biomejs/cli-linux-arm64-musl': 2.1.4 - '@biomejs/cli-linux-x64': 2.1.4 - '@biomejs/cli-linux-x64-musl': 2.1.4 - '@biomejs/cli-win32-arm64': 2.1.4 - '@biomejs/cli-win32-x64': 2.1.4 + '@biomejs/cli-darwin-arm64': 2.2.0 + '@biomejs/cli-darwin-x64': 2.2.0 + '@biomejs/cli-linux-arm64': 2.2.0 + '@biomejs/cli-linux-arm64-musl': 2.2.0 + '@biomejs/cli-linux-x64': 2.2.0 + '@biomejs/cli-linux-x64-musl': 2.2.0 + '@biomejs/cli-win32-arm64': 2.2.0 + '@biomejs/cli-win32-x64': 2.2.0 - '@biomejs/cli-darwin-arm64@2.1.4': + '@biomejs/cli-darwin-arm64@2.2.0': optional: true - '@biomejs/cli-darwin-x64@2.1.4': + '@biomejs/cli-darwin-x64@2.2.0': optional: true - '@biomejs/cli-linux-arm64-musl@2.1.4': + '@biomejs/cli-linux-arm64-musl@2.2.0': optional: true - '@biomejs/cli-linux-arm64@2.1.4': + '@biomejs/cli-linux-arm64@2.2.0': optional: true - '@biomejs/cli-linux-x64-musl@2.1.4': + '@biomejs/cli-linux-x64-musl@2.2.0': optional: true - '@biomejs/cli-linux-x64@2.1.4': + '@biomejs/cli-linux-x64@2.2.0': optional: true - '@biomejs/cli-win32-arm64@2.1.4': + '@biomejs/cli-win32-arm64@2.2.0': optional: true - '@biomejs/cli-win32-x64@2.1.4': + '@biomejs/cli-win32-x64@2.2.0': optional: true '@bufbuild/protobuf@2.6.3':