-
Notifications
You must be signed in to change notification settings - Fork 258
93 lines (79 loc) · 2.57 KB
/
nginx-benchmark.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
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
name: Nginx Benchmark
on:
push:
paths-ignore: ["docs/**", "**.md"]
branches:
- main
pull_request:
paths-ignore: ["docs/**", "**.md"]
types: [opened, reopened, synchronize, labeled]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
nginx_benchmarks:
name: Nginx Benchmarks
if: "contains(github.event.pull_request.labels.*.name, 'ci: benchmark') || github.event_name == 'push'"
runs-on:
group: benchmarking-runner
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4
- name: Install Stable Toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Run Cargo Build
run: cargo build --release
- name: Run Tailcall
run: |
TAILCALL_LOG_LEVEL=error ./target/release/tailcall start ci-benchmark/nginx-benchmark.graphql > tailcall.log 2>&1 &
echo $! > tailcall_pid.txt
- name: Install Nginx
run: |
sudo apt-get install -y nginx
- name: Start Nginx
working-directory: ci-benchmark
run: |
nginx -c "$(pwd)/nginx.conf"
- 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"
- name: Warmup Wrk
working-directory: ci-benchmark
run: |
wrk -d 10 -t 4 -c 100 -s wrk.lua http://localhost:8000/graphql
- id: run_wrk
name: Run Wrk
working-directory: ci-benchmark
run: |
wrk -d 30 -t 4 -c 100 -s wrk.lua http://localhost:8000/graphql | tee wrk-output.txt
- id: check_tailcall
name: Check Tailcall Status
run: |
tailcall_pid=$(cat tailcall_pid.txt)
if ! kill -0 $tailcall_pid > /dev/null 2>&1; then
echo "Tailcall process has crashed. Log output:" >&2
cat tailcall.log >&2
exit 1
else
echo "Tailcall process is still running"
fi
- id: convert_wrk_output_markdown
name: Convert Output to Markdown
working-directory: ci-benchmark
run: |
node wrk-output-to-md.js wrk-output.txt > body.md
- id: cat_md
name: Cat Markdown
working-directory: ci-benchmark
run: |
cat body.md
- name: "Upload Artifact"
uses: actions/upload-artifact@v4
with:
name: body
path: ci-benchmark/body.md