-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[WIP] fix: E2E performance pipeline flakyness and other improvements #60155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
chrispader
wants to merge
14
commits into
Expensify:main
from
margelo:@chrispader/another-e2e-performance-pipeline-follow-up
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9523831
fix: print output files in order if more than 9
chrispader 2d0c059
fix: also split summary table for meaningless changes in split files
chrispader 0f5b056
fix: extract metric names to const variable
chrispader 357df52
Merge branch 'main' into @chrispader/another-e2e-performance-pipeline…
chrispader d25fb90
fix: improve meaningless changes index string (from to)
chrispader d9060ff
fix: further centralize performance metric and mark names
chrispader 05a8b32
add comments
chrispader 02acb7d
Update Performance.tsx
chrispader f993b05
feat: implement interactive mode in testRunner
chrispader c372a34
add interactive mode log
chrispader 9b1b759
add emoji for interactive mode
chrispader 10a9b55
fix: run tests in offline mode
chrispader 323b315
Merge branch 'main' into @chrispader/another-e2e-performance-pipeline…
chrispader 4f0b8ca
Merge branch 'main' into @chrispader/another-e2e-performance-pipeline…
chrispader File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -7,8 +7,15 @@ | |
| import * as format from './format'; | ||
| import markdownTable from './markdownTable'; | ||
|
|
||
| const MAX_CHARACTERS_PER_FILE = 65536; | ||
| const FILE_SIZE_SAFETY_MARGIN = 1000; | ||
| // This is the maximum number of characters allowed to post to a GitHub comment body through the GitHub CLI | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these comments necessary? And the commented out const, can that be removed? |
||
| // Total of 65536 4-byte unicode characters, but we're mostly not sending 4 bytes per character | ||
| // const MAX_CHARACTERS_PER_FILE = 65536; | ||
|
|
||
| // According to (1.) article and (2.) oist, the maximum number of characters per file is actually 262.144 characters | ||
| // 1. https://github.com/dead-claudia/github-limits (PR Body) | ||
| // 2. https://github.com/orgs/community/discussions/41331#discussioncomment-9276173 | ||
| const MAX_CHARACTERS_PER_FILE = 262144; | ||
| const FILE_SIZE_SAFETY_MARGIN = 500; | ||
| const MAX_CHARACTERS_PER_FILE_WITH_SAFETY_MARGIN = MAX_CHARACTERS_PER_FILE - FILE_SIZE_SAFETY_MARGIN; | ||
|
|
||
| const tableHeader = ['Name', 'Duration']; | ||
|
|
@@ -49,41 +56,49 @@ | |
| return ''; | ||
| }; | ||
|
|
||
| const buildDetailsTable = (entries: Entry[], numberOfTables = 1) => { | ||
| if (!entries.length) { | ||
| return ['']; | ||
| } | ||
|
|
||
| const splitEntriesPerTable = (entries: Entry[], numberOfTables: number) => { | ||
| // We always need at least one table | ||
| const safeNumberOfTables = numberOfTables === 0 ? 1 : numberOfTables; | ||
|
|
||
| const entriesPerTable = Math.floor(entries.length / safeNumberOfTables); | ||
| const tables: string[] = []; | ||
| for (let i = 0; i < safeNumberOfTables; i++) { | ||
| const tables: Entry[][] = []; | ||
| for (let i = 0; i < numberOfTables; i++) { | ||
| const start = i * entriesPerTable; | ||
| const end = i === safeNumberOfTables - 1 ? entries.length : start + entriesPerTable; | ||
| const end = i === numberOfTables - 1 ? entries.length : start + entriesPerTable; | ||
| const tableEntries = entries.slice(start, end); | ||
|
|
||
| const rows = tableEntries.map((entry) => [entry.name, buildDurationDetailsEntry(entry)]); | ||
| const content = markdownTable([tableHeader, ...rows]); | ||
| tables.push(tableEntries); | ||
| } | ||
|
|
||
| const tableMarkdown = collapsibleSection('Show details', content); | ||
| return tables; | ||
| }; | ||
|
|
||
| tables.push(tableMarkdown); | ||
| const buildDetailsTable = (entriesByTable: Entry[][]) => { | ||
| if (!entriesByTable.length) { | ||
| return ['']; | ||
| } | ||
|
|
||
| return tables; | ||
| return entriesByTable.map((entries) => { | ||
| const rows = entries.map((entry) => [entry.name, buildDurationDetailsEntry(entry)]); | ||
| const content = markdownTable([tableHeader, ...rows]); | ||
|
|
||
| const tableMarkdown = collapsibleSection('Show details', content); | ||
| return tableMarkdown; | ||
| }); | ||
| }; | ||
|
|
||
| const buildSummaryTable = (entries: Entry[], collapse = false) => { | ||
| if (!entries.length) { | ||
| return '_There are no entries_'; | ||
| const buildSummaryTable = (entriesByTable: Entry[][], collapse = false) => { | ||
| if (!entriesByTable.length) { | ||
| return ['_There are no entries_']; | ||
| } | ||
|
|
||
| const rows = entries.map((entry) => [entry.name, formatEntryDuration(entry)]); | ||
| const content = markdownTable([tableHeader, ...rows]); | ||
| return entriesByTable.map((entries) => { | ||
| const rows = entries.map((entry) => [entry.name, formatEntryDuration(entry)]); | ||
| const content = markdownTable([tableHeader, ...rows]); | ||
|
|
||
| return collapse ? collapsibleSection('Show entries', content) : content; | ||
| const tableMarkdown = collapse ? collapsibleSection('Show entries', content) : content; | ||
| return tableMarkdown; | ||
| }); | ||
| }; | ||
|
|
||
| const buildMarkdown = (data: Data, skippedTests: string[], numberOfExtraFiles?: number): [string, ...string[]] => { | ||
|
|
@@ -126,16 +141,18 @@ | |
| } | ||
|
|
||
| mainFile += '\n\n### Significant Changes To Duration'; | ||
| mainFile += `\n${buildSummaryTable(data.significance)}`; | ||
| mainFile += `\n${buildDetailsTable(data.significance, 1).at(0)}`; | ||
| mainFile += `\n\n${buildSummaryTable([data.significance]).at(0)}`; | ||
| mainFile += `\n${buildDetailsTable([data.significance]).at(0)}`; | ||
|
|
||
| // We always need at least one table | ||
| const numberOfMeaninglessDetailsTables = nExtraFiles === 0 ? 1 : nExtraFiles; | ||
| const meaninglessDetailsTables = buildDetailsTable(data.meaningless, numberOfMeaninglessDetailsTables); | ||
| const numberOfMeaninglessDataTables = nExtraFiles === 0 ? 1 : nExtraFiles; | ||
| const meaninglessEntriesPerTable = splitEntriesPerTable(data.meaningless, numberOfMeaninglessDataTables); | ||
| const meaninglessSummaryTable = buildSummaryTable(meaninglessEntriesPerTable, true); | ||
| const meaninglessDetailsTables = buildDetailsTable(meaninglessEntriesPerTable); | ||
|
|
||
| if (nExtraFiles === 0) { | ||
| mainFile += '\n\n### Meaningless Changes To Duration'; | ||
| mainFile += `\n${buildSummaryTable(data.meaningless, true)}`; | ||
| mainFile += `\n\n${meaninglessSummaryTable.at(0)}`; | ||
| mainFile += `\n${meaninglessDetailsTables.at(0)}`; | ||
|
|
||
| return [mainFile]; | ||
|
|
@@ -147,9 +164,12 @@ | |
| extraFile += ` (${i + 2}/${nExtraFiles + 1})`; | ||
|
|
||
| extraFile += '\n\n### Meaningless Changes To Duration'; | ||
| extraFile += nExtraFiles >= 2 ? ` (${i + 1}/${nExtraFiles})` : ''; | ||
|
|
||
| extraFile += `\n${buildSummaryTable(data.meaningless, true)}`; | ||
| const entries = meaninglessEntriesPerTable.at(i); | ||
| const fromToString = `\n> ${entries?.at(0)?.name} - ${entries?.at(-1)?.name}`; | ||
| extraFile += nExtraFiles >= 2 ? fromToString : ''; | ||
|
|
||
| extraFile += `\n\n${meaninglessSummaryTable.at(i)}`; | ||
| extraFile += `\n${meaninglessDetailsTables.at(i)}`; | ||
| extraFile += '\n'; | ||
|
|
||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this sorting just for cleaner output?