forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
…s-migration/config
- Loading branch information
Showing
164 changed files
with
11,460 additions
and
1,383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ self-hosted-runner: | |
- ubuntu-latest-xl | ||
- macos-12-xl | ||
- macos-13-xlarge | ||
- ubuntu-latest-reassure-tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: 'Get and Save graphite string' | ||
description: 'Parse reassure output.json file and create string which can be sent to the graphite server' | ||
outputs: | ||
GRAPHITE_STRING: | ||
description: String with reassure data which can be directly sent to the graphite server | ||
runs: | ||
using: 'node20' | ||
main: './index.js' |
53 changes: 53 additions & 0 deletions
53
.github/actions/javascript/getGraphiteString/getGraphiteString.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const core = require('@actions/core'); | ||
const github = require('@actions/github'); | ||
const fs = require('fs'); | ||
|
||
const run = () => { | ||
// Prefix path to the graphite metric | ||
const GRAPHITE_PATH = 'reassure'; | ||
|
||
let regressionOutput; | ||
try { | ||
regressionOutput = JSON.parse(fs.readFileSync('.reassure/output.json', 'utf8')); | ||
} catch (err) { | ||
// Handle errors that occur during file reading or parsing | ||
console.error('Error while parsing output.json:', err.message); | ||
core.setFailed(err); | ||
} | ||
|
||
const creationDate = regressionOutput.metadata.current.creationDate; | ||
const timestampInMili = new Date(creationDate).getTime(); | ||
|
||
// Graphite accepts timestamp in seconds | ||
const timestamp = Math.floor(timestampInMili / 1000); | ||
|
||
// Get PR number from the github context | ||
const prNumber = github.context.payload.pull_request.number; | ||
|
||
// We need to combine all tests from the 4 buckets | ||
const reassureTests = [...regressionOutput.meaningless, ...regressionOutput.significant, ...regressionOutput.countChanged, ...regressionOutput.added]; | ||
|
||
// Map through every test and create string for meanDuration and meanCount | ||
// eslint-disable-next-line rulesdir/prefer-underscore-method | ||
const graphiteString = reassureTests | ||
.map((test) => { | ||
const current = test.current; | ||
// Graphite doesn't accept metrics name with space, we replace spaces with "-" | ||
const formattedName = current.name.split(' ').join('-'); | ||
|
||
const renderDurationString = `${GRAPHITE_PATH}.PR-${prNumber}.${formattedName}.renderDuration ${current.meanDuration} ${timestamp}`; | ||
const renderCountString = `${GRAPHITE_PATH}.PR-${prNumber}.${formattedName}.renderCount ${current.meanCount} ${timestamp}`; | ||
|
||
return `${renderDurationString}\n${renderCountString}`; | ||
}) | ||
.join('\n'); | ||
|
||
// Set generated graphite string to the github variable | ||
core.setOutput('GRAPHITE_STRING', graphiteString); | ||
}; | ||
|
||
if (require.main === module) { | ||
run(); | ||
} | ||
|
||
module.exports = run; |
Oops, something went wrong.