-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat: render a simple markdown dashboard #88
Conversation
- var substitution fixed - update names and jobs - simplif the escaping to make it easier to debug - fix the dirty detection (github uses nopipefail)
Co-authored-by: Piotr Galar <[email protected]>
7d474af
to
4634908
Compare
4634908
to
b742c2b
Compare
Do we have to commit the files in |
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.
some small changes. But overall looks good, thanks! I think we're quite close here.
} | ||
|
||
if (process.env.RUN_URL) { | ||
result = `[${result}](${process.env.RUN_URL})`; |
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 it possible to get a URL that drops you to the test output directly rather than just the run url?
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ | ||
|
||
/* Modules */ | ||
"module": "commonjs" /* Specify what module code is generated. */, |
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.
Does this need to be commonjs or can it be es2020?
|
||
## Usage | ||
|
||
`ts-node ./src/index.ts input_path.csv output_path.md` |
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.
Can we make this a script in package json so you can do npm run generate-dashboard input.csv output.md
?
export const listUniqPairs = (pairs: PairOfImplementation[]): string[] => { | ||
const uniq = new Set<string>(); | ||
|
||
for (const [a, b] of pairs) { | ||
uniq.add(a); | ||
uniq.add(b); | ||
} | ||
|
||
return Array.from(uniq).sort(); | ||
}; |
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.
export const listUniqPairs = (pairs: PairOfImplementation[]): string[] => { | |
const uniq = new Set<string>(); | |
for (const [a, b] of pairs) { | |
uniq.add(a); | |
uniq.add(b); | |
} | |
return Array.from(uniq).sort(); | |
}; | |
function uniqFromPairs<T>(pairs: Array<[T, T]>): Array<T> { return [...new Set(pairs.flat())] } |
// ` something x something-else more info ignore` | ||
const RUN_ID_MATCHER = /\s*(\S+)\s+x\s+(\S+)\s*.*/; | ||
|
||
export const fromRunIdToCoordinate = (runId: string): PairOfImplementation => { |
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.
This isn't really a coordinate. This is more like fromRunIdToPair
. Getting the coordinate is done separately.
export const generateTable = ( | ||
results: ResultFile, | ||
defaultValue: string = ":white_circle:", | ||
testedCell: CellRender = defaultCellRender |
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.
Should this be called cellRenderer
instead?
|
||
const cell = testedCell(a, b, result); | ||
|
||
matrix[i + 1][j + 1] = cell; |
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.
This means that "A x B" is the same as "B x A" which may not be the case. This is true for our current "ping" test, but it's possible we may want "A x B" to mean A dials out to B.
|
||
export type ResultLine = { | ||
task_id: string; | ||
run_id: string; |
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.
I would parse this and have the parsed version in here. So instead of run_id
this would be test_pair: [string, string]
. And rename this ResultLine
to TestOutcome
. This way these functions are separated from the actual semantics of the result.csv. This is useful because with the multidim interop the result.csv will look slightly different.
Then functions operate on test pairs instead of re-parsing with fromRunIdToCoordinate
multiple times.
I know we agreed on this specific format of result.csv
, I'm just asking for this change here so that we can handle slightly different result.csv formats. Basically one "parse" step between L128 & L129.
But this is a minor thing and easy to change later when we integrate this with the multidim interop work. So feel free to disregard.
@MarcoPolo I noticed you use that code in https://github.com/libp2p/test-plans/blob/ed5893b0942401fe2351fdbd5240dd41f408d926/multidim-interop/src/lib.ts already, is it correct to assume we'll merge everything with #85 and we can close this PR? |
Yes |
Closes #55
This PR adds a dashboard CI rendered in a table like seen in https://github.com/laurentsenta/test-plans/actions/runs/3620746503 and it adds a badge to the readme which links to the latest dashboard run:
.
(fail on purpose, for the sake of demonstration)
generate-dashboard
which loads a CSV file of testground results and outputs a markdown tableDashboard
workflow that calls the composer, generates tests, then generates the dashboardUpdate Badge
workflow, which updates the README badge with a link to the latest dashboard (based on @galargh's PR)It assumes that a
results.csv
was generated after running the tests generated by the composer.See: #55 (comment)
Todo
pl-strflt/job-summary-url-action
doesn't work yetresults.csv
so that CI is green again.