From d1e2093cbcf823b3e49644b80465155a4b3b0682 Mon Sep 17 00:00:00 2001 From: Guillaume Galy Date: Mon, 25 Nov 2024 17:28:15 +0100 Subject: [PATCH 01/18] feat: Build slimmed down GraalVM for the Gatling JS bundle --- .gitignore | 3 +- js/bundle/package.json | 28 ++++++++++++++ js/bundle/src/bundle.ts | 26 +++++++++++++ js/bundle/src/download.ts | 12 ++++++ js/bundle/src/graalvm.ts | 56 ++++++++++++++++++++++++++++ js/bundle/src/index.ts | 40 ++++++++++++++++++++ js/bundle/src/os.ts | 20 ++++++++++ js/bundle/src/tmpDir.ts | 77 +++++++++++++++++++++++++++++++++++++++ js/bundle/tsconfig.json | 17 +++++++++ js/package.json | 1 + jvm/build.sbt | 9 +++-- 11 files changed, 284 insertions(+), 5 deletions(-) create mode 100644 js/bundle/package.json create mode 100644 js/bundle/src/bundle.ts create mode 100644 js/bundle/src/download.ts create mode 100644 js/bundle/src/graalvm.ts create mode 100644 js/bundle/src/index.ts create mode 100644 js/bundle/src/os.ts create mode 100644 js/bundle/src/tmpDir.ts create mode 100644 js/bundle/tsconfig.json diff --git a/.gitignore b/.gitignore index 44214fb..16ca327 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,8 @@ node_modules/ # build targets target/ -/tmp/ +tmp/ +/js/bundle/src/versions.ts /js/cli/src/dependencies/versions.ts /js/jvm-types/index.js /js/jvm-types/index.d.ts diff --git a/js/bundle/package.json b/js/bundle/package.json new file mode 100644 index 0000000..74e3880 --- /dev/null +++ b/js/bundle/package.json @@ -0,0 +1,28 @@ +{ + "name": "@gatling.io/bundle", + "version": "0.0.0", + "license": "Apache-2.0", + "main": "target/index.js", + "types": "target/index.d.ts", + "dependencies": { + "archiver": "7.0.1", + "axios": "1.7.7", + "commander": "12.1.0", + "decompress": "4.2.1" + }, + "devDependencies": { + "@types/archiver": "6.0.3", + "@types/decompress": "4.2.7", + "@types/node": "18.19.64", + "prettier": "3.3.3", + "rimraf": "6.0.1", + "typescript": "5.6.3" + }, + "scripts": { + "clean": "rimraf target", + "format": "prettier --write '**/*.ts'", + "format-check": "prettier --check '**/*.ts'", + "build": "tsc -p .", + "generate": "tsc -p . && node ./target/index.js" + } +} diff --git a/js/bundle/src/bundle.ts b/js/bundle/src/bundle.ts new file mode 100644 index 0000000..f0276f5 --- /dev/null +++ b/js/bundle/src/bundle.ts @@ -0,0 +1,26 @@ +import fs from "node:fs"; +import { pipeline } from "node:stream/promises"; +import { constants as zConstants } from "node:zlib"; + +import archiver from "archiver"; + +import { TmpDirStructure } from "./tmpDir"; + +export const bundle = async (tmpDir: TmpDirStructure): Promise => { + console.log(`Creating bundle file ${tmpDir.bundleFile}`); + + const output = fs.createWriteStream(tmpDir.bundleFile); + + const archive = archiver("zip", { + zlib: { level: zConstants.Z_MAX_LEVEL } + }); + archive.on("warning", (err) => { + // The pipeline will rethrow errors but not warnings. We don't want to ignore warnings from the archiver, because + // they include things like 'no such file or directory'. + throw err; + }); + archive.directory(tmpDir.graalVm.homeDir + "/", "graalvm"); + archive.finalize(); + + await pipeline(archive, output); +}; diff --git a/js/bundle/src/download.ts b/js/bundle/src/download.ts new file mode 100644 index 0000000..2b31a1c --- /dev/null +++ b/js/bundle/src/download.ts @@ -0,0 +1,12 @@ +import fs from "node:fs"; +import stream from "node:stream"; +import util from "node:util"; + +import axios from "axios"; + +const pipeline = util.promisify(stream.pipeline); + +export const downloadFile = async (url: string, targetFile: string): Promise => { + const request = await axios.get(url, { responseType: "stream" }); + await pipeline(request.data, fs.createWriteStream(targetFile)); +}; diff --git a/js/bundle/src/graalvm.ts b/js/bundle/src/graalvm.ts new file mode 100644 index 0000000..3b00fbf --- /dev/null +++ b/js/bundle/src/graalvm.ts @@ -0,0 +1,56 @@ +import { exec } from "node:child_process"; +import path from "node:path"; +import fs from "node:fs/promises"; +import { promisify } from "node:util"; + +import decompress from "decompress"; + +import { downloadFile } from "./download"; +import { osArch, osType } from "./os"; +import { TmpDirStructure } from "./tmpDir"; +import { versions } from "./versions"; + +export const extension = osType === "Windows_NT" ? "zip" : "tar.gz"; + +export const buildGraalVm = async (tmpDir: TmpDirStructure): Promise => { + console.log(`Downloading GraalVM from ${url} to ${tmpDir.graalVm.downloadFile}`); + await downloadFile(url, tmpDir.graalVm.downloadFile); + + console.log(`Unpacking GraalVM to ${tmpDir.graalVm.extractDir}`); + await decompress(tmpDir.graalVm.downloadFile, tmpDir.graalVm.extractDir, { + map: (file) => { + // Remove first level of file name, because it already contains a root directory + file.path = file.path.split("/").slice(1).join("/"); + return file; + } + }); + + console.log(`Repackaging GraalVM using jlink to ${tmpDir.graalVm.homeDir}`); + const graalVmHome = + osType === "Darwin" ? path.join(tmpDir.graalVm.extractDir, "Contents", "Home") : tmpDir.graalVm.extractDir; + const jlinkBin = osType === "Windows_NT" ? "jlink.exe" : "jlink"; + const jlinkPath = path.join(graalVmHome, "bin", jlinkBin); + const modulePath = path.join(graalVmHome, "jmods"); + const moduleFiles = await fs.readdir(modulePath); + const modules = moduleFiles + .filter((f) => f.endsWith(".jmod")) + .map((f) => f.slice(0, -5)) + .join(","); + const command = `${jlinkPath} --module-path "${modulePath}" --add-modules "${modules}" --output ${tmpDir.graalVm.homeDir}`; + await execAsync(command); +}; + +const execAsync = promisify(exec); + +const os = { + Darwin: "macos", + Linux: "linux", + Windows_NT: "windows" +}[osType]; + +const arch = { + x64: "x64", + arm64: "aarch64" +}[osArch]; + +const url = `https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${versions.graalvm.jdk}/graalvm-community-jdk-${versions.graalvm.jdk}_${os}-${arch}_bin.${extension}`; diff --git a/js/bundle/src/index.ts b/js/bundle/src/index.ts new file mode 100644 index 0000000..dcf528c --- /dev/null +++ b/js/bundle/src/index.ts @@ -0,0 +1,40 @@ +import { bundle } from "./bundle"; +import { buildGraalVm } from "./graalvm"; +import { osType, osArch } from "./os"; +import { initTmpDir } from "./tmpDir"; +import { versions } from "./versions"; + +const run = async () => { + console.log(` +********** Initial setup ********** +`); + + console.log(`OS type: ${osType} +OS arch: ${osArch} +Gatling JS version: ${versions.gatling.jsAdapter} +Gatling version: ${versions.gatling.core} +GraalVM version: ${versions.graalvm.jdk} +GraalJS version: ${versions.graalvm.js}`); + + console.log("Initialize tmp directory..."); + const tmpDir = initTmpDir(); + console.log(`Tmp directory initialized.`); + + console.log(` +********** GraalVM ********** +`); + + console.log("Building slimmed down GraalVM..."); + await buildGraalVm(tmpDir); + console.log(`Slimmed down GraalVM built.`); + + console.log(` +********** Bundle ********** +`); + + console.log("Creating bundle file..."); + await bundle(tmpDir); + console.log(`Bundle file created.`); +}; + +run(); diff --git a/js/bundle/src/os.ts b/js/bundle/src/os.ts new file mode 100644 index 0000000..dffc8ca --- /dev/null +++ b/js/bundle/src/os.ts @@ -0,0 +1,20 @@ +import os from "node:os"; + +const _osType = os.type(); +if (_osType !== "Darwin" && _osType !== "Linux" && _osType !== "Windows_NT") { + throw Error(`Gatling JS does not support the Operating System '${_osType}'`); +} + +const _osArch = os.arch(); +if (_osArch !== "x64" && _osArch !== "arm64") { + throw Error(`Gatling JS does not support the architecture '${_osArch}'`); +} + +if (_osType === "Windows_NT" && _osArch === "arm64") { + // GraalVM distribution not available for Windows on ARM + // TODO see if we can recommend a solution + throw Error(`Gatling JS does not support Windows on the ARM architecture`); +} + +export const osType: "Darwin" | "Linux" | "Windows_NT" = _osType; +export const osArch: "x64" | "arm64" = _osArch; diff --git a/js/bundle/src/tmpDir.ts b/js/bundle/src/tmpDir.ts new file mode 100644 index 0000000..275e52a --- /dev/null +++ b/js/bundle/src/tmpDir.ts @@ -0,0 +1,77 @@ +import fs from "node:fs"; +import path from "node:path"; +import process from "node:process"; + +import { extension as graalVmExtension } from "./graalvm"; +import { versions } from "./versions"; +import { osArch, osType } from "./os"; + +export interface TmpDirStructure { + dir: string; + bundleFile: string; + graalVm: { + dir: string; + downloadFile: string; + extractDir: string; + homeDir: string; + }; + coursier: { + dir: string; + jarFile: string; + batFile: string; + }; +} + +export const initTmpDir = (): TmpDirStructure => { + const entrypointFilePath = path.parse(process.argv[1]); + const rootDir = path.parse(entrypointFilePath.dir).dir; + + const tmpDir = path.join(rootDir, "tmp"); + if (fs.existsSync(tmpDir)) { + fs.rmSync(tmpDir, { recursive: true }); + } + fs.mkdirSync(tmpDir); + + const graalVmDir = path.join(tmpDir, "graalvm"); + fs.mkdirSync(graalVmDir); + + const coursierDir = path.join(tmpDir, "coursier"); + fs.mkdirSync(coursierDir); + + const libDir = path.join(tmpDir, "lib"); + fs.mkdirSync(libDir); + const libJavaDir = path.join(libDir, "java"); + fs.mkdirSync(libJavaDir); + + const result = { + dir: tmpDir, + bundleFile: path.join(tmpDir, `gatling-js-bundle-${versions.gatling.jsAdapter}-${osType}-${osArch}.zip`), + graalVm: { + dir: graalVmDir, + downloadFile: path.join(graalVmDir, `archive.${graalVmExtension}`), + extractDir: path.join(graalVmDir, "archive"), + homeDir: path.join(graalVmDir, "home") + }, + coursier: { + dir: coursierDir, + jarFile: path.join(coursierDir, "coursier"), + batFile: path.join(coursierDir, "coursier.bat") + } + }; + + console.log("Tmp directory paths:"); + logStructure(result); + + return result; +}; + +const logStructure = (structure: object, level: number = 0): void => { + Object.entries(structure).forEach(([key, value]) => { + if (typeof value === "object") { + console.log(" ".repeat(level * 2) + `- ${key}:`); + logStructure(value, level + 1); + } else { + console.log(" ".repeat(level * 2) + `- ${key}: ${value}`); + } + }); +}; diff --git a/js/bundle/tsconfig.json b/js/bundle/tsconfig.json new file mode 100644 index 0000000..2cb5a0d --- /dev/null +++ b/js/bundle/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "baseUrl": "./", + "rootDir": "src", + "outDir": "target", + "target": "es2021", + "module": "node16", + "esModuleInterop": true, + "moduleResolution": "node16", + "declaration": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true + }, + "include": ["src/**/*.ts"], + "exclude": ["**/*.test.ts"] +} diff --git a/js/package.json b/js/package.json index 1f8b432..808f091 100644 --- a/js/package.json +++ b/js/package.json @@ -2,6 +2,7 @@ "name": "@gatling.io/js", "version": "0.0.0", "workspaces": [ + "bundle", "cli", "jvm-types", "core", diff --git a/jvm/build.sbt b/jvm/build.sbt index 7aa7fe6..cc2e233 100644 --- a/jvm/build.sbt +++ b/jvm/build.sbt @@ -45,8 +45,8 @@ lazy val adapter = (project in file("adapter")) "io.gatling" % "gatling-asm-shaded" % "9.7.1" ), Compile / sourceGenerators += Def.task { - // Bit of a hack, generate a file directly into the CLI project to share version numbers - val path = (ThisBuild / baseDirectory).value / ".." / "js" / "cli" / "src" / "dependencies" / "versions.ts" + // Generate a file directly into the CLI project and bundle project to share version numbers + val basePath = (ThisBuild / baseDirectory).value / ".." val jsAdapterVersion = version.value val content = s"""export const versions = { @@ -65,8 +65,9 @@ lazy val adapter = (project in file("adapter")) | } |}; |""".stripMargin - IO.write(path, content) - // The file isn't actually part of _this_ project's sources, return empty Seq + IO.write(basePath / "js" / "cli" / "src" / "dependencies" / "versions.ts", content) + IO.write(basePath / "js" / "bundle" / "src"/ "versions.ts", content) + // These files aren't actually part of _this_ project's sources, return empty Seq Seq() }.taskValue, Compile / packageDoc / mappings := Seq.empty, From 3e3412135bfa3209b35b499a23ea38a4732faab3 Mon Sep 17 00:00:00 2001 From: Guillaume Galy Date: Tue, 26 Nov 2024 14:15:18 +0100 Subject: [PATCH 02/18] feat: Include Java libraries in bundle --- js/bundle/src/bundle.ts | 16 ++++++----- js/bundle/src/coursier.ts | 56 +++++++++++++++++++++++++++++++++++++++ js/bundle/src/index.ts | 9 +++++++ js/bundle/src/tmpDir.ts | 8 ++++++ 4 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 js/bundle/src/coursier.ts diff --git a/js/bundle/src/bundle.ts b/js/bundle/src/bundle.ts index f0276f5..67e7eed 100644 --- a/js/bundle/src/bundle.ts +++ b/js/bundle/src/bundle.ts @@ -14,13 +14,15 @@ export const bundle = async (tmpDir: TmpDirStructure): Promise => { const archive = archiver("zip", { zlib: { level: zConstants.Z_MAX_LEVEL } }); - archive.on("warning", (err) => { - // The pipeline will rethrow errors but not warnings. We don't want to ignore warnings from the archiver, because - // they include things like 'no such file or directory'. - throw err; - }); - archive.directory(tmpDir.graalVm.homeDir + "/", "graalvm"); - archive.finalize(); + archive + .on("warning", (err) => { + // The pipeline will rethrow errors but not warnings. We don't want to ignore warnings from the archiver, because + // they include things like 'no such file or directory'. + throw err; + }) + .directory(tmpDir.graalVm.homeDir + "/", "graalvm") + .directory(tmpDir.lib.dir + "/", "lib") + .finalize(); await pipeline(archive, output); }; diff --git a/js/bundle/src/coursier.ts b/js/bundle/src/coursier.ts new file mode 100644 index 0000000..41b0d02 --- /dev/null +++ b/js/bundle/src/coursier.ts @@ -0,0 +1,56 @@ +import { exec } from "node:child_process"; +import path from "node:path"; +import fs from "node:fs/promises"; +import { promisify } from "node:util"; + +import { downloadFile } from "./download"; +import { osType } from "./os"; +import { TmpDirStructure } from "./tmpDir"; +import { versions } from "./versions"; + +export const resolveJavaLibraries = async (tmpDir: TmpDirStructure): Promise => { + const coursierPath = await downloadCoursier(tmpDir); + console.log(`Coursier path: ${coursierPath}`); + + console.log("Resolving dependencies with Coursier"); + const command = `"${coursierPath}" fetch --classpath ${dependencies.join(" ")}`; + const { stdout } = await execAsync(command, { env: { ...process.env, JAVA_HOME: tmpDir.graalVm.homeDir } }); + console.log(`stdout: ${stdout}`); + + console.log(`Copying Java libraries to ${tmpDir.lib.javaDir}`); + const separator = osType === "Windows_NT" ? ";" : ":"; + const resolvedLibraries = stdout.trim().split(separator); + for (const sourcePath of resolvedLibraries) { + const fileName = path.parse(sourcePath).base; + const targetPath = path.join(tmpDir.lib.javaDir, fileName); + await fs.cp(sourcePath, targetPath); + } +}; + +const downloadCoursier = async (tmpDir: TmpDirStructure) => { + console.log(`Downloading Coursier JAR from ${jarUrl} to ${tmpDir.coursier.jarFile}`); + await downloadFile(jarUrl, tmpDir.coursier.jarFile); + if (osType === "Windows_NT") { + console.log(`Downloading Coursier BAT from ${windowsLauncherUrl} to ${tmpDir.coursier.batFile}`); + await downloadFile(windowsLauncherUrl, tmpDir.coursier.batFile); + return tmpDir.coursier.batFile; + } else { + await fs.chmod(tmpDir.coursier.jarFile, 0o744); + return tmpDir.coursier.jarFile; + } +}; + +const execAsync = promisify(exec); + +const jarUrl = "https://github.com/coursier/launchers/raw/master/coursier"; +const windowsLauncherUrl = "https://github.com/coursier/launchers/raw/master/coursier.bat"; + +const dependencies = [ + `"io.gatling.highcharts:gatling-charts-highcharts:${versions.gatling.core}"`, + `"io.gatling:gatling-jvm-to-js-adapter:${versions.gatling.jsAdapter}"`, + `"io.gatling:gatling-enterprise-plugin-commons:${versions.gatling.enterprisePluginCommons}"`, + `"org.graalvm.polyglot:js-community:${versions.graalvm.js}"`, + `io.gatling:gatling-recorder:${versions.gatling.core}`, // For the recorder + // TODO handle Gatling Postman version if different from Gatling JS version + `"io.gatling:gatling-postman-jvm-to-js-adapter:${versions.gatling.jsAdapter}"` // For Gatling Postman +]; diff --git a/js/bundle/src/index.ts b/js/bundle/src/index.ts index dcf528c..336e695 100644 --- a/js/bundle/src/index.ts +++ b/js/bundle/src/index.ts @@ -1,4 +1,5 @@ import { bundle } from "./bundle"; +import { resolveJavaLibraries } from "./coursier"; import { buildGraalVm } from "./graalvm"; import { osType, osArch } from "./os"; import { initTmpDir } from "./tmpDir"; @@ -28,6 +29,14 @@ GraalJS version: ${versions.graalvm.js}`); await buildGraalVm(tmpDir); console.log(`Slimmed down GraalVM built.`); + console.log(` +********** Java dependencies ********** +`); + + console.log("Resolving Java libraries..."); + await resolveJavaLibraries(tmpDir); + console.log(`Java libraries resolved.`); + console.log(` ********** Bundle ********** `); diff --git a/js/bundle/src/tmpDir.ts b/js/bundle/src/tmpDir.ts index 275e52a..67616cc 100644 --- a/js/bundle/src/tmpDir.ts +++ b/js/bundle/src/tmpDir.ts @@ -20,6 +20,10 @@ export interface TmpDirStructure { jarFile: string; batFile: string; }; + lib: { + dir: string; + javaDir: string; + }; } export const initTmpDir = (): TmpDirStructure => { @@ -56,6 +60,10 @@ export const initTmpDir = (): TmpDirStructure => { dir: coursierDir, jarFile: path.join(coursierDir, "coursier"), batFile: path.join(coursierDir, "coursier.bat") + }, + lib: { + dir: libDir, + javaDir: libJavaDir } }; From 092877cef26eabe0fb1e3af074b3af7d8983c8b3 Mon Sep 17 00:00:00 2001 From: Guillaume Galy Date: Tue, 26 Nov 2024 14:35:46 +0100 Subject: [PATCH 03/18] feat: Add metadata to bundle file --- js/bundle/src/bundle.ts | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/js/bundle/src/bundle.ts b/js/bundle/src/bundle.ts index 67e7eed..079b8d3 100644 --- a/js/bundle/src/bundle.ts +++ b/js/bundle/src/bundle.ts @@ -5,24 +5,39 @@ import { constants as zConstants } from "node:zlib"; import archiver from "archiver"; import { TmpDirStructure } from "./tmpDir"; +import { versions } from "./versions"; export const bundle = async (tmpDir: TmpDirStructure): Promise => { console.log(`Creating bundle file ${tmpDir.bundleFile}`); const output = fs.createWriteStream(tmpDir.bundleFile); - const archive = archiver("zip", { - zlib: { level: zConstants.Z_MAX_LEVEL } - }); - archive + const archive = archiver("zip", zipOptions) .on("warning", (err) => { // The pipeline will rethrow errors but not warnings. We don't want to ignore warnings from the archiver, because // they include things like 'no such file or directory'. throw err; }) + .append(metadata, { name: "gatling-bundle.json" }) .directory(tmpDir.graalVm.homeDir + "/", "graalvm") - .directory(tmpDir.lib.dir + "/", "lib") - .finalize(); + .directory(tmpDir.lib.dir + "/", "lib"); + archive.finalize(); await pipeline(archive, output); }; + +const zipOptions = { + zlib: { level: zConstants.Z_MAX_LEVEL } +}; + +const metadata = JSON.stringify( + { + version: versions.gatling.jsAdapter, + "gatling-js": versions.gatling.jsAdapter, + "gatling-core": versions.gatling.core, + graalvm: versions.graalvm.jdk, + graaljs: versions.graalvm.js + }, + null, + 2 +); From e3e39d0bde37bebd4ad4591ac5da4446d5c5f492 Mon Sep 17 00:00:00 2001 From: Guillaume Galy Date: Tue, 3 Dec 2024 14:51:08 +0100 Subject: [PATCH 04/18] feat: Add manual bundle install command --- build-bundle.sh | 15 ++++ install-all-with-links.sh | 3 + js-simulation/package-lock.json | 1 + js/bundle/src/coursier.ts | 2 +- js/cli/package.json | 1 + js/cli/src/commands/enterpriseDeploy.ts | 4 +- js/cli/src/commands/enterpriseStart.ts | 4 +- js/cli/src/commands/install.ts | 13 +-- js/cli/src/commands/options.ts | 8 +- js/cli/src/commands/recorder.ts | 5 +- js/cli/src/commands/run.ts | 5 +- js/cli/src/dependencies/index.ts | 115 +++++++++++++++++------- js/package-lock.json | 78 ++++++++++++++++ ts-simulation/package-lock.json | 1 + 14 files changed, 207 insertions(+), 48 deletions(-) create mode 100755 build-bundle.sh diff --git a/build-bundle.sh b/build-bundle.sh new file mode 100755 index 0000000..aa597df --- /dev/null +++ b/build-bundle.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -e + +root_dir="$(dirname "$(realpath -- "$0")")" + +# Build bundle +cd "$root_dir/js" +npm run generate --workspace=bundle + +# Install bundle (manually) +bundle_file="../js/bundle/tmp/gatling-js-bundle-0.0.0-SNAPSHOT-Darwin-arm64.zip" +install_dir="$HOME/.gatling/gatling-js-bundle/0.0.0-SNAPSHOT/" +rm -rf "$install_dir" +"${root_dir}/js/cli/target/index.js" install "$bundle_file" diff --git a/install-all-with-links.sh b/install-all-with-links.sh index 2510c22..0a51934 100755 --- a/install-all-with-links.sh +++ b/install-all-with-links.sh @@ -12,6 +12,9 @@ cd "$root_dir/js" npm install "$root_dir/build-js.sh" +# Install bundle +"$root_dir/build-bundle.sh" + # Install js-simulation cd "$root_dir/js-simulation" # Multiple packages MUST be linked all at once (executing 'npm link ' again will remove previous links...): diff --git a/js-simulation/package-lock.json b/js-simulation/package-lock.json index ed74f98..eaf03d4 100644 --- a/js-simulation/package-lock.json +++ b/js-simulation/package-lock.json @@ -31,6 +31,7 @@ "esbuild-plugin-tsc": "0.4.0", "import-meta-resolve": "4.1.0", "make-fetch-happen": "14.0.3", + "node-stream-zip": "1.15.0", "readline-sync": "1.4.10" }, "bin": { diff --git a/js/bundle/src/coursier.ts b/js/bundle/src/coursier.ts index 41b0d02..e0c0a01 100644 --- a/js/bundle/src/coursier.ts +++ b/js/bundle/src/coursier.ts @@ -50,7 +50,7 @@ const dependencies = [ `"io.gatling:gatling-jvm-to-js-adapter:${versions.gatling.jsAdapter}"`, `"io.gatling:gatling-enterprise-plugin-commons:${versions.gatling.enterprisePluginCommons}"`, `"org.graalvm.polyglot:js-community:${versions.graalvm.js}"`, - `io.gatling:gatling-recorder:${versions.gatling.core}`, // For the recorder + `"io.gatling:gatling-recorder:${versions.gatling.core}"`, // For the recorder // TODO handle Gatling Postman version if different from Gatling JS version `"io.gatling:gatling-postman-jvm-to-js-adapter:${versions.gatling.jsAdapter}"` // For Gatling Postman ]; diff --git a/js/cli/package.json b/js/cli/package.json index 13484f2..4dc72a5 100644 --- a/js/cli/package.json +++ b/js/cli/package.json @@ -25,6 +25,7 @@ "dependencies": { "@jspm/core": "2.1.0", "archiver": "7.0.1", + "node-stream-zip": "1.15.0", "commander": "12.1.0", "decompress": "4.2.1", "esbuild": "0.24.0", diff --git a/js/cli/src/commands/enterpriseDeploy.ts b/js/cli/src/commands/enterpriseDeploy.ts index b6bc4fd..19de03d 100644 --- a/js/cli/src/commands/enterpriseDeploy.ts +++ b/js/cli/src/commands/enterpriseDeploy.ts @@ -31,7 +31,7 @@ import { webAppUrlOptionValue } from "./options"; import { findSimulations } from "../simulations"; -import { installGatlingJs } from "../dependencies"; +import { resolveBundle } from "../dependencies"; import { bundle } from "../bundle"; import { enterpriseDeploy, enterprisePackage } from "../enterprise"; @@ -76,7 +76,7 @@ export default (program: Command): void => { const packageDescriptorFilename = packageDescriptorFilenameOptionValue(options); const packageFile = packageFileOptionValue(options); - const { graalvmHome, jvmClasspath } = await installGatlingJs({ gatlingHome }); + const { graalvmHome, jvmClasspath } = await resolveBundle({ gatlingHome }); await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations }); await enterprisePackage({ bundleFile, resourcesFolder, packageFile, simulations }); await enterpriseDeploy({ diff --git a/js/cli/src/commands/enterpriseStart.ts b/js/cli/src/commands/enterpriseStart.ts index 2c66006..4009a1e 100644 --- a/js/cli/src/commands/enterpriseStart.ts +++ b/js/cli/src/commands/enterpriseStart.ts @@ -39,7 +39,7 @@ import { waitForRunEndOptionValue } from "./options"; import { findSimulations } from "../simulations"; -import { installGatlingJs } from "../dependencies"; +import { resolveBundle } from "../dependencies"; import { bundle } from "../bundle"; import { enterprisePackage, enterpriseStart } from "../enterprise"; @@ -97,7 +97,7 @@ export default (program: Command): void => { throw new Error(`No simulation specified when using non-interactive mode`); } - const { graalvmHome, jvmClasspath } = await installGatlingJs({ gatlingHome }); + const { graalvmHome, jvmClasspath } = await resolveBundle({ gatlingHome }); await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations }); await enterprisePackage({ bundleFile, resourcesFolder, packageFile, simulations }); await enterpriseStart({ diff --git a/js/cli/src/commands/install.ts b/js/cli/src/commands/install.ts index 7908e75..70f61bb 100644 --- a/js/cli/src/commands/install.ts +++ b/js/cli/src/commands/install.ts @@ -1,7 +1,7 @@ import { Command } from "commander"; -import { gatlingHomeOption, gatlingHomeOptionValueWithDefaults } from "./options"; -import { installGatlingJs } from "../dependencies"; +import { bundleFileArgument, gatlingHomeOption, gatlingHomeOptionValueWithDefaults } from "./options"; +import { installBundleFile, resolveBundle } from "../dependencies"; import { logger } from "../log"; export default (program: Command): void => { @@ -9,11 +9,14 @@ export default (program: Command): void => { .command("install") .description("Install all required components and dependencies for Gatling") .addOption(gatlingHomeOption) - .action(async (options) => { + .addArgument(bundleFileArgument) + .action(async (bundleFilePath: string | undefined, options) => { const gatlingHome = gatlingHomeOptionValueWithDefaults(options); - const { graalvmHome, coursierBinary, jvmClasspath } = await installGatlingJs({ gatlingHome }); + const { graalvmHome, jvmClasspath } = + bundleFilePath !== undefined + ? await installBundleFile({ gatlingHome, bundleFilePath }) + : await resolveBundle({ gatlingHome }); logger.info(`graalvmHome=${graalvmHome}`); - logger.info(`coursierBinary=${coursierBinary}`); logger.info(`jvmClasspath=${jvmClasspath}`); }); }; diff --git a/js/cli/src/commands/options.ts b/js/cli/src/commands/options.ts index f67c2aa..cc1f297 100644 --- a/js/cli/src/commands/options.ts +++ b/js/cli/src/commands/options.ts @@ -6,6 +6,7 @@ import path from "path"; import { SimulationFile } from "../simulations"; import { keyInSelectPaginated } from "../readline"; import { logger } from "../log"; +import stream from "stream"; const getStringValueOptional = (option: Option) => @@ -70,7 +71,7 @@ const getNumberValueOptional = export const gatlingHomeOption = new Option( "--gatling-home ", - 'The folder used to download and install Gatling components (default: "~/.gatling")' + 'The folder used to download and install Gatling components (default: "/.gatling")' ); export const gatlingHomeOptionValueWithDefaults = (options: any): string => getStringValueOptional(gatlingHomeOption)(options) || `${os.homedir()}/.gatling`; @@ -252,6 +253,11 @@ export const parseRunParametersArgument = (args: string[]): Record", "URL of the Gatling Enterprise API") .default("https://api.gatling.io") .hideHelp(); diff --git a/js/cli/src/commands/recorder.ts b/js/cli/src/commands/recorder.ts index 598a3bf..64ef56a 100644 --- a/js/cli/src/commands/recorder.ts +++ b/js/cli/src/commands/recorder.ts @@ -11,7 +11,7 @@ import { typescriptOptionValueWithDefaults } from "./options"; import { findSimulations } from "../simulations"; -import { installRecorder } from "../dependencies"; +import { resolveBundle } from "../dependencies"; import { logger } from "../log"; import { runRecorder } from "../run"; @@ -31,9 +31,8 @@ export default (program: Command): void => { const simulations = await findSimulations(sourcesFolder); const typescript = typescriptOptionValueWithDefaults(options, simulations); - const { graalvmHome, coursierBinary, jvmClasspath } = await installRecorder({ gatlingHome }); + const { graalvmHome, jvmClasspath } = await resolveBundle({ gatlingHome }); logger.debug(`graalvmHome=${graalvmHome}`); - logger.debug(`coursierBinary=${coursierBinary}`); logger.debug(`jvmClasspath=${jvmClasspath}`); await runRecorder({ graalvmHome, jvmClasspath, sourcesFolder, typescript, resourcesFolder }); diff --git a/js/cli/src/commands/run.ts b/js/cli/src/commands/run.ts index 65a4398..c7ee418 100644 --- a/js/cli/src/commands/run.ts +++ b/js/cli/src/commands/run.ts @@ -24,7 +24,7 @@ import { typescriptOptionValueWithDefaults } from "./options"; import { findSimulations } from "../simulations"; -import { installGatlingJs } from "../dependencies"; +import { resolveBundle } from "../dependencies"; import { logger } from "../log"; import { bundle } from "../bundle"; import { runSimulation } from "../run"; @@ -61,9 +61,8 @@ export default (program: Command): void => { const typescript = typescriptOptionValueWithDefaults(options, simulations); const simulation = simulationOptionValueWithDefaults(options, simulations, !nonInteractive); - const { graalvmHome, coursierBinary, jvmClasspath } = await installGatlingJs({ gatlingHome, postman }); + const { graalvmHome, jvmClasspath } = await resolveBundle({ gatlingHome }); logger.debug(`graalvmHome=${graalvmHome}`); - logger.debug(`coursierBinary=${coursierBinary}`); logger.debug(`jvmClasspath=${jvmClasspath}`); await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations }); diff --git a/js/cli/src/dependencies/index.ts b/js/cli/src/dependencies/index.ts index 0b979c5..8db19a6 100644 --- a/js/cli/src/dependencies/index.ts +++ b/js/cli/src/dependencies/index.ts @@ -1,45 +1,98 @@ -import fs from "fs/promises"; +import fs from "node:fs/promises"; +import path from "node:path"; -import { installCoursier, resolveGatlingJsDependencies, resolveRecorderDependencies } from "./coursier"; -import { installGraalVm } from "./graalVm"; +import StreamZip from "node-stream-zip"; + +import { logger } from "../log"; +import { osType } from "./os"; +import { versions } from "./versions"; export { versions } from "./versions"; -export interface DependenciesOptions { +export interface BundleOptions { gatlingHome: string; - postman?: string; } -export interface ResolvedDependencies { +export interface BundleInstallOptions extends BundleOptions { + bundleFilePath: string; +} + +export interface ResolvedBundle { graalvmHome: string; - coursierBinary: string; jvmClasspath: string; } -export const installGatlingJs = async (options: DependenciesOptions): Promise => { - const downloadDir = `${options.gatlingHome}/tmp/download`; - await fs.mkdir(downloadDir, { recursive: true }); - - const graalvmHomePath = await installGraalVm(options.gatlingHome, downloadDir); - const coursierPath = await installCoursier(options.gatlingHome, downloadDir); - const classpath = await resolveGatlingJsDependencies(coursierPath, graalvmHomePath, options.postman); - return { - graalvmHome: graalvmHomePath, - coursierBinary: coursierPath, - jvmClasspath: classpath.trim() - }; +export const installBundleFile = async (options: BundleInstallOptions): Promise => { + logger.info(`bundleFilePath: ${options.bundleFilePath}`); + const zip = new StreamZip.async({ file: options.bundleFilePath }); + const metadata = await zip.entryData(metadataFileName); + const { version } = JSON.parse(metadata.toString("utf-8")); + if (version === versions.gatling.jsAdapter) { + logger.info(`Installing dependencies bundle for Gatling JS ${version}, which is the current version`); + } else { + logger.info( + `Installing dependencies bundle for Gatling JS ${version}, which is not the current version (${versions.gatling.jsAdapter})` + ); + } + + const bundlePath = getBundlePath(options, version); + if (await canReadPath(bundlePath)) { + throw Error(`Directory ${bundlePath} already exists`); + } + await fs.mkdir(bundlePath, { recursive: true }); + await zip.extract(null, bundlePath); + if (osType !== "Windows_NT") { + const graalVmBinDir = path.join(bundlePath, "graalvm", "bin"); + const binFiles = await fs.readdir(graalVmBinDir); + for (const binFile of binFiles) { + await fs.chmod(path.join(graalVmBinDir, binFile), 0o744); // chmod +x + } + } + logger.info(`Gatling JS dependencies bundle installed in ${bundlePath}`); + + return getResolvedBundle(bundlePath); }; -export const installRecorder = async (options: DependenciesOptions): Promise => { - const downloadDir = `${options.gatlingHome}/tmp/download`; - await fs.mkdir(downloadDir, { recursive: true }); - - const graalvmHomePath = await installGraalVm(options.gatlingHome, downloadDir); - const coursierPath = await installCoursier(options.gatlingHome, downloadDir); - const classpath = await resolveRecorderDependencies(coursierPath, graalvmHomePath); - return { - graalvmHome: graalvmHomePath, - coursierBinary: coursierPath, - jvmClasspath: classpath.trim() - }; +export const resolveBundle = async (options: BundleOptions): Promise => { + const bundlePath = getBundlePath(options, versions.gatling.jsAdapter); + if (await canReadPath(bundlePath)) { + // Basic check of the installed bundle we found + const bundleMetadataPath = path.join(bundlePath, metadataFileName); + let version = ""; + try { + const f = await fs.readFile(bundleMetadataPath, { encoding: "utf-8" }); + const metadata = JSON.parse(f); + version = metadata.version; + } catch {} + if (version !== versions.gatling.jsAdapter) { + throw Error(`Inconsistent bundle content found at ${bundlePath}`); + } + } else { + throw Error("TODO try to install the bundle automatically"); + } + + return getResolvedBundle(bundlePath); }; + +const getBundlePath = (options: BundleOptions, version: string) => + path.join(options.gatlingHome, "gatling-js-bundle", version); + +const metadataFileName = "gatling-bundle.json"; + +const canReadPath = async (path: string) => { + try { + await fs.access(path, fs.constants.R_OK); + return true; + } catch (e) { + if ((e as any).code === "ENOENT") { + return false; + } else { + throw e; + } + } +}; + +const getResolvedBundle = (bundlePath: string): ResolvedBundle => ({ + graalvmHome: path.join(bundlePath, "graalvm"), + jvmClasspath: path.join(bundlePath, "lib", "java", "*") +}); diff --git a/js/package-lock.json b/js/package-lock.json index cd39651..b2d0efe 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -8,6 +8,7 @@ "name": "@gatling.io/js", "version": "0.0.0", "workspaces": [ + "bundle", "cli", "jvm-types", "core", @@ -17,6 +18,65 @@ "workspace-version": "0.1.4" } }, + "bundle": { + "name": "@gatling.io/bundle", + "version": "0.0.0", + "license": "Apache-2.0", + "dependencies": { + "archiver": "7.0.1", + "axios": "1.7.7", + "commander": "12.1.0", + "decompress": "4.2.1" + }, + "devDependencies": { + "@types/archiver": "6.0.3", + "@types/decompress": "4.2.7", + "@types/node": "18.19.64", + "prettier": "3.3.3", + "rimraf": "6.0.1", + "typescript": "5.6.3" + } + }, + "bundle/node_modules/@types/node": { + "version": "18.19.64", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.64.tgz", + "integrity": "sha512-955mDqvO2vFf/oL7V3WiUtiz+BugyX8uVbaT2H8oj3+8dRyH2FLiNdowe7eNqRM7IOIZvzDH76EoAT+gwm6aIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "bundle/node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "bundle/node_modules/typescript": { + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "cli": { "name": "@gatling.io/cli", "version": "0.0.0", @@ -30,6 +90,7 @@ "esbuild-plugin-tsc": "0.4.0", "import-meta-resolve": "4.1.0", "make-fetch-happen": "14.0.3", + "node-stream-zip": "1.15.0", "readline-sync": "1.4.10" }, "bin": { @@ -1013,6 +1074,10 @@ "node": ">=18" } }, + "node_modules/@gatling.io/bundle": { + "resolved": "bundle", + "link": true + }, "node_modules/@gatling.io/cli": { "resolved": "cli", "link": true @@ -4963,6 +5028,19 @@ "dev": true, "license": "MIT" }, + "node_modules/node-stream-zip": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/node-stream-zip/-/node-stream-zip-1.15.0.tgz", + "integrity": "sha512-LN4fydt9TqhZhThkZIVQnF9cwjU3qmUH9h78Mx/K7d3VvfRqqwthLwJEUOEL0QPZ0XQmNN7be5Ggit5+4dq3Bw==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/antelle" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "license": "MIT", diff --git a/ts-simulation/package-lock.json b/ts-simulation/package-lock.json index 502eae0..812a5a4 100644 --- a/ts-simulation/package-lock.json +++ b/ts-simulation/package-lock.json @@ -32,6 +32,7 @@ "esbuild-plugin-tsc": "0.4.0", "import-meta-resolve": "4.1.0", "make-fetch-happen": "14.0.3", + "node-stream-zip": "1.15.0", "readline-sync": "1.4.10" }, "bin": { From 7fc8a778bf924f3789beef73e7d42bd17ddcdaf9 Mon Sep 17 00:00:00 2001 From: Guillaume Galy Date: Tue, 3 Dec 2024 15:29:59 +0100 Subject: [PATCH 05/18] chore: Remove unused install code for GraalVM and Coursier in the CLI --- js/cli/src/dependencies/coursier.ts | 84 ----------------------------- js/cli/src/dependencies/graalVm.ts | 74 ------------------------- 2 files changed, 158 deletions(-) delete mode 100644 js/cli/src/dependencies/coursier.ts delete mode 100644 js/cli/src/dependencies/graalVm.ts diff --git a/js/cli/src/dependencies/coursier.ts b/js/cli/src/dependencies/coursier.ts deleted file mode 100644 index 1e4838c..0000000 --- a/js/cli/src/dependencies/coursier.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { existsSync } from "fs"; -import fs from "fs/promises"; - -import { downloadFile } from "./download"; -import { logger } from "../log"; -import { versions } from "./versions"; -import { promisify } from "util"; -import { exec } from "child_process"; -import { osType } from "./os"; - -export const installCoursier = async (gatlingHomeDir: string, downloadDir: string): Promise => { - const coursierRootPath = `${gatlingHomeDir}/coursier/${versions.coursier}`; - const coursierPath = `${coursierRootPath}/cs`; - - if (!existsSync(coursierPath)) { - const jarUrl = `https://github.com/coursier/coursier/releases/download/v${versions.coursier}/coursier`; - const windowsBatUrl = `https://github.com/coursier/launchers/raw/master/coursier.bat`; - const downloadPath = `${downloadDir}/cs`; - - if (existsSync(coursierRootPath)) { - await fs.rm(coursierRootPath, { recursive: true }); - } - if (existsSync(downloadPath)) { - await fs.rm(downloadPath); - } - await fs.mkdir(coursierRootPath, { recursive: true }); - - logger.info(`Downloading Coursier ${versions.coursier} to ${downloadPath}`); - await downloadFile(jarUrl, downloadPath); - if (osType === "Windows_NT") { - await downloadFile(windowsBatUrl, `${downloadPath}.bat`); - } else { - await fs.chmod(downloadPath, 0o744); - } - - logger.info(`Installing Coursier to ${coursierPath}`); - await fs.rename(downloadPath, coursierPath); - if (osType === "Windows_NT") { - await fs.rename(`${downloadPath}.bat`, `${coursierPath}.bat`); - } - } else { - logger.info(`Coursier ${versions.coursier} already installed at ${coursierPath}`); - } - - return coursierPath; -}; - -export const resolveGatlingJsDependencies = async ( - coursierPath: string, - javaHome: string, - postmanVersion?: string -): Promise => { - const dependencies = [ - `"io.gatling.highcharts:gatling-charts-highcharts:${versions.gatling.core}"`, - `"io.gatling:gatling-jvm-to-js-adapter:${versions.gatling.jsAdapter}"`, - `"io.gatling:gatling-enterprise-plugin-commons:${versions.gatling.enterprisePluginCommons}"`, - `"org.graalvm.polyglot:js-community:${versions.graalvm.js}"` - ]; - if (postmanVersion !== undefined) { - dependencies.push(`"io.gatling:gatling-postman-jvm-to-js-adapter:${postmanVersion}"`); - } - - return await resolveDependencies(coursierPath, javaHome, ...dependencies); -}; - -export const resolveRecorderDependencies = async (coursierPath: string, javaHome: string): Promise => { - const recorderDep = `io.gatling:gatling-recorder:${versions.gatling.core}`; - return await resolveDependencies(coursierPath, javaHome, recorderDep); -}; - -const resolveDependencies = async ( - coursierPath: string, - javaHome: string, - ...dependencies: string[] -): Promise => { - const command = `"${coursierPath}" fetch --classpath ${dependencies.join(" ")}`; - - // TODO could add a timeout - logger.info(`Resolving dependencies with Coursier`); - const { stdout } = await execAsync(command, { env: { ...process.env, JAVA_HOME: javaHome } }); - return stdout; -}; - -const execAsync = promisify(exec); diff --git a/js/cli/src/dependencies/graalVm.ts b/js/cli/src/dependencies/graalVm.ts deleted file mode 100644 index 9fbab73..0000000 --- a/js/cli/src/dependencies/graalVm.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { existsSync } from "fs"; -import fs from "fs/promises"; -import decompress from "decompress"; - -import { downloadFile } from "./download"; -import { logger } from "../log"; -import { osType, osArch } from "./os"; -import { versions } from "./versions"; - -export const installGraalVm = async (gatlingHomeDir: string, downloadDir: string): Promise => { - const { os, arch, extension, homePath, binPath } = graalVmPlatformParams(); - const graalvmRootPath = `${gatlingHomeDir}/graalvm/${versions.graalvm.jdk}`; - const graalvmHomePath = `${graalvmRootPath}${homePath}`; - const graalvmJavaPath = `${graalvmHomePath}${binPath}`; - - if (!existsSync(graalvmJavaPath)) { - const url = `https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${versions.graalvm.jdk}/graalvm-community-jdk-${versions.graalvm.jdk}_${os}-${arch}_bin.${extension}`; - const downloadPath = `${downloadDir}/graalvm.${extension}`; - - if (existsSync(graalvmRootPath)) { - await fs.rm(graalvmRootPath, { recursive: true }); - } - if (existsSync(downloadPath)) { - await fs.rm(downloadPath); - } - await fs.mkdir(graalvmRootPath, { recursive: true }); - - logger.info(`Downloading GraalVM Community Edition ${versions.graalvm.jdk} to ${downloadPath}`); - await downloadFile(url, downloadPath); - - logger.info(`Unpacking GraalVM to ${graalvmRootPath}`); - await decompress(downloadPath, graalvmRootPath, { - map: (file) => { - // Remove first level of file name, because it already contains a root directory - file.path = file.path.split("/").slice(1).join("/"); - return file; - } - }); - - await fs.rm(downloadPath); - } else { - logger.info(`GraalVM Community Edition ${versions.graalvm.jdk} already installed at ${graalvmRootPath}`); - } - - return graalvmHomePath; -}; - -const graalVmPlatformParams = () => { - if (osType === "Linux") { - const os = "linux"; - const extension = "tar.gz"; - const homePath = ""; - const binPath = "/bin/java"; - if (osArch === "x64") { - return { os, arch: "x64", extension, homePath, binPath }; - } else if (osArch === "arm64") { - return { os, arch: "aarch64", extension, homePath, binPath }; - } - } else if (osType === "Darwin") { - const os = "macos"; - const extension = "tar.gz"; - const homePath = "/Contents/Home"; - const binPath = "/bin/java"; - if (osArch === "x64") { - return { os, arch: "x64", extension, homePath, binPath }; - } else if (osArch === "arm64") { - return { os, arch: "aarch64", extension, homePath, binPath }; - } - } else if (osType === "Windows_NT" && osArch === "x64") { - return { os: "windows", arch: "x64", extension: "zip", homePath: "", binPath: "/bin/java.exe" }; - } - - throw Error(`Operating system type '${osType}' with architecture '${osArch}' is not currently supported.`); -}; From d68d7cb678820c99884d94ec48bef83f9eff4895 Mon Sep 17 00:00:00 2001 From: Guillaume Galy Date: Thu, 5 Dec 2024 15:33:36 +0100 Subject: [PATCH 06/18] feat: Automatically download bundle as needed --- install-all-with-links.sh | 3 --- js/cli/src/dependencies/index.ts | 40 ++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/install-all-with-links.sh b/install-all-with-links.sh index 0a51934..2510c22 100755 --- a/install-all-with-links.sh +++ b/install-all-with-links.sh @@ -12,9 +12,6 @@ cd "$root_dir/js" npm install "$root_dir/build-js.sh" -# Install bundle -"$root_dir/build-bundle.sh" - # Install js-simulation cd "$root_dir/js-simulation" # Multiple packages MUST be linked all at once (executing 'npm link ' again will remove previous links...): diff --git a/js/cli/src/dependencies/index.ts b/js/cli/src/dependencies/index.ts index 8db19a6..a242551 100644 --- a/js/cli/src/dependencies/index.ts +++ b/js/cli/src/dependencies/index.ts @@ -1,10 +1,12 @@ +import * as fsSync from "node:fs"; import fs from "node:fs/promises"; import path from "node:path"; import StreamZip from "node-stream-zip"; +import { downloadFile } from "./download"; import { logger } from "../log"; -import { osType } from "./os"; +import { osArch, osType } from "./os"; import { versions } from "./versions"; export { versions } from "./versions"; @@ -67,11 +69,10 @@ export const resolveBundle = async (options: BundleOptions): Promise @@ -96,3 +97,34 @@ const getResolvedBundle = (bundlePath: string): ResolvedBundle => ({ graalvmHome: path.join(bundlePath, "graalvm"), jvmClasspath: path.join(bundlePath, "lib", "java", "*") }); + +const downloadAndInstallBundle = async (options: BundleOptions) => { + const tmpFolder = path.join(options.gatlingHome, "tmp"); + if (!fsSync.existsSync(tmpFolder)) { + await fs.mkdir(tmpFolder); + } + + const tmpFile = path.join(tmpFolder, "bundle-download.zip"); + if (fsSync.existsSync(tmpFile)) { + await fs.rm(tmpFile); + } + + const version = versions.gatling.jsAdapter; + const url = `https://github.com/gatling/gatling-js/releases/download/v${version}/gatling-js-bundle-${version}-${osType}-${osArch}.zip`; + try { + logger.info(`Downloading bundle file from ${url} to temporary file ${tmpFile}`); + await downloadFile(url, tmpFile); + + const resolvedBundle = await installBundleFile({ ...options, bundleFilePath: tmpFile }); + + logger.info(`Deleting temporary file ${tmpFile}`); + await fs.rm(tmpFile); + + return resolvedBundle; + } catch (e) { + logger.error(`Failed to automatically download and install the Gatling dependency bundle. You can try to: +1. Make sure you have access to https://github.com/gatling/gatling-js/releases/; and if you connect to the Internet through a proxy, make sure it is configured in your NPM configuration file (.npmrc). +2. Alternatively, you can try manually downloading the file from ${url}, and install it with the command 'npx gatling install '.`); + throw e; + } +}; From af59d452fa02ad514845be3217b88299d5f67b16 Mon Sep 17 00:00:00 2001 From: Guillaume Galy Date: Thu, 5 Dec 2024 16:51:17 +0100 Subject: [PATCH 07/18] chore: Update and clean up dependencies --- js-simulation/package-lock.json | 481 -------------------------------- js/cli/package.json | 2 - js/package-lock.json | 76 ++++- jvm/build.sbt | 6 +- ts-simulation/package-lock.json | 481 -------------------------------- 5 files changed, 76 insertions(+), 970 deletions(-) diff --git a/js-simulation/package-lock.json b/js-simulation/package-lock.json index eaf03d4..157de83 100644 --- a/js-simulation/package-lock.json +++ b/js-simulation/package-lock.json @@ -26,7 +26,6 @@ "@jspm/core": "2.1.0", "archiver": "7.0.1", "commander": "12.1.0", - "decompress": "4.2.1", "esbuild": "0.24.0", "esbuild-plugin-tsc": "0.4.0", "import-meta-resolve": "4.1.0", @@ -39,7 +38,6 @@ }, "devDependencies": { "@types/archiver": "6.0.3", - "@types/decompress": "4.2.7", "@types/make-fetch-happen": "10.0.4", "@types/node": "18.19.67", "@types/readline-sync": "1.4.8", @@ -88,14 +86,6 @@ "node": ">=14" } }, - "../tmp/cli/package/node_modules/@types/decompress": { - "version": "4.2.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, "../tmp/cli/package/node_modules/@types/node": { "version": "20.11.25", "dev": true, @@ -131,34 +121,6 @@ "dev": true, "license": "MIT" }, - "../tmp/cli/package/node_modules/base64-js": { - "version": "1.5.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "../tmp/cli/package/node_modules/bl": { - "version": "1.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, "../tmp/cli/package/node_modules/brace-expansion": { "version": "2.0.1", "dev": true, @@ -167,56 +129,6 @@ "balanced-match": "^1.0.0" } }, - "../tmp/cli/package/node_modules/buffer": { - "version": "5.7.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "../tmp/cli/package/node_modules/buffer-alloc": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" - } - }, - "../tmp/cli/package/node_modules/buffer-alloc-unsafe": { - "version": "1.1.0", - "dev": true, - "license": "MIT" - }, - "../tmp/cli/package/node_modules/buffer-crc32": { - "version": "0.2.13", - "dev": true, - "license": "MIT", - "engines": { - "node": "*" - } - }, - "../tmp/cli/package/node_modules/buffer-fill": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/color-convert": { "version": "2.0.1", "dev": true, @@ -241,11 +153,6 @@ "node": ">=18" } }, - "../tmp/cli/package/node_modules/core-util-is": { - "version": "1.0.3", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/cross-spawn": { "version": "7.0.3", "dev": true, @@ -259,95 +166,6 @@ "node": ">= 8" } }, - "../tmp/cli/package/node_modules/decompress": { - "version": "4.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "decompress-tar": "^4.0.0", - "decompress-tarbz2": "^4.0.0", - "decompress-targz": "^4.0.0", - "decompress-unzip": "^4.0.1", - "graceful-fs": "^4.1.10", - "make-dir": "^1.0.0", - "pify": "^2.3.0", - "strip-dirs": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "../tmp/cli/package/node_modules/decompress-tar": { - "version": "4.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "file-type": "^5.2.0", - "is-stream": "^1.1.0", - "tar-stream": "^1.5.2" - }, - "engines": { - "node": ">=4" - } - }, - "../tmp/cli/package/node_modules/decompress-tarbz2": { - "version": "4.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "decompress-tar": "^4.1.0", - "file-type": "^6.1.0", - "is-stream": "^1.1.0", - "seek-bzip": "^1.0.5", - "unbzip2-stream": "^1.0.9" - }, - "engines": { - "node": ">=4" - } - }, - "../tmp/cli/package/node_modules/decompress-tarbz2/node_modules/file-type": { - "version": "6.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "../tmp/cli/package/node_modules/decompress-targz": { - "version": "4.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "decompress-tar": "^4.1.1", - "file-type": "^5.2.0", - "is-stream": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "../tmp/cli/package/node_modules/decompress-unzip": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "file-type": "^3.8.0", - "get-stream": "^2.2.0", - "pify": "^2.3.0", - "yauzl": "^2.4.2" - }, - "engines": { - "node": ">=4" - } - }, - "../tmp/cli/package/node_modules/decompress-unzip/node_modules/file-type": { - "version": "3.9.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "../tmp/cli/package/node_modules/eastasianwidth": { "version": "0.2.0", "dev": true, @@ -358,14 +176,6 @@ "dev": true, "license": "MIT" }, - "../tmp/cli/package/node_modules/end-of-stream": { - "version": "1.4.4", - "dev": true, - "license": "MIT", - "dependencies": { - "once": "^1.4.0" - } - }, "../tmp/cli/package/node_modules/esbuild": { "version": "0.20.1", "dev": true, @@ -414,22 +224,6 @@ "typescript": "^4.0.0 || ^5.0.0" } }, - "../tmp/cli/package/node_modules/fd-slicer": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pend": "~1.2.0" - } - }, - "../tmp/cli/package/node_modules/file-type": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "../tmp/cli/package/node_modules/foreground-child": { "version": "3.1.1", "dev": true, @@ -445,23 +239,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "../tmp/cli/package/node_modules/fs-constants": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "../tmp/cli/package/node_modules/get-stream": { - "version": "2.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "object-assign": "^4.0.1", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "../tmp/cli/package/node_modules/glob": { "version": "10.3.12", "dev": true, @@ -483,35 +260,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "../tmp/cli/package/node_modules/graceful-fs": { - "version": "4.2.11", - "dev": true, - "license": "ISC" - }, - "../tmp/cli/package/node_modules/ieee754": { - "version": "1.2.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "BSD-3-Clause" - }, - "../tmp/cli/package/node_modules/inherits": { - "version": "2.0.4", - "dev": true, - "license": "ISC" - }, "../tmp/cli/package/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "dev": true, @@ -520,24 +268,6 @@ "node": ">=8" } }, - "../tmp/cli/package/node_modules/is-natural-number": { - "version": "4.0.1", - "dev": true, - "license": "MIT" - }, - "../tmp/cli/package/node_modules/is-stream": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "../tmp/cli/package/node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/isexe": { "version": "2.0.0", "dev": true, @@ -568,25 +298,6 @@ "node": "14 || >=16.14" } }, - "../tmp/cli/package/node_modules/make-dir": { - "version": "1.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pify": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "../tmp/cli/package/node_modules/make-dir/node_modules/pify": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "../tmp/cli/package/node_modules/minimatch": { "version": "9.0.4", "dev": true, @@ -609,22 +320,6 @@ "node": ">=16 || 14 >=14.17" } }, - "../tmp/cli/package/node_modules/object-assign": { - "version": "4.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "../tmp/cli/package/node_modules/once": { - "version": "1.4.0", - "dev": true, - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, "../tmp/cli/package/node_modules/path-key": { "version": "3.1.1", "dev": true, @@ -648,38 +343,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "../tmp/cli/package/node_modules/pend": { - "version": "1.2.0", - "dev": true, - "license": "MIT" - }, - "../tmp/cli/package/node_modules/pify": { - "version": "2.3.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "../tmp/cli/package/node_modules/pinkie": { - "version": "2.0.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "../tmp/cli/package/node_modules/pinkie-promise": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "pinkie": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "../tmp/cli/package/node_modules/prettier": { "version": "3.2.5", "dev": true, @@ -694,30 +357,6 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "../tmp/cli/package/node_modules/process-nextick-args": { - "version": "2.0.1", - "dev": true, - "license": "MIT" - }, - "../tmp/cli/package/node_modules/readable-stream": { - "version": "2.3.8", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "../tmp/cli/package/node_modules/readable-stream/node_modules/safe-buffer": { - "version": "5.1.2", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/rimraf": { "version": "5.0.5", "dev": true, @@ -735,42 +374,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "../tmp/cli/package/node_modules/safe-buffer": { - "version": "5.2.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "../tmp/cli/package/node_modules/seek-bzip": { - "version": "1.0.6", - "dev": true, - "license": "MIT", - "dependencies": { - "commander": "^2.8.1" - }, - "bin": { - "seek-bunzip": "bin/seek-bunzip", - "seek-table": "bin/seek-bzip-table" - } - }, - "../tmp/cli/package/node_modules/seek-bzip/node_modules/commander": { - "version": "2.20.3", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/shebang-command": { "version": "2.0.0", "dev": true, @@ -801,19 +404,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "../tmp/cli/package/node_modules/string_decoder": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "../tmp/cli/package/node_modules/string_decoder/node_modules/safe-buffer": { - "version": "5.1.2", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/string-width": { "version": "5.1.2", "dev": true, @@ -910,41 +500,6 @@ "node": ">=10" } }, - "../tmp/cli/package/node_modules/strip-dirs": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-natural-number": "^4.0.1" - } - }, - "../tmp/cli/package/node_modules/tar-stream": { - "version": "1.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "bl": "^1.0.0", - "buffer-alloc": "^1.2.0", - "end-of-stream": "^1.0.0", - "fs-constants": "^1.0.0", - "readable-stream": "^2.3.0", - "to-buffer": "^1.1.1", - "xtend": "^4.0.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "../tmp/cli/package/node_modules/through": { - "version": "2.3.8", - "dev": true, - "license": "MIT" - }, - "../tmp/cli/package/node_modules/to-buffer": { - "version": "1.1.1", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/typescript": { "version": "5.4.2", "dev": true, @@ -957,25 +512,11 @@ "node": ">=14.17" } }, - "../tmp/cli/package/node_modules/unbzip2-stream": { - "version": "1.4.3", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer": "^5.2.1", - "through": "^2.3.8" - } - }, "../tmp/cli/package/node_modules/undici-types": { "version": "5.26.5", "dev": true, "license": "MIT" }, - "../tmp/cli/package/node_modules/util-deprecate": { - "version": "1.0.2", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/which": { "version": "2.0.2", "dev": true, @@ -1074,28 +615,6 @@ "node": ">=8" } }, - "../tmp/cli/package/node_modules/wrappy": { - "version": "1.0.2", - "dev": true, - "license": "ISC" - }, - "../tmp/cli/package/node_modules/xtend": { - "version": "4.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4" - } - }, - "../tmp/cli/package/node_modules/yauzl": { - "version": "2.10.0", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - }, "../tmp/core/package": { "name": "@gatling.io/core", "version": "0.0.0", diff --git a/js/cli/package.json b/js/cli/package.json index 4dc72a5..0819c13 100644 --- a/js/cli/package.json +++ b/js/cli/package.json @@ -27,7 +27,6 @@ "archiver": "7.0.1", "node-stream-zip": "1.15.0", "commander": "12.1.0", - "decompress": "4.2.1", "esbuild": "0.24.0", "esbuild-plugin-tsc": "0.4.0", "import-meta-resolve": "4.1.0", @@ -36,7 +35,6 @@ }, "devDependencies": { "@types/archiver": "6.0.3", - "@types/decompress": "4.2.7", "@types/make-fetch-happen": "10.0.4", "@types/node": "18.19.67", "@types/readline-sync": "1.4.8", diff --git a/js/package-lock.json b/js/package-lock.json index b2d0efe..2df77d1 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -85,7 +85,6 @@ "@jspm/core": "2.1.0", "archiver": "7.0.1", "commander": "12.1.0", - "decompress": "4.2.1", "esbuild": "0.24.0", "esbuild-plugin-tsc": "0.4.0", "import-meta-resolve": "4.1.0", @@ -98,7 +97,6 @@ }, "devDependencies": { "@types/archiver": "6.0.3", - "@types/decompress": "4.2.7", "@types/make-fetch-happen": "10.0.4", "@types/node": "18.19.67", "@types/readline-sync": "1.4.8", @@ -1667,6 +1665,8 @@ }, "node_modules/@types/decompress": { "version": "4.2.7", + "resolved": "https://registry.npmjs.org/@types/decompress/-/decompress-4.2.7.tgz", + "integrity": "sha512-9z+8yjKr5Wn73Pt17/ldnmQToaFHZxK0N1GHysuk/JIPT8RIdQeoInM01wWPgypRcvb6VH1drjuFpQ4zmY437g==", "dev": true, "license": "MIT", "dependencies": { @@ -2267,6 +2267,8 @@ }, "node_modules/bl": { "version": "1.2.3", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", + "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==", "license": "MIT", "dependencies": { "readable-stream": "^2.3.5", @@ -2345,6 +2347,8 @@ }, "node_modules/buffer": { "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", "funding": [ { "type": "github", @@ -2367,6 +2371,8 @@ }, "node_modules/buffer-alloc": { "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", "license": "MIT", "dependencies": { "buffer-alloc-unsafe": "^1.1.0", @@ -2375,10 +2381,14 @@ }, "node_modules/buffer-alloc-unsafe": { "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", "license": "MIT" }, "node_modules/buffer-crc32": { "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", "license": "MIT", "engines": { "node": "*" @@ -2386,6 +2396,8 @@ }, "node_modules/buffer-fill": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==", "license": "MIT" }, "node_modules/buffer-from": { @@ -2955,6 +2967,8 @@ }, "node_modules/decompress": { "version": "4.2.1", + "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz", + "integrity": "sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ==", "license": "MIT", "dependencies": { "decompress-tar": "^4.0.0", @@ -2972,6 +2986,8 @@ }, "node_modules/decompress-tar": { "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz", + "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", "license": "MIT", "dependencies": { "file-type": "^5.2.0", @@ -2984,6 +3000,8 @@ }, "node_modules/decompress-tarbz2": { "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz", + "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", "license": "MIT", "dependencies": { "decompress-tar": "^4.1.0", @@ -2998,6 +3016,8 @@ }, "node_modules/decompress-tarbz2/node_modules/file-type": { "version": "6.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", + "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==", "license": "MIT", "engines": { "node": ">=4" @@ -3005,6 +3025,8 @@ }, "node_modules/decompress-targz": { "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz", + "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", "license": "MIT", "dependencies": { "decompress-tar": "^4.1.1", @@ -3017,6 +3039,8 @@ }, "node_modules/decompress-unzip": { "version": "4.0.1", + "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz", + "integrity": "sha512-1fqeluvxgnn86MOh66u8FjbtJpAFv5wgCT9Iw8rcBqQcCo5tO8eiJw7NNTrvt9n4CRBVq7CstiS922oPgyGLrw==", "license": "MIT", "dependencies": { "file-type": "^3.8.0", @@ -3030,6 +3054,8 @@ }, "node_modules/decompress-unzip/node_modules/file-type": { "version": "3.9.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", + "integrity": "sha512-RLoqTXE8/vPmMuTI88DAzhMYC99I8BWv7zYP4A1puo5HIjEJ5EX48ighy4ZyKMG9EDXxBgW6e++cn7d1xuFghA==", "license": "MIT", "engines": { "node": ">=0.10.0" @@ -3147,6 +3173,8 @@ }, "node_modules/end-of-stream": { "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", "license": "MIT", "dependencies": { "once": "^1.4.0" @@ -3345,6 +3373,8 @@ }, "node_modules/fd-slicer": { "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", "license": "MIT", "dependencies": { "pend": "~1.2.0" @@ -3352,6 +3382,8 @@ }, "node_modules/file-type": { "version": "5.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", + "integrity": "sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ==", "license": "MIT", "engines": { "node": ">=4" @@ -3460,6 +3492,8 @@ }, "node_modules/fs-constants": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", "license": "MIT" }, "node_modules/fs-minipass": { @@ -3525,6 +3559,8 @@ }, "node_modules/get-stream": { "version": "2.3.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", + "integrity": "sha512-AUGhbbemXxrZJRD5cDvKtQxLuYaIbNtDTK8YqupCI393Q2KSTreEsLUN3ZxAWFGiKTzL6nKuzfcIvieflUX9qA==", "license": "MIT", "dependencies": { "object-assign": "^4.0.1", @@ -3760,6 +3796,8 @@ }, "node_modules/is-natural-number": { "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", + "integrity": "sha512-Y4LTamMe0DDQIIAlaer9eKebAlDSV6huy+TWhJVPlzZh2o4tRP5SQWFlLn5N0To4mDD22/qdOq+veo1cSISLgQ==", "license": "MIT" }, "node_modules/is-number": { @@ -3772,6 +3810,8 @@ }, "node_modules/is-stream": { "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", "license": "MIT", "engines": { "node": ">=0.10.0" @@ -4657,6 +4697,8 @@ }, "node_modules/make-dir": { "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", "license": "MIT", "dependencies": { "pify": "^3.0.0" @@ -4667,6 +4709,8 @@ }, "node_modules/make-dir/node_modules/pify": { "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", "license": "MIT", "engines": { "node": ">=4" @@ -5061,6 +5105,8 @@ }, "node_modules/object-assign": { "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", "license": "MIT", "engines": { "node": ">=0.10.0" @@ -5220,6 +5266,8 @@ }, "node_modules/pend": { "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", "license": "MIT" }, "node_modules/picocolors": { @@ -5240,6 +5288,8 @@ }, "node_modules/pify": { "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", "license": "MIT", "engines": { "node": ">=0.10.0" @@ -5247,6 +5297,8 @@ }, "node_modules/pinkie": { "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", "license": "MIT", "engines": { "node": ">=0.10.0" @@ -5254,6 +5306,8 @@ }, "node_modules/pinkie-promise": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", "license": "MIT", "dependencies": { "pinkie": "^2.0.0" @@ -5650,6 +5704,8 @@ }, "node_modules/seek-bzip": { "version": "1.0.6", + "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.6.tgz", + "integrity": "sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==", "license": "MIT", "dependencies": { "commander": "^2.8.1" @@ -5661,6 +5717,8 @@ }, "node_modules/seek-bzip/node_modules/commander": { "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "license": "MIT" }, "node_modules/semver": { @@ -5893,6 +5951,8 @@ }, "node_modules/strip-dirs": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", + "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", "license": "MIT", "dependencies": { "is-natural-number": "^4.0.1" @@ -5988,6 +6048,8 @@ }, "node_modules/tar-stream": { "version": "1.6.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", + "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", "license": "MIT", "dependencies": { "bl": "^1.0.0", @@ -6034,6 +6096,8 @@ }, "node_modules/through": { "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "license": "MIT" }, "node_modules/tmpl": { @@ -6043,6 +6107,8 @@ }, "node_modules/to-buffer": { "version": "1.1.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", + "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==", "license": "MIT" }, "node_modules/to-fast-properties": { @@ -6226,6 +6292,8 @@ }, "node_modules/unbzip2-stream": { "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", "license": "MIT", "dependencies": { "buffer": "^5.2.1", @@ -6417,6 +6485,8 @@ }, "node_modules/xtend": { "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "license": "MIT", "engines": { "node": ">=0.4" @@ -6462,6 +6532,8 @@ }, "node_modules/yauzl": { "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", "license": "MIT", "dependencies": { "buffer-crc32": "~0.2.3", diff --git a/jvm/build.sbt b/jvm/build.sbt index cc2e233..e9ece17 100644 --- a/jvm/build.sbt +++ b/jvm/build.sbt @@ -14,13 +14,12 @@ Global / gatlingDevelopers := Seq( ) val compilerRelease = 21 -val graalvmJdkVersion = "23.0.0" +val graalvmJdkVersion = "23.0.1" val graalvmJsVersion = "24.1.1" -val coursierVersion = "2.1.12" val gatlingVersion = "3.13.1" // bit weird cause this is not a dependency of this project -val gatlingEnterpriseComponentPluginVersion = "1.9.8" +val gatlingEnterpriseComponentPluginVersion = "1.11.0" lazy val root = (project in file(".")) .aggregate(adapter, java2ts) @@ -57,7 +56,6 @@ lazy val adapter = (project in file("adapter")) | java: { | compilerRelease: "$compilerRelease" | }, - | coursier: "$coursierVersion", | gatling: { | core: "$gatlingVersion", | enterprisePluginCommons: "$gatlingEnterpriseComponentPluginVersion", diff --git a/ts-simulation/package-lock.json b/ts-simulation/package-lock.json index 812a5a4..609b224 100644 --- a/ts-simulation/package-lock.json +++ b/ts-simulation/package-lock.json @@ -27,7 +27,6 @@ "@jspm/core": "2.1.0", "archiver": "7.0.1", "commander": "12.1.0", - "decompress": "4.2.1", "esbuild": "0.24.0", "esbuild-plugin-tsc": "0.4.0", "import-meta-resolve": "4.1.0", @@ -40,7 +39,6 @@ }, "devDependencies": { "@types/archiver": "6.0.3", - "@types/decompress": "4.2.7", "@types/make-fetch-happen": "10.0.4", "@types/node": "18.19.67", "@types/readline-sync": "1.4.8", @@ -89,14 +87,6 @@ "node": ">=14" } }, - "../tmp/cli/package/node_modules/@types/decompress": { - "version": "4.2.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, "../tmp/cli/package/node_modules/@types/node": { "version": "20.11.25", "dev": true, @@ -132,34 +122,6 @@ "dev": true, "license": "MIT" }, - "../tmp/cli/package/node_modules/base64-js": { - "version": "1.5.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "../tmp/cli/package/node_modules/bl": { - "version": "1.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, "../tmp/cli/package/node_modules/brace-expansion": { "version": "2.0.1", "dev": true, @@ -168,56 +130,6 @@ "balanced-match": "^1.0.0" } }, - "../tmp/cli/package/node_modules/buffer": { - "version": "5.7.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "../tmp/cli/package/node_modules/buffer-alloc": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" - } - }, - "../tmp/cli/package/node_modules/buffer-alloc-unsafe": { - "version": "1.1.0", - "dev": true, - "license": "MIT" - }, - "../tmp/cli/package/node_modules/buffer-crc32": { - "version": "0.2.13", - "dev": true, - "license": "MIT", - "engines": { - "node": "*" - } - }, - "../tmp/cli/package/node_modules/buffer-fill": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/color-convert": { "version": "2.0.1", "dev": true, @@ -242,11 +154,6 @@ "node": ">=18" } }, - "../tmp/cli/package/node_modules/core-util-is": { - "version": "1.0.3", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/cross-spawn": { "version": "7.0.3", "dev": true, @@ -260,95 +167,6 @@ "node": ">= 8" } }, - "../tmp/cli/package/node_modules/decompress": { - "version": "4.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "decompress-tar": "^4.0.0", - "decompress-tarbz2": "^4.0.0", - "decompress-targz": "^4.0.0", - "decompress-unzip": "^4.0.1", - "graceful-fs": "^4.1.10", - "make-dir": "^1.0.0", - "pify": "^2.3.0", - "strip-dirs": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "../tmp/cli/package/node_modules/decompress-tar": { - "version": "4.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "file-type": "^5.2.0", - "is-stream": "^1.1.0", - "tar-stream": "^1.5.2" - }, - "engines": { - "node": ">=4" - } - }, - "../tmp/cli/package/node_modules/decompress-tarbz2": { - "version": "4.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "decompress-tar": "^4.1.0", - "file-type": "^6.1.0", - "is-stream": "^1.1.0", - "seek-bzip": "^1.0.5", - "unbzip2-stream": "^1.0.9" - }, - "engines": { - "node": ">=4" - } - }, - "../tmp/cli/package/node_modules/decompress-tarbz2/node_modules/file-type": { - "version": "6.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "../tmp/cli/package/node_modules/decompress-targz": { - "version": "4.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "decompress-tar": "^4.1.1", - "file-type": "^5.2.0", - "is-stream": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "../tmp/cli/package/node_modules/decompress-unzip": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "file-type": "^3.8.0", - "get-stream": "^2.2.0", - "pify": "^2.3.0", - "yauzl": "^2.4.2" - }, - "engines": { - "node": ">=4" - } - }, - "../tmp/cli/package/node_modules/decompress-unzip/node_modules/file-type": { - "version": "3.9.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "../tmp/cli/package/node_modules/eastasianwidth": { "version": "0.2.0", "dev": true, @@ -359,14 +177,6 @@ "dev": true, "license": "MIT" }, - "../tmp/cli/package/node_modules/end-of-stream": { - "version": "1.4.4", - "dev": true, - "license": "MIT", - "dependencies": { - "once": "^1.4.0" - } - }, "../tmp/cli/package/node_modules/esbuild": { "version": "0.20.1", "dev": true, @@ -415,22 +225,6 @@ "typescript": "^4.0.0 || ^5.0.0" } }, - "../tmp/cli/package/node_modules/fd-slicer": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pend": "~1.2.0" - } - }, - "../tmp/cli/package/node_modules/file-type": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "../tmp/cli/package/node_modules/foreground-child": { "version": "3.1.1", "dev": true, @@ -446,23 +240,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "../tmp/cli/package/node_modules/fs-constants": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "../tmp/cli/package/node_modules/get-stream": { - "version": "2.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "object-assign": "^4.0.1", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "../tmp/cli/package/node_modules/glob": { "version": "10.3.12", "dev": true, @@ -484,35 +261,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "../tmp/cli/package/node_modules/graceful-fs": { - "version": "4.2.11", - "dev": true, - "license": "ISC" - }, - "../tmp/cli/package/node_modules/ieee754": { - "version": "1.2.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "BSD-3-Clause" - }, - "../tmp/cli/package/node_modules/inherits": { - "version": "2.0.4", - "dev": true, - "license": "ISC" - }, "../tmp/cli/package/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "dev": true, @@ -521,24 +269,6 @@ "node": ">=8" } }, - "../tmp/cli/package/node_modules/is-natural-number": { - "version": "4.0.1", - "dev": true, - "license": "MIT" - }, - "../tmp/cli/package/node_modules/is-stream": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "../tmp/cli/package/node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/isexe": { "version": "2.0.0", "dev": true, @@ -569,25 +299,6 @@ "node": "14 || >=16.14" } }, - "../tmp/cli/package/node_modules/make-dir": { - "version": "1.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pify": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "../tmp/cli/package/node_modules/make-dir/node_modules/pify": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "../tmp/cli/package/node_modules/minimatch": { "version": "9.0.4", "dev": true, @@ -610,22 +321,6 @@ "node": ">=16 || 14 >=14.17" } }, - "../tmp/cli/package/node_modules/object-assign": { - "version": "4.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "../tmp/cli/package/node_modules/once": { - "version": "1.4.0", - "dev": true, - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, "../tmp/cli/package/node_modules/path-key": { "version": "3.1.1", "dev": true, @@ -649,38 +344,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "../tmp/cli/package/node_modules/pend": { - "version": "1.2.0", - "dev": true, - "license": "MIT" - }, - "../tmp/cli/package/node_modules/pify": { - "version": "2.3.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "../tmp/cli/package/node_modules/pinkie": { - "version": "2.0.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "../tmp/cli/package/node_modules/pinkie-promise": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "pinkie": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "../tmp/cli/package/node_modules/prettier": { "version": "3.2.5", "dev": true, @@ -695,30 +358,6 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "../tmp/cli/package/node_modules/process-nextick-args": { - "version": "2.0.1", - "dev": true, - "license": "MIT" - }, - "../tmp/cli/package/node_modules/readable-stream": { - "version": "2.3.8", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "../tmp/cli/package/node_modules/readable-stream/node_modules/safe-buffer": { - "version": "5.1.2", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/rimraf": { "version": "5.0.5", "dev": true, @@ -736,42 +375,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "../tmp/cli/package/node_modules/safe-buffer": { - "version": "5.2.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "../tmp/cli/package/node_modules/seek-bzip": { - "version": "1.0.6", - "dev": true, - "license": "MIT", - "dependencies": { - "commander": "^2.8.1" - }, - "bin": { - "seek-bunzip": "bin/seek-bunzip", - "seek-table": "bin/seek-bzip-table" - } - }, - "../tmp/cli/package/node_modules/seek-bzip/node_modules/commander": { - "version": "2.20.3", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/shebang-command": { "version": "2.0.0", "dev": true, @@ -802,19 +405,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "../tmp/cli/package/node_modules/string_decoder": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "../tmp/cli/package/node_modules/string_decoder/node_modules/safe-buffer": { - "version": "5.1.2", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/string-width": { "version": "5.1.2", "dev": true, @@ -911,41 +501,6 @@ "node": ">=10" } }, - "../tmp/cli/package/node_modules/strip-dirs": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-natural-number": "^4.0.1" - } - }, - "../tmp/cli/package/node_modules/tar-stream": { - "version": "1.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "bl": "^1.0.0", - "buffer-alloc": "^1.2.0", - "end-of-stream": "^1.0.0", - "fs-constants": "^1.0.0", - "readable-stream": "^2.3.0", - "to-buffer": "^1.1.1", - "xtend": "^4.0.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "../tmp/cli/package/node_modules/through": { - "version": "2.3.8", - "dev": true, - "license": "MIT" - }, - "../tmp/cli/package/node_modules/to-buffer": { - "version": "1.1.1", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/typescript": { "version": "5.4.2", "dev": true, @@ -958,25 +513,11 @@ "node": ">=14.17" } }, - "../tmp/cli/package/node_modules/unbzip2-stream": { - "version": "1.4.3", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer": "^5.2.1", - "through": "^2.3.8" - } - }, "../tmp/cli/package/node_modules/undici-types": { "version": "5.26.5", "dev": true, "license": "MIT" }, - "../tmp/cli/package/node_modules/util-deprecate": { - "version": "1.0.2", - "dev": true, - "license": "MIT" - }, "../tmp/cli/package/node_modules/which": { "version": "2.0.2", "dev": true, @@ -1075,28 +616,6 @@ "node": ">=8" } }, - "../tmp/cli/package/node_modules/wrappy": { - "version": "1.0.2", - "dev": true, - "license": "ISC" - }, - "../tmp/cli/package/node_modules/xtend": { - "version": "4.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4" - } - }, - "../tmp/cli/package/node_modules/yauzl": { - "version": "2.10.0", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - }, "../tmp/core/package": { "name": "@gatling.io/core", "version": "0.0.0", From 74f26c66b6189dc293d910331ea4359c9cb963b4 Mon Sep 17 00:00:00 2001 From: Guillaume Galy Date: Wed, 4 Dec 2024 11:37:44 +0100 Subject: [PATCH 08/18] feat: Create and distribute Gatling JS bundle, close RNG-53 Co-authored-by: guilgaly --- .../build-and-upload-bundle/action.yml | 49 ++++ .github/workflows/release.yml | 242 +++++++++++++++++- 2 files changed, 278 insertions(+), 13 deletions(-) create mode 100644 .github/actions/build-and-upload-bundle/action.yml diff --git a/.github/actions/build-and-upload-bundle/action.yml b/.github/actions/build-and-upload-bundle/action.yml new file mode 100644 index 0000000..37e05a2 --- /dev/null +++ b/.github/actions/build-and-upload-bundle/action.yml @@ -0,0 +1,49 @@ +name: "Build and upload bundle" +description: "Build bundle (GraalVM + JVM dependencies) and upload it to a GitHub release" +inputs: + version: + description: "Gatling JS version" + required: true + upload-url: + description: "GitHub release upload URL" + required: true + os-type: + description: "Linux|Darwin|Windows_NT" + required: true + os-arch: + description: "x64|arm64" + required: true + github-token: + description: "Token used to upload file to the GitHub release" + required: true + +runs: + using: "composite" + steps: + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Build bundle + shell: bash + working-directory: ./js + run: | + echo "architecture: $(arch)" + npm ci + npm version "${{ inputs.version }}" + npm run generate --workspace=bundle + upload_url=$(echo "${{ inputs.upload_url }}" | sed 's/{[^}]*}//') + echo "upload_url=$upload_url" + curl --location \ + --silent \ + --show-error \ + --connect-timeout 10 \ + --max-time 300 \ + --request POST \ + --header "Accept: application/vnd.github+json" \ + --header "Authorization: Bearer ${{ inputs.github-token }}" \ + --header "Content-Type: application/octet-stream" \ + --header "X-GitHub-Api-Version: 2022-11-28" \ + "${upload_url}?name=gatling-js-bundle-${{ inputs.version }}-${{ inputs.os-type }}-${{ inputs.os-arch }}.zip" \ + --data-binary "@bundle/tmp/gatling-js-bundle-${{ inputs.version }}-${{ inputs.os-type }}-${{ inputs.os-arch }}.zip" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9ce609f..3abdcef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ on: permissions: id-token: write - contents: read + contents: write defaults: run: @@ -21,6 +21,8 @@ jobs: env: JAVA_OPTS: "-Xmx4G" SBT_OPTS: "-Dsbt.ci=true" + outputs: + version: ${{ steps.version.outputs.version }} steps: - name: Checkout uses: actions/checkout@v4 @@ -48,39 +50,39 @@ jobs: run: | sbt "project gatling-jvm-to-js-adapter" "release with-defaults" + - name: Setup version + id: version + run: | + version="$(cat jvm/adapter/target/release-info)" + echo "version=$version" + echo "version=$version" >> $GITHUB_OUTPUT + - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: gatling-js-workdir + name: release-jvm-workdir path: . - retention-days: 1 + retention-days: 7 release-js: name: Release JS needs: release-jvm runs-on: ubuntu-latest + timeout-minutes: 10 environment: name: npm url: https://www.npmjs.com/org/gatling.io - timeout-minutes: 10 steps: - name: Download artifact uses: actions/download-artifact@v4 with: - name: gatling-js-workdir + name: release-jvm-workdir - name: Setup Node uses: actions/setup-node@v4 with: node-version: 20 - - name: Setup version - id: version - run: | - version="$(cat jvm/adapter/target/release-info)" - echo "version=$version" - echo "version=$version" >> $GITHUB_OUTPUT - - name: Deploy JS packages env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -88,9 +90,223 @@ jobs: run: | echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc npm ci - npm version "${{ steps.version.outputs.version }}" + npm version "${{ needs.release-jvm.outputs.version }}" npm run build --workspaces for pkg in "cli" "jvm-types" "core" "http"; do cp ../LICENSE "./$pkg/LICENSE" npm publish --access public "--workspace=@gatling.io/$pkg" done + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: release-js-workdir + path: . + retention-days: 7 + + create-github-release: + name: Create GitHub release (draft) + needs: release-js + runs-on: ubuntu-latest + timeout-minutes: 2 + environment: + name: GitHub release (draft) + url: ${{ steps.release.outputs.html_url }} + outputs: + prerelease: ${{ steps.release.outputs.prerelease }} + upload_url: ${{ steps.release.outputs.upload_url }} + steps: + - name: Create GitHub release (draft) + id: release + run: | + version="${{ needs.release-jvm.outputs.version }}" + if [[ "$version" =~ -M[0-9]+$ ]]; then + prerelease=true + else + prerelease=false + fi + echo "prerelease=$prerelease" + echo "prerelease=$prerelease" >> $GITHUB_OUTPUT + releases_url=$(echo "${{ github.event.repository.releases_url }}" | sed 's/{\/id}//') + response=$(curl \ + --location \ + --silent \ + --show-error \ + --request POST \ + --header "Accept: application/vnd.github+json" \ + --header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + --header "X-GitHub-Api-Version: 2022-11-28" \ + "$releases_url" \ + --data @- <> $GITHUB_OUTPUT + upload_url=$(echo "$response" | jq --raw-output ".upload_url") + echo "upload_url=$upload_url" + echo "upload_url=$upload_url" >> $GITHUB_OUTPUT + + build-linux-x64: + name: Build bundle for Linux x64 + needs: + - release-jvm + - create-github-release + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: release-js-workdir + + - name: Build and upload bundle + uses: ./.github/actions/build-and-upload-bundle + with: + version: ${{ needs.release-jvm.outputs.version }} + upload-url: ${{ needs.create-github-release.outputs.upload_url }} + os-type: Linux + os-arch: x64 + github-token: ${{ secrets.GITHUB_TOKEN }} + + build-linux-arm64: + name: Build bundle for Linux x64 + needs: + - release-jvm + - create-github-release + runs-on: ubuntu-24-arm-2-cores + timeout-minutes: 5 + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: release-js-workdir + + - name: Build and upload bundle + uses: ./.github/actions/build-and-upload-bundle + with: + version: ${{ needs.release-jvm.outputs.version }} + upload-url: ${{ needs.create-github-release.outputs.upload_url }} + os-type: Linux + os-arch: arm64 + github-token: ${{ secrets.GITHUB_TOKEN }} + + build-macos-x64: + name: Build bundle for macOS x64 + needs: + - release-jvm + - create-github-release + runs-on: macos-13 + timeout-minutes: 5 + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: release-js-workdir + + - name: Build and upload bundle + uses: ./.github/actions/build-and-upload-bundle + with: + version: ${{ needs.release-jvm.outputs.version }} + upload-url: ${{ needs.create-github-release.outputs.upload_url }} + os-type: Darwin + os-arch: x64 + github-token: ${{ secrets.GITHUB_TOKEN }} + + build-macos-arm64: + name: Build bundle for macOS ARM64 + needs: + - release-jvm + - create-github-release + runs-on: macos-14 + timeout-minutes: 5 + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: release-js-workdir + + - name: Build and upload bundle + uses: ./.github/actions/build-and-upload-bundle + with: + version: ${{ needs.release-jvm.outputs.version }} + upload-url: ${{ needs.create-github-release.outputs.upload_url }} + os-type: Darwin + os-arch: arm64 + github-token: ${{ secrets.GITHUB_TOKEN }} + + build-windows-x64: + name: Build bundle for Windows x64 + needs: + - release-jvm + - create-github-release + runs-on: windows-latest + timeout-minutes: 5 + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: release-js-workdir + + - name: Build and upload bundle + uses: ./.github/actions/build-and-upload-bundle + with: + version: ${{ needs.release-jvm.outputs.version }} + upload-url: ${{ needs.create-github-release.outputs.upload_url }} + os-type: Windows_NT + os-arch: x64 + github-token: ${{ secrets.GITHUB_TOKEN }} + + publish-github-release: + name: Publish GitHub release + needs: + - create-github-release + - build-linux-x64 + - build-linux-arm64 + - build-macos-x64 + - build-macos-arm64 + - build-windows-x64 + runs-on: ubuntu-latest + timeout-minutes: 2 + environment: + name: GitHub release + url: ${{ steps.release.outputs.html_url }} + steps: + - name: Publish GitHub release + id: release + run: | + prerelease="${{ needs.create-github-release.outputs.prerelease }}" + if [[ "$prerelease" = "true" ]]; then + make_latest=false + else + make_latest=true + fi + releases_url=$(echo "${{ github.event.repository.releases_url }}" | sed 's/{\/id}//') + response=$(curl \ + --location \ + --silent \ + --show-error \ + --request PATCH \ + --header "Accept: application/vnd.github+json" \ + --header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + --header "X-GitHub-Api-Version: 2022-11-28" \ + "$releases_url" \ + --data @- <> $GITHUB_OUTPUT From 618743d65e80879dee78841ba07f6123e6570a40 Mon Sep 17 00:00:00 2001 From: Guillaume Galy Date: Fri, 6 Dec 2024 14:57:27 +0100 Subject: [PATCH 09/18] chore: Use make-fetch-happen instead of axios to build bundle --- js/bundle/package.json | 4 ++-- js/bundle/src/download.ts | 9 ++++++--- js/package-lock.json | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/js/bundle/package.json b/js/bundle/package.json index 74e3880..9b60048 100644 --- a/js/bundle/package.json +++ b/js/bundle/package.json @@ -6,9 +6,9 @@ "types": "target/index.d.ts", "dependencies": { "archiver": "7.0.1", - "axios": "1.7.7", "commander": "12.1.0", - "decompress": "4.2.1" + "decompress": "4.2.1", + "make-fetch-happen": "14.0.3" }, "devDependencies": { "@types/archiver": "6.0.3", diff --git a/js/bundle/src/download.ts b/js/bundle/src/download.ts index 2b31a1c..07a5852 100644 --- a/js/bundle/src/download.ts +++ b/js/bundle/src/download.ts @@ -2,11 +2,14 @@ import fs from "node:fs"; import stream from "node:stream"; import util from "node:util"; -import axios from "axios"; +import fetch from "make-fetch-happen"; const pipeline = util.promisify(stream.pipeline); export const downloadFile = async (url: string, targetFile: string): Promise => { - const request = await axios.get(url, { responseType: "stream" }); - await pipeline(request.data, fs.createWriteStream(targetFile)); + const response = await fetch(url); + if (!response.ok) { + throw new Error(`Failed to fetch: ${response.status} ${response.statusText}`); + } + await pipeline(response.body, fs.createWriteStream(targetFile)); }; diff --git a/js/package-lock.json b/js/package-lock.json index 2df77d1..89e4387 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -24,9 +24,9 @@ "license": "Apache-2.0", "dependencies": { "archiver": "7.0.1", - "axios": "1.7.7", "commander": "12.1.0", - "decompress": "4.2.1" + "decompress": "4.2.1", + "make-fetch-happen": "14.0.3" }, "devDependencies": { "@types/archiver": "6.0.3", From ae818ddd5d8d5f519d1dba8046e41625a3d8cbc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Corr=C3=A9?= Date: Mon, 9 Dec 2024 10:32:20 +0100 Subject: [PATCH 10/18] fix: checkout repository before building bundles --- .github/workflows/release.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3abdcef..dfa7581 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -163,6 +163,9 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download artifact uses: actions/download-artifact@v4 with: @@ -185,6 +188,9 @@ jobs: runs-on: ubuntu-24-arm-2-cores timeout-minutes: 5 steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download artifact uses: actions/download-artifact@v4 with: @@ -207,6 +213,9 @@ jobs: runs-on: macos-13 timeout-minutes: 5 steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download artifact uses: actions/download-artifact@v4 with: @@ -229,6 +238,9 @@ jobs: runs-on: macos-14 timeout-minutes: 5 steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download artifact uses: actions/download-artifact@v4 with: @@ -251,6 +263,9 @@ jobs: runs-on: windows-latest timeout-minutes: 5 steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download artifact uses: actions/download-artifact@v4 with: From aaa026abc864086d3d31f41bfef1d594ad5f818a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Corr=C3=A9?= Date: Mon, 9 Dec 2024 10:59:26 +0100 Subject: [PATCH 11/18] fix: remove npm version in bundle build, fix job name --- .github/actions/build-and-upload-bundle/action.yml | 2 -- .github/workflows/release.yml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/actions/build-and-upload-bundle/action.yml b/.github/actions/build-and-upload-bundle/action.yml index 37e05a2..4489281 100644 --- a/.github/actions/build-and-upload-bundle/action.yml +++ b/.github/actions/build-and-upload-bundle/action.yml @@ -30,8 +30,6 @@ runs: working-directory: ./js run: | echo "architecture: $(arch)" - npm ci - npm version "${{ inputs.version }}" npm run generate --workspace=bundle upload_url=$(echo "${{ inputs.upload_url }}" | sed 's/{[^}]*}//') echo "upload_url=$upload_url" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dfa7581..c8c6cc6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -181,7 +181,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} build-linux-arm64: - name: Build bundle for Linux x64 + name: Build bundle for Linux ARM64 needs: - release-jvm - create-github-release From 7dee7f02ec49dc576ffde890517c130edaddf95d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Corr=C3=A9?= Date: Mon, 9 Dec 2024 11:41:45 +0100 Subject: [PATCH 12/18] fix: try including hidden files --- .github/workflows/release.yml | 29 +++++++++++------------------ js/cli/.npmignore | 1 + js/core/.npmignore | 1 + js/http/.npmignore | 1 + js/jvm-types/.npmignore | 1 + 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c8c6cc6..8c9fbca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,7 +61,10 @@ jobs: uses: actions/upload-artifact@v4 with: name: release-jvm-workdir - path: . + include-hidden-files: true + path: | + . + !.git/ retention-days: 7 release-js: @@ -101,12 +104,17 @@ jobs: uses: actions/upload-artifact@v4 with: name: release-js-workdir - path: . + include-hidden-files: true + path: | + . + !.git/ retention-days: 7 create-github-release: name: Create GitHub release (draft) - needs: release-js + needs: + - release-jvm + - release-js runs-on: ubuntu-latest timeout-minutes: 2 environment: @@ -163,9 +171,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Download artifact uses: actions/download-artifact@v4 with: @@ -188,9 +193,6 @@ jobs: runs-on: ubuntu-24-arm-2-cores timeout-minutes: 5 steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Download artifact uses: actions/download-artifact@v4 with: @@ -213,9 +215,6 @@ jobs: runs-on: macos-13 timeout-minutes: 5 steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Download artifact uses: actions/download-artifact@v4 with: @@ -238,9 +237,6 @@ jobs: runs-on: macos-14 timeout-minutes: 5 steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Download artifact uses: actions/download-artifact@v4 with: @@ -263,9 +259,6 @@ jobs: runs-on: windows-latest timeout-minutes: 5 steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Download artifact uses: actions/download-artifact@v4 with: diff --git a/js/cli/.npmignore b/js/cli/.npmignore index 40b4068..f42c71b 100644 --- a/js/cli/.npmignore +++ b/js/cli/.npmignore @@ -2,3 +2,4 @@ !/target/** !/polyfills/** !/package.json +!/README.md diff --git a/js/core/.npmignore b/js/core/.npmignore index 58911bd..d20718d 100644 --- a/js/core/.npmignore +++ b/js/core/.npmignore @@ -1,3 +1,4 @@ * !/target/** !/package.json +!/README.md diff --git a/js/http/.npmignore b/js/http/.npmignore index 58911bd..d20718d 100644 --- a/js/http/.npmignore +++ b/js/http/.npmignore @@ -1,3 +1,4 @@ * !/target/** !/package.json +!/README.md diff --git a/js/jvm-types/.npmignore b/js/jvm-types/.npmignore index 04a0206..581eb2c 100644 --- a/js/jvm-types/.npmignore +++ b/js/jvm-types/.npmignore @@ -2,3 +2,4 @@ !/**/*.js !/**/*.d.ts !/package.json +!/README.md From d9524cd330f8598ea3a62648f0e61eaec0760bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Corr=C3=A9?= Date: Mon, 9 Dec 2024 15:06:49 +0100 Subject: [PATCH 13/18] fix: build and upload bundle upload url parameters misnamed --- .github/actions/build-and-upload-bundle/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build-and-upload-bundle/action.yml b/.github/actions/build-and-upload-bundle/action.yml index 4489281..e55cc75 100644 --- a/.github/actions/build-and-upload-bundle/action.yml +++ b/.github/actions/build-and-upload-bundle/action.yml @@ -31,7 +31,7 @@ runs: run: | echo "architecture: $(arch)" npm run generate --workspace=bundle - upload_url=$(echo "${{ inputs.upload_url }}" | sed 's/{[^}]*}//') + upload_url=$(echo "${{ inputs.upload-url }}" | sed 's/{[^}]*}//') echo "upload_url=$upload_url" curl --location \ --silent \ From 6f24c14080fb9794916e3190e70dd750a4d8103f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Corr=C3=A9?= Date: Mon, 9 Dec 2024 16:13:57 +0100 Subject: [PATCH 14/18] fix: remove node_modules and reinstall based on bundle arch --- .github/actions/build-and-upload-bundle/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/build-and-upload-bundle/action.yml b/.github/actions/build-and-upload-bundle/action.yml index e55cc75..3a2287c 100644 --- a/.github/actions/build-and-upload-bundle/action.yml +++ b/.github/actions/build-and-upload-bundle/action.yml @@ -30,6 +30,8 @@ runs: working-directory: ./js run: | echo "architecture: $(arch)" + rm -rf node_modules bundle/node_modules + npm ci npm run generate --workspace=bundle upload_url=$(echo "${{ inputs.upload-url }}" | sed 's/{[^}]*}//') echo "upload_url=$upload_url" From 2c880e3628ce792e58db662d004cdd9dddf75a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Corr=C3=A9?= Date: Mon, 9 Dec 2024 16:58:10 +0100 Subject: [PATCH 15/18] fix: use proper patch url when undrafting release --- .github/workflows/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c9fbca..2692b0d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -156,6 +156,9 @@ jobs: EOF ) echo "response=$response" + url=$(echo "$response" | jq --raw-output ".url") + echo "url=$url" + echo "url=$url" >> $GITHUB_OUTPUT html_url=$(echo "$response" | jq --raw-output ".html_url") echo "html_url=$html_url" echo "html_url=$html_url" >> $GITHUB_OUTPUT @@ -297,7 +300,6 @@ jobs: else make_latest=true fi - releases_url=$(echo "${{ github.event.repository.releases_url }}" | sed 's/{\/id}//') response=$(curl \ --location \ --silent \ @@ -306,7 +308,7 @@ jobs: --header "Accept: application/vnd.github+json" \ --header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ --header "X-GitHub-Api-Version: 2022-11-28" \ - "$releases_url" \ + "${{ needs.create-github-release.outputs.url }}" \ --data @- < Date: Mon, 9 Dec 2024 17:25:22 +0100 Subject: [PATCH 16/18] feat: add --fail-with-body on curl requests --- .github/workflows/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2692b0d..3866851 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -137,9 +137,10 @@ jobs: echo "prerelease=$prerelease" >> $GITHUB_OUTPUT releases_url=$(echo "${{ github.event.repository.releases_url }}" | sed 's/{\/id}//') response=$(curl \ + --fail-with-body \ --location \ - --silent \ --show-error \ + --silent \ --request POST \ --header "Accept: application/vnd.github+json" \ --header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ @@ -301,9 +302,10 @@ jobs: make_latest=true fi response=$(curl \ + --fail-with-body \ --location \ - --silent \ --show-error \ + --silent \ --request PATCH \ --header "Accept: application/vnd.github+json" \ --header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ From 1c688b27c67024cbd8284cd11b8a6ecb4d212893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Corr=C3=A9?= Date: Mon, 9 Dec 2024 17:43:13 +0100 Subject: [PATCH 17/18] fix: add missing job output --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3866851..9e8cdfe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -122,6 +122,7 @@ jobs: url: ${{ steps.release.outputs.html_url }} outputs: prerelease: ${{ steps.release.outputs.prerelease }} + url: ${{ steps.release.outputs.url }} upload_url: ${{ steps.release.outputs.upload_url }} steps: - name: Create GitHub release (draft) From 8380c49ad5f0edbb4c25934e6a1a36a492b7fafd Mon Sep 17 00:00:00 2001 From: Guillaume Galy Date: Tue, 10 Dec 2024 10:48:15 +0100 Subject: [PATCH 18/18] fix: Missing recursive option when creating tmp directory --- js/cli/src/dependencies/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/cli/src/dependencies/index.ts b/js/cli/src/dependencies/index.ts index a242551..50db6be 100644 --- a/js/cli/src/dependencies/index.ts +++ b/js/cli/src/dependencies/index.ts @@ -101,7 +101,7 @@ const getResolvedBundle = (bundlePath: string): ResolvedBundle => ({ const downloadAndInstallBundle = async (options: BundleOptions) => { const tmpFolder = path.join(options.gatlingHome, "tmp"); if (!fsSync.existsSync(tmpFolder)) { - await fs.mkdir(tmpFolder); + await fs.mkdir(tmpFolder, { recursive: true }); } const tmpFile = path.join(tmpFolder, "bundle-download.zip");