From 98af2b091c9985538541b575222326190c59825a Mon Sep 17 00:00:00 2001 From: Anthony Gauthier Date: Thu, 19 May 2022 09:15:12 -0400 Subject: [PATCH] fix: generating dist/index.js prior, regenerated yarn.lock --- .gitignore | 3 +- action.yaml | 10 ++--- dist/index.js | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ yarn.lock | 17 -------- 4 files changed, 112 insertions(+), 25 deletions(-) create mode 100644 dist/index.js diff --git a/.gitignore b/.gitignore index 04c01ba..40b878d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -node_modules/ -dist/ \ No newline at end of file +node_modules/ \ No newline at end of file diff --git a/action.yaml b/action.yaml index 69a101c..8afec7e 100644 --- a/action.yaml +++ b/action.yaml @@ -15,11 +15,14 @@ inputs: required: true repoName: description: "Name of the repository to checkout ('org/repo')" + required: false repoRef: description: "Tag, Branch, or Commit SHA for the Test Suite repository" default: "main" + required: false simulationClass: description: "Full classpath of the simulation to run" + required: false runs: using: "composite" steps: @@ -36,13 +39,8 @@ runs: with: distribution: ${{ inputs.javaDistribution }} java-version: ${{ inputs.javaVersion }} - - run: mvn -f ${{ inputs.testPath }} gatling:test ${{ inputs.simulationClass != '' && '-Dgatling.simulationClass=' || '' }}${{ inputs.simulationClass }} - shell: bash - - uses: actions/setup-node@v3 - with: - node-version: '16' - - run: yarn install && yarn run build + - run: mvn -f ${{ inputs.testPath }} gatling:test ${{ inputs.simulationClass != '' && '-Dgatling.simulationClass=' || '' }}${{ inputs.simulationClass }} shell: bash - name: Generate Job Summary diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..0fbb979 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,107 @@ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 932: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const fs = __nccwpck_require__(147); + +module.exports = async ({github, context, core}) => { + const testPath = process.env.TEST_PATH + const lastRuns = fs.readFileSync(`${testPath}/target/gatling/lastRun.txt`).toString().trim().split('\n'); + + for(const run of lastRuns) { + const results = JSON.parse(fs.readFileSync(`${testPath}/target/gatling/${run}/js/stats.json`).toString()); + let tableContent = [ + [ + {data: 'Request', header: true}, + {data: 'Success ✅', header: true}, + {data: 'Errors ❌', header: true}, + {data: 'Min', header: true}, + {data: 'Max', header: true}, + {data: 'Avg.', header: true}, + {data: 'Std. Dev.', header: true}, + {data: 'RPS', header: true}, + ] + ]; + + for(const result in results.contents) { + const requestMetrics = results.contents[result].stats; + tableContent.push([ + requestMetrics.name, + requestMetrics.numberOfRequests.ok.toString(), + requestMetrics.numberOfRequests.ko.toString(), + requestMetrics.minResponseTime.total.toString(), + requestMetrics.maxResponseTime.total.toString(), + requestMetrics.meanResponseTime.total.toString(), + requestMetrics.standardDeviation.total.toString(), + requestMetrics.meanNumberOfRequestsPerSecond.total.toString(), + ]); + } + + await core.summary + .addHeading(`Results for ${run}`) + .addTable(tableContent) + .addQuote('All times are in millisecond (ms). RPS means "Requests per Second"') + .write() + } +} + + +/***/ }), + +/***/ 147: +/***/ ((module) => { + +"use strict"; +module.exports = require("fs"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nccwpck_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat */ +/******/ +/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module is referenced by other modules so it can't be inlined +/******/ var __webpack_exports__ = __nccwpck_require__(932); +/******/ module.exports = __webpack_exports__; +/******/ +/******/ })() +; \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 73964af..b92714e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,18 +2,6 @@ # yarn lockfile v1 -"@actions/core@^1.8.0": - version "1.8.1" - resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.8.1.tgz#3cdde366654b98764e63633a08dba6703131e274" - integrity sha512-LuFg2O/+rRrYxrdafnqH9mx6ADszKzQAhDuEhhMQIh47tsXzWkW4wXY5zvscqJ4KDywyJX0LA0pAESPLUjZXvw== - dependencies: - "@actions/http-client" "^2.0.0" - -"@actions/http-client@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-2.0.0.tgz#518c4af1e7045769d3e2ad8c2ce7f8b05224a9b3" - integrity sha512-fm1+OPPey5ypgStT9K8zbBhICj4J4UV/TJIHDhuWlkb8KyJaAtjcZK184dTqul0dV0nPKX97FNtDXX20BTLXSA== - "@babel/code-frame@^7.0.0": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" @@ -3118,11 +3106,6 @@ trim-newlines@^3.0.0: resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144" integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw== -tunnel@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c" - integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg== - type-fest@^0.16.0: version "0.16.0" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.16.0.tgz#3240b891a78b0deae910dbeb86553e552a148860"