Skip to content

Commit

Permalink
fix release text
Browse files Browse the repository at this point in the history
  • Loading branch information
acheronfail committed Jan 9, 2024
1 parent fae1ff5 commit fae14d5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 25 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,13 @@ jobs:
- name: Generate Summary
run: |
cd scripts
npm start -- --results ../artifact > summary.txt
cat summary.txt
npm start -- --results ../artifact
cat summary.md
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.run_number }}
body_path: scripts/summary.txt
body_path: scripts/summary.md
files: artifact/*.json
draft: false
prerelease: false
- uses: actions/upload-artifact@v3
with:
path: scripts/summary.txt
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ count
java/
kotlin/
scala/
scripts/summary.md
CMD
VERSION
STATS
10 changes: 10 additions & 0 deletions scripts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"type": "module",
"scripts": {
"start": "npm install && node summary.js"
"start": "npm install >/dev/null && node summary.js"
},
"dependencies": {
"human-readable": "^0.2.1",
"markdown-table": "^3.0.3",
"minimist": "^1.2.8",
"pretty-bytes": "^6.1.1",
"pretty-time": "^1.1.0"
Expand Down
39 changes: 21 additions & 18 deletions scripts/summary.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { readFile } from 'fs/promises';
import { readFile, writeFile } from 'fs/promises';
import { readdirSync } from 'fs';
import { join } from 'path';
import { markdownTable } from 'markdown-table';
import formatTime from 'pretty-time';
import formatSize from 'pretty-bytes';
import minimist from 'minimist';
Expand All @@ -18,29 +19,31 @@ const results = await Promise.all(
})
);

console.table(
results
await writeFile(
'summary.md',
`
${markdownTable([
['name', 'command', 'version'],
...results
.slice()
.sort((a, b) => a.name.localeCompare(b.name))
.map(({ name, command, version }) => ({ name, command, version }))
);
.map(({ name, command, version }) => [name, command, version]),
])}
console.table(
results
${markdownTable([
['name', 'mean'],
...results
.slice()
.sort((a, b) => a.mean - b.mean)
.map(({ name, mean }) => ({
name,
mean: formatTime(Math.floor(mean * 1_000_000_000), undefined, 5),
}))
);
.map(({ name, mean }) => [name, formatTime(Math.floor(mean * 1_000_000_000), undefined, 5)]),
])}
console.table(
results
${markdownTable([
['name', 'max_rss'],
...results
.slice()
.sort((a, b) => a.max_rss - b.max_rss)
.map(({ name, max_rss }) => ({
name,
max_rss: formatSize(max_rss, { minimumFractionDigits: 7 }),
}))
.map(({ name, max_rss }) => [name, formatSize(max_rss, { minimumFractionDigits: 7 })]),
])}
`.trim()
);

0 comments on commit fae14d5

Please sign in to comment.