Skip to content

Commit 4f39c4f

Browse files
committed
Eliminate duplicate defaults in benchmark.yml
1 parent f2b9ef8 commit 4f39c4f

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

.github/workflows/benchmark.yml

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
name: Benchmark Workflow
22

3+
env:
4+
FORTIO_VERSION: "1.73.0"
5+
K6_VERSION: "1.3.0"
6+
VEGETA_VERSION: "12.13.0"
7+
# Benchmark parameters
8+
DEFAULT_RATE: &default_rate 'max'
9+
DEFAULT_DURATION_SEC: &default_duration_sec 30
10+
DEFAULT_REQUEST_TIMEOUT: &default_request_timeout '60s'
11+
DEFAULT_CONNECTIONS: &default_connections 10
12+
DEFAULT_WEB_CONCURRENCY: &default_web_concurrency 4
13+
DEFAULT_RAILS_THREADS: &default_rails_threads 3
14+
DEFAULT_TOOLS: &default_tools 'fortio,vegeta,k6'
15+
RATE: ${{ github.event.inputs.rate || env.DEFAULT_RATE }}
16+
DURATION_SEC: ${{ github.event.inputs.duration_sec || env.DEFAULT_DURATION_SEC }}
17+
REQUEST_TIMEOUT: ${{ github.event.inputs.request_timeout || env.DEFAULT_REQUEST_TIMEOUT }}
18+
CONNECTIONS: ${{ github.event.inputs.connections || env.DEFAULT_CONNECTIONS }}
19+
MAX_CONNECTIONS: ${{ github.event.inputs.max_connections || github.event.inputs.connections || env.DEFAULT_CONNECTIONS }}
20+
WEB_CONCURRENCY: ${{ github.event.inputs.web_concurrency || env.DEFAULT_WEB_CONCURRENCY }}
21+
RAILS_MAX_THREADS: ${{ github.event.inputs.rails_max_threads || env.DEFAULT_RAILS_THREADS }}
22+
RAILS_MIN_THREADS: ${{ github.event.inputs.rails_min_threads || github.event.inputs.rails_max_threads || env.DEFAULT_RAILS_THREADS }}
23+
TOOLS: ${{ github.event.inputs.tools || env.DEFAULT_TOOLS }}
24+
325
on:
426
# https://github.com/mxschmitt/action-tmate?tab=readme-ov-file#manually-triggered-debug
527
workflow_dispatch:
@@ -12,22 +34,22 @@ on:
1234
rate:
1335
description: 'Requests per second (use "max" for maximum throughput)'
1436
required: false
15-
default: 'max'
37+
default: *default_rate
1638
type: string
1739
duration_sec:
1840
description: 'Duration in seconds'
1941
required: false
20-
default: 30
42+
default: *default_duration_sec
2143
type: number
2244
request_timeout:
2345
description: 'Request timeout (e.g., "60s", "1m", "90s")'
2446
required: false
25-
default: '60s'
47+
default: *default_request_timeout
2648
type: string
2749
connections:
2850
description: 'Concurrent connections/virtual users'
2951
required: false
30-
default: 10
52+
default: *default_connections
3153
type: number
3254
max_connections:
3355
description: 'Maximum connections/virtual users'
@@ -36,12 +58,12 @@ on:
3658
web_concurrency:
3759
description: 'Number of Puma worker processes'
3860
required: false
39-
default: 4
61+
default: *default_web_concurrency
4062
type: number
4163
rails_max_threads:
4264
description: 'Maximum number of Puma threads'
4365
required: false
44-
default: 3
66+
default: *default_rails_threads
4567
type: number
4668
rails_min_threads:
4769
description: 'Minimum number of Puma threads (same as maximum if not set)'
@@ -50,28 +72,13 @@ on:
5072
tools:
5173
description: 'Comma-separated list of tools to run'
5274
required: false
53-
default: 'fortio,vegeta,k6'
75+
default: *default_tools
5476
type: string
5577
push:
5678
branches:
5779
- master
5880
pull_request:
5981

60-
env:
61-
FORTIO_VERSION: "1.73.0"
62-
K6_VERSION: "1.3.0"
63-
VEGETA_VERSION: "12.13.0"
64-
# Benchmark parameters
65-
RATE: ${{ github.event.inputs.rate || 'max' }}
66-
DURATION_SEC: ${{ github.event.inputs.duration_sec || '30' }}
67-
REQUEST_TIMEOUT: ${{ github.event.inputs.request_timeout || '60s' }}
68-
CONNECTIONS: ${{ github.event.inputs.connections || '10' }}
69-
MAX_CONNECTIONS: ${{ github.event.inputs.max_connections || github.event.inputs.connections || '10' }}
70-
WEB_CONCURRENCY: ${{ github.event.inputs.web_concurrency || '4' }}
71-
RAILS_MAX_THREADS: ${{ github.event.inputs.rails_max_threads || '3' }}
72-
RAILS_MIN_THREADS: ${{ github.event.inputs.rails_min_threads || github.event.inputs.rails_max_threads || '3' }}
73-
TOOLS: ${{ github.event.inputs.tools || 'fortio,vegeta,k6' }}
74-
7582
jobs:
7683
benchmark:
7784
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)