Skip to content

Tracking: release 1.0 and adopt semver #163

Tracking: release 1.0 and adopt semver

Tracking: release 1.0 and adopt semver #163

Workflow file for this run

on:
workflow_dispatch:
issue_comment:
types: [ created ]
name: Benchmark
jobs:
bench:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || (github.event.issue.pull_request && contains(github.event.comment.body, '!bench'))
steps:
- name: Install Hyperfine
run: |
wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb
sudo dpkg -i hyperfine_1.11.0_amd64.deb
- name: Get PR SHA
if: github.event_name == 'issue_comment'
id: sha
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const response = await github.request(context.payload.issue.pull_request.url);
return response.data.head.sha;
- name: Checkout PR
uses: actions/checkout@v2
with:
ref: ${{ steps.sha.outputs.result || github.sha }}
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
check-latest: true
cache: true
- name: Build PR
run: |
go build -o bench-pr ./bench
- name: Checkout main branch
uses: actions/checkout@v3
with:
clean: false
ref: main
- name: Build main
run: |
go build -o bench-main ./bench
- name: Start Redis
uses: shogo82148/actions-setup-redis@v1
with:
auto-start: true
redis-port: 6379
redis-version: '6.2'
redis-conf: |
requirepass RedisPassw0rd
appendonly yes
appendfsync always
- name: Start MySQL
run: sudo /etc/init.d/mysql start
- name: Run MySQL benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipmysql')
run: |
echo "## MySQL run" >> benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-mysql.md -n 'mysql-main' './bench-main -runs 2 -backend mysql' -n 'mysql-pr' './bench-pr -runs 2 -backend mysql'
cat bench-mysql.md >> benchmark.md
- name: Run SQLite benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipsqlite')
run: |
echo "## SQLite run" >> benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-sqlite.md -n 'sqlite-main' './bench-main -runs 2 -backend sqlite' -n 'sqlite-pr' './bench-pr -runs 2 -backend sqlite'
cat bench-sqlite.md >> benchmark.md
- name: Run Redis benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipredis')
run: |
echo "## Redis run" >> benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-redis.md -n 'redis-main' './bench-main -runs 2 -backend redis' -n 'redis-pr' './bench-pr -runs 2 -backend redis'
cat bench-redis.md >> benchmark.md
- name: Run large MySQL benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipmysql') && contains(github.event.comment.body, '!large')
run: |
echo "## Large MySQL payload run (1MB)" >> benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-mysql-l.md -n 'mysql-main' './bench-main -resultsize 1000000 -activities 10 -runs 2 -backend mysql -timeout 240s' -n 'mysql-pr' './bench-pr -resultsize 1000000 -activities 10 -runs 2 -backend mysql -timeout 240s'
cat bench-mysql-l.md >> benchmark.md
- name: Run large SQLite benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipsqlite') && contains(github.event.comment.body, '!large')
run: |
echo "## Large SQLite payload run (1MB)" >> benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-sqlite-l.md -n 'sqlite-main' './bench-main -resultsize 1000000 -activities 10 -runs 2 -backend sqlite -timeout 240s' -n 'sqlite-pr' './bench-pr -resultsize 1000000 -activities 10 -runs 2 -backend sqlite -timeout 240s'
cat bench-sqlite-l.md >> benchmark.md
- name: Run large Redis benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipredis') && contains(github.event.comment.body, '!large')
run: |
echo "## Large Redis payload run (1MB)" >> benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-redis-l.md -n 'redis-main' './bench-main -resultsize 1000000 -activities 10 -runs 2 -backend redis -timeout 240s' -n 'redis-pr' './bench-pr -resultsize 1000000 -activities 10 -runs 2 -backend redis -timeout 240s'
cat bench-redis-l.md >> benchmark.md
- name: Run very large MySQL benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipmysql') && contains(github.event.comment.body, '!verylarge')
run: |
echo "## Very Large MySQL payload run (5MB)" >> benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-mysql-vl.md -n 'mysql-main' './bench-main -resultsize 5000000 -runs 2 -backend mysql -timeout 240s' -n 'mysql-pr' './bench-pr -resultsize 5000000 -runs 2 -backend mysql -timeout 240s'
cat bench-mysql-vl.md >> benchmark.md
- name: Run very large SQLite benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipsqlite') && contains(github.event.comment.body, '!verylarge')
run: |
echo "## Very Large SQLite payload run (5MB)" >> benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-sqlite-vl.md -n 'sqlite-main' './bench-main -resultsize 5000000 -runs 2 -backend sqlite -timeout 240s' -n 'sqlite-pr' './bench-pr -resultsize 5000000 -runs 2 -backend sqlite -timeout 240s'
cat bench-sqlite-vl.md >> benchmark.md
- name: Run very large Redis benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipredis') && contains(github.event.comment.body, '!verylarge')
run: |
echo "## Very Large Redis payload run (5MB)" >> benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-redis-vl.md -n 'redis-main' './bench-main -resultsize 5000000 -runs 2 -backend redis -timeout 240s' -n 'redis-pr' './bench-pr -resultsize 5000000 -runs 2 -backend redis -timeout 240s'
cat bench-redis-vl.md >> benchmark.md
- run: |
cat ./benchmark.md
- name: Write a new comment
uses: peter-evans/create-or-update-comment@v2
continue-on-error: true
with:
issue-number: ${{ github.event.issue.number }}
body-file: ./benchmark.md