forked from fastify/benchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (37 loc) · 1.47 KB
/
benchmarks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Node benchmarks
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 1 * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: 10
- name: benchmarks
run: |
npm install
npm start y 100 10 40
npm start y 100 10 40
node_version=$(node --version)
benchmark_title=$(cat << EOF
# Benchmarks
* __Machine:__ $(uname -a) | $(node -r os -p -e "\`\${os.cpus().length} vCPUs | \${Math.ceil(os.totalmem() / (Math.pow(1024, 3)))}GB\`").
* __Method:__ \`autocannon -c 100 -d 40 -p 10 localhost:3000\` (two rounds; one to warm-up, one to measure).
* __Node:__ \`$node_version\`
* __Run:__ $(date)
EOF)
benchmark_table=$(node benchmark-compare.js -t -c)
strip_readme=$(node -r fs -p -e 'fs.readFileSync("./README.md", "utf-8").split(/# Benchmarks/)[0]')
git checkout master
echo -e "${strip_readme:?}\n${benchmark_title:?}\n\n${benchmark_table}" > README.md
git add README.md
git config user.name 'Github Actions'
git config user.email '<>'
git commit -m "Add new benchmarks to README.md"
git remote set-url --push origin https://${{ secrets.GITHUB_USERNAME }}:${{ secrets.GITHUB_REPO_TOKEN }}@github.com/fastify/benchmarks
git push