forked from tailcallhq/tailcall
-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (96 loc) · 2.98 KB
/
Copy pathbenchmark.yml
File metadata and controls
115 lines (96 loc) · 2.98 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Benchmark
on:
pull_request:
types: [opened, synchronize, labeled]
branches:
- main
workflow_dispatch:
inputs:
branch:
description: "Branch to run benchmark on"
required: true
default: "main"
jobs:
benchmark:
name: Macro Benchmarks
if: contains(github.event.pull_request.labels.*.name, 'benchmark')
runs-on: benchmarking-runner
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- name: Install Stable Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Cache Rust Dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run Cargo Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Run Tailcall
run: |
./target/release/tailcall start ci-benchmark/benchmark.graphql&
- name: Install Nginx
run: |
sudo apt-get update
sudo apt-get install -y nginx
- name: Clean Up
run: |
sudo rm -rf /etc/nginx/sites-enabled/default
- name: Copy Nginx Configuration
working-directory: ci-benchmark
run: |
sudo cp nginx.conf /etc/nginx/
- name: Test Nginx Configuration
run: |
sudo nginx -t
- name: Start Nginx
run: |
sudo systemctl start nginx
- name: Install Wrk
run: |
sudo apt-get install -y wrk
- name: Run Test Query
run: |
curl -i -X POST -d '{"query": "{posts{title}}"}' http://localhost:8000/graphql -H "Content-Type: application/json"
- id: run_wrk
name: Run Wrk
working-directory: ci-benchmark
run: |
wrk -d 30 -t 1 -c 100 -s wrk.lua http://localhost:8000/graphql > wrk-output.txt
- id: convert_wrk_output_markdown
name: Convert Output to Markdown
working-directory: ci-benchmark
run: |
node wrk-output-to-md.js wrk-output.txt > wrk-output.md
- id: cat_md
name: Cat Markdown
working-directory: ci-benchmark
run: |
cat wrk-output.md
- id: get_comment_body
name: Get Comment Body
working-directory: ci-benchmark
run: |
body="$(cat wrk-output.md)"
delimiter="$(openssl rand -hex 8)"
echo "body<<$delimiter" >> $GITHUB_OUTPUT
echo "$body" >> $GITHUB_OUTPUT
echo "$delimiter" >> $GITHUB_OUTPUT
- name: Create Commit Comment
uses: peter-evans/commit-comment@v3
with:
sha: ${{github.event.pull_request.head.sha}}
body: ${{steps.get_comment_body.outputs.body}}