Skip to content
This repository was archived by the owner on Jan 27, 2023. It is now read-only.

feat: added generateReport.js, added steps in action.yaml for reporting #3

Merged
merged 22 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
74d0226
feat: added generateReport.js, added steps in action.yaml for reporting
anthonygauthier May 12, 2022
2321851
fix: modified job summary step
anthonygauthier May 12, 2022
24a820f
chore: fixed indent
anthonygauthier May 12, 2022
26d0018
fix: modified download-gatling-report step
anthonygauthier May 12, 2022
d205013
fix: modified Generate CSV report step, added env var
anthonygauthier May 12, 2022
eed5da7
fix: changed url for gatling-report
anthonygauthier May 12, 2022
0887526
fix: removed trailing )
anthonygauthier May 12, 2022
b1f139e
fix: downloading v6.0
anthonygauthier May 12, 2022
3380160
refactor: removed gatling-report, using gatling json files
anthonygauthier May 12, 2022
5c85865
fix: added @actions/core in package.json
anthonygauthier May 12, 2022
ae87b49
feat: added compiled index.js
anthonygauthier May 12, 2022
4f52124
feat: looping through results
anthonygauthier May 12, 2022
2c3479b
fix: indent
anthonygauthier May 12, 2022
71d6f88
fix: added condition to avoid empty newlines in file
anthonygauthier May 12, 2022
03227f0
fix: removed package-lock.json, added yarn.lock, added tunnel to depe…
anthonygauthier May 13, 2022
cd7237a
feat: attempt at writing summary
anthonygauthier May 13, 2022
21ff90b
fix: added async keyword before generateTestResults
anthonygauthier May 13, 2022
659cb13
feat: added metrics to table
anthonygauthier May 13, 2022
6cf2301
refactor: added checkmark and 'x' for success/errors
anthonygauthier May 13, 2022
dee8ecb
refactor: using core.getInput for testPath
anthonygauthier May 13, 2022
b362818
fix: assigning testPath in script block rather than index.js
anthonygauthier May 13, 2022
580f0f3
fix: using env var instead of core.getInput
anthonygauthier May 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
node_modules/
dist/
17 changes: 16 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ inputs:
required: true
testPath:
description: "Path to the Gatling Test Suite"
default: "./test/"
default: "./test"
required: true
repoName:
description: "Name of the repository to checkout ('org/repo')"
Expand All @@ -38,3 +38,18 @@ runs:
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
shell: bash

- name: Generate Job Summary
uses: actions/github-script@v6
env:
TEST_PATH: ${{ inputs.testPath }}
with:
script: |
const script = require('./dist/index.js')
await script({github, context, core})
42 changes: 42 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const fs = require('fs');

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()
}
}
Loading