Skip to content

Commit 73361a9

Browse files
authored
Merge branch 'Expensify:main' into Update-thread-headers-ancestry-to-deep-link-back-to-the-original-comment
2 parents 45e1992 + d088580 commit 73361a9

File tree

362 files changed

+24479
-13065
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

362 files changed

+24479
-13065
lines changed

.github/actionlint.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
self-hosted-runner:
33
labels:
44
- ubuntu-latest-xl
5-
- macos-12-xl
5+
- macos-13-large
66
- macos-13-xlarge
77
- ubuntu-latest-reassure-tests

.github/actions/javascript/awaitStagingDeploys/index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -12754,9 +12754,13 @@ function promiseDoWhile(condition, action) {
1275412754
console.info('[promiseWhile] promiseDoWhile() condition', condition);
1275512755
const actionResult = action?.();
1275612756
console.info('[promiseWhile] promiseDoWhile() actionResult', actionResult);
12757+
if (!actionResult) {
12758+
resolve();
12759+
return;
12760+
}
1275712761
actionResult
12758-
?.then(() => promiseWhile(condition, action))
12759-
.then(() => resolve())
12762+
.then(() => promiseWhile(condition, action))
12763+
.then(resolve)
1276012764
.catch(reject);
1276112765
});
1276212766
}

.github/actions/javascript/getGraphiteString/action.yml

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: 'Get and Save graphite string'
22
description: 'Parse reassure output.json file and create string which can be sent to the graphite server'
3+
4+
inputs:
5+
PR_NUMBER:
6+
description: Number of merged PR
7+
required: true
38
outputs:
49
GRAPHITE_STRING:
510
description: String with reassure data which can be directly sent to the graphite server

.github/actions/javascript/getGraphiteString/getGraphiteString.ts

+32-32
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
import * as core from '@actions/core';
2-
import * as github from '@actions/github';
32
import fs from 'fs';
43

54
const run = () => {
65
// Prefix path to the graphite metric
76
const GRAPHITE_PATH = 'reassure';
7+
const PR_NUMBER = core.getInput('PR_NUMBER', {required: true});
88

9-
let regressionOutput;
10-
try {
11-
regressionOutput = JSON.parse(fs.readFileSync('.reassure/output.json', 'utf8'));
12-
} catch (err) {
13-
// Handle errors that occur during file reading or parsing
14-
if (err instanceof Error) {
15-
console.error('Error while parsing output.json:', err.message);
16-
core.setFailed(err);
17-
}
18-
}
9+
// Read the contents of the file, the file is in the JSONL format
10+
const regressionFile = fs.readFileSync('.reassure/baseline.perf', 'utf8');
11+
12+
// Split file contents by newline to get individual JSON entries
13+
const regressionEntries = regressionFile.split('\n');
1914

20-
const creationDate = regressionOutput.metadata.current.creationDate;
21-
const timestampInMili = new Date(creationDate).getTime();
15+
// Initialize string to store Graphite metrics
16+
let graphiteString = '';
2217

23-
// Graphite accepts timestamp in seconds
24-
const timestamp = Math.floor(timestampInMili / 1000);
18+
// Iterate over each entry
19+
regressionEntries.forEach((entry) => {
20+
// Skip empty lines
21+
if (entry.trim() === '') {
22+
return;
23+
}
2524

26-
// Get PR number from the github context
27-
const prNumber = github.context.payload.pull_request?.number;
25+
try {
26+
const current = JSON.parse(entry);
2827

29-
// We need to combine all tests from the 4 buckets
30-
const reassureTests = [...regressionOutput.meaningless, ...regressionOutput.significant, ...regressionOutput.countChanged, ...regressionOutput.added];
28+
// Extract timestamp, Graphite accepts timestamp in seconds
29+
const timestamp = current.metadata?.creationDate ? Math.floor(new Date(current.metadata.creationDate).getTime() / 1000) : '';
3130

32-
// Map through every test and create string for meanDuration and meanCount
33-
// eslint-disable-next-line rulesdir/prefer-underscore-method
34-
const graphiteString = reassureTests
35-
.map((test) => {
36-
const current = test.current;
37-
// Graphite doesn't accept metrics name with space, we replace spaces with "-"
38-
const formattedName = current.name.split(' ').join('-');
31+
if (current.name && current.meanDuration && current.meanCount && timestamp) {
32+
const formattedName = current.name.split(' ').join('-');
3933

40-
const renderDurationString = `${GRAPHITE_PATH}.${formattedName}.renderDuration ${current.meanDuration} ${timestamp}`;
41-
const renderCountString = `${GRAPHITE_PATH}.${formattedName}.renderCount ${current.meanCount} ${timestamp}`;
42-
const renderPRNumberString = `${GRAPHITE_PATH}.${formattedName}.prNumber ${prNumber} ${timestamp}`;
34+
const renderDurationString = `${GRAPHITE_PATH}.${formattedName}.renderDuration ${current.meanDuration} ${timestamp}`;
35+
const renderCountString = `${GRAPHITE_PATH}.${formattedName}.renderCount ${current.meanCount} ${timestamp}`;
36+
const renderPRNumberString = `${GRAPHITE_PATH}.${formattedName}.prNumber ${PR_NUMBER} ${timestamp}`;
4337

44-
return `${renderDurationString}\n${renderCountString}\n${renderPRNumberString}`;
45-
})
46-
.join('\n');
38+
// Concatenate Graphite strings
39+
graphiteString += `${renderDurationString}\n${renderCountString}\n${renderPRNumberString}\n`;
40+
}
41+
} catch (e) {
42+
const error = new Error('Error parsing baseline.perf JSON file');
43+
console.error(error.message);
44+
core.setFailed(error);
45+
}
46+
});
4747

4848
// Set generated graphite string to the github variable
4949
core.setOutput('GRAPHITE_STRING', graphiteString);

0 commit comments

Comments
 (0)