Skip to content

Commit 2f658c5

Browse files
committed
Fix app version handling in the benchmark workflow
1 parent 2943eaf commit 2f658c5

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

.github/workflows/benchmark.yml

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ env:
7272
FORTIO_VERSION: "1.73.0"
7373
K6_VERSION: "1.3.0"
7474
VEGETA_VERSION: "12.13.0"
75+
# Determine which apps to run (default is 'pro_only' for all triggers)
76+
RUN_CORE: ${{ (github.event.inputs.app_version || 'pro_only') != 'pro_only' && 'true' || '' }}
77+
RUN_PRO: ${{ (github.event.inputs.app_version || 'pro_only') != 'core_only' && 'true' || '' }}
7578
# Benchmark parameters (defaults in bench.rb unless overridden here for CI)
7679
ROUTES: ${{ github.event.inputs.routes }}
7780
RATE: ${{ github.event.inputs.rate || 'max' }}
@@ -218,30 +221,30 @@ jobs:
218221
run: cd packages/react-on-rails && yarn install --no-progress --no-emoji --frozen-lockfile && yalc publish
219222

220223
- name: yalc add react-on-rails
221-
if: github.event.inputs.app_version != 'pro_only'
224+
if: env.RUN_CORE
222225
run: cd spec/dummy && yalc add react-on-rails
223226

224-
- name: Install Node modules with Yarn for dummy app
225-
if: github.event.inputs.app_version != 'pro_only'
227+
- name: Install Node modules with Yarn for Core dummy app
228+
if: env.RUN_CORE
226229
run: cd spec/dummy && yarn install --no-progress --no-emoji
227230

228-
- name: Save dummy app ruby gems to cache
229-
if: github.event.inputs.app_version != 'pro_only'
231+
- name: Save Core dummy app ruby gems to cache
232+
if: env.RUN_CORE
230233
uses: actions/cache@v4
231234
with:
232235
path: spec/dummy/vendor/bundle
233236
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}
234237

235-
- name: Install Ruby Gems for dummy app
236-
if: github.event.inputs.app_version != 'pro_only'
238+
- name: Install Ruby Gems for Core dummy app
239+
if: env.RUN_CORE
237240
run: |
238241
cd spec/dummy
239242
bundle lock --add-platform 'x86_64-linux'
240243
bundle config set path vendor/bundle
241244
bundle _2.5.4_ check || bundle _2.5.4_ install --jobs=4 --retry=3
242245
243-
- name: Prepare production assets
244-
if: github.event.inputs.app_version != 'pro_only'
246+
- name: Prepare Core production assets
247+
if: env.RUN_CORE
245248
run: |
246249
set -e # Exit on any error
247250
echo "🔨 Building production assets..."
@@ -254,8 +257,8 @@ jobs:
254257
255258
echo "✅ Production assets built successfully"
256259
257-
- name: Start production server
258-
if: github.event.inputs.app_version != 'pro_only'
260+
- name: Start Core production server
261+
if: env.RUN_CORE
259262
run: |
260263
set -e # Exit on any error
261264
echo "🚀 Starting production server..."
@@ -284,7 +287,7 @@ jobs:
284287
# ============================================
285288

286289
- name: Execute Core benchmark suite
287-
if: github.event.inputs.app_version != 'pro_only'
290+
if: env.RUN_CORE
288291
timeout-minutes: 120
289292
run: |
290293
set -e # Exit on any error
@@ -298,7 +301,7 @@ jobs:
298301
echo "✅ Benchmark suite completed successfully"
299302
300303
- name: Validate Core benchmark results
301-
if: github.event.inputs.app_version != 'pro_only'
304+
if: env.RUN_CORE
302305
run: |
303306
set -e # Exit on any error
304307
echo "🔍 Validating benchmark output files..."
@@ -338,7 +341,7 @@ jobs:
338341
339342
- name: Upload Core benchmark results
340343
uses: actions/upload-artifact@v4
341-
if: github.event.inputs.app_version != 'pro_only' && always()
344+
if: env.RUN_CORE && always()
342345
with:
343346
name: benchmark-core-results-${{ github.run_number }}
344347
path: bench_results/
@@ -349,51 +352,51 @@ jobs:
349352
# STEP 6: SETUP PRO APPLICATION SERVER
350353
# ============================================
351354
- name: Cache Pro package node modules
352-
if: github.event.inputs.app_version != 'core_only'
355+
if: env.RUN_PRO
353356
uses: actions/cache@v4
354357
with:
355358
path: react_on_rails_pro/node_modules
356359
key: v4-pro-package-node-modules-cache-${{ hashFiles('react_on_rails_pro/yarn.lock') }}
357360

358361
- name: Cache Pro dummy app node modules
359-
if: github.event.inputs.app_version != 'core_only'
362+
if: env.RUN_PRO
360363
uses: actions/cache@v4
361364
with:
362365
path: react_on_rails_pro/spec/dummy/node_modules
363366
key: v4-pro-dummy-app-node-modules-cache-${{ hashFiles('react_on_rails_pro/spec/dummy/yarn.lock') }}
364367

365368
- name: Cache Pro dummy app Ruby gems
366-
if: github.event.inputs.app_version != 'core_only'
369+
if: env.RUN_PRO
367370
uses: actions/cache@v4
368371
with:
369372
path: react_on_rails_pro/spec/dummy/vendor/bundle
370373
key: v4-pro-dummy-app-gem-cache-${{ hashFiles('react_on_rails_pro/spec/dummy/Gemfile.lock') }}
371374

372375
- name: Install Node modules with Yarn for Pro package
373-
if: github.event.inputs.app_version != 'core_only'
376+
if: env.RUN_PRO
374377
run: |
375378
cd react_on_rails_pro
376379
sudo yarn global add yalc
377380
yarn install --frozen-lockfile --no-progress --no-emoji
378381
379382
- name: Install Node modules with Yarn for Pro dummy app
380-
if: github.event.inputs.app_version != 'core_only'
383+
if: env.RUN_PRO
381384
run: cd react_on_rails_pro/spec/dummy && yarn install --frozen-lockfile --no-progress --no-emoji
382385

383386
- name: Install Ruby Gems for Pro dummy app
384-
if: github.event.inputs.app_version != 'core_only'
387+
if: env.RUN_PRO
385388
run: |
386389
cd react_on_rails_pro/spec/dummy
387390
bundle lock --add-platform 'x86_64-linux'
388391
bundle config set path vendor/bundle
389392
bundle _2.5.4_ check || bundle _2.5.4_ install --jobs=4 --retry=3
390393
391394
- name: Generate file-system based entrypoints for Pro
392-
if: github.event.inputs.app_version != 'core_only'
395+
if: env.RUN_PRO
393396
run: cd react_on_rails_pro/spec/dummy && bundle exec rake react_on_rails:generate_packs
394397

395398
- name: Prepare Pro production assets
396-
if: github.event.inputs.app_version != 'core_only'
399+
if: env.RUN_PRO
397400
run: |
398401
set -e
399402
echo "🔨 Building Pro production assets..."
@@ -407,7 +410,7 @@ jobs:
407410
echo "✅ Production assets built successfully"
408411
409412
- name: Start Pro production server
410-
if: github.event.inputs.app_version != 'core_only'
413+
if: env.RUN_PRO
411414
run: |
412415
set -e
413416
echo "🚀 Starting Pro production server..."
@@ -436,7 +439,7 @@ jobs:
436439
# ============================================
437440

438441
- name: Execute Pro benchmark suite
439-
if: github.event.inputs.app_version != 'core_only'
442+
if: env.RUN_PRO
440443
timeout-minutes: 120
441444
run: |
442445
set -e
@@ -450,7 +453,7 @@ jobs:
450453
echo "✅ Benchmark suite completed successfully"
451454
452455
- name: Validate Pro benchmark results
453-
if: github.event.inputs.app_version != 'core_only'
456+
if: env.RUN_PRO
454457
run: |
455458
set -e
456459
echo "🔍 Validating Pro benchmark output files..."
@@ -486,7 +489,7 @@ jobs:
486489
487490
- name: Upload Pro benchmark results
488491
uses: actions/upload-artifact@v4
489-
if: github.event.inputs.app_version != 'core_only' && always()
492+
if: env.RUN_PRO && always()
490493
with:
491494
name: benchmark-pro-results-${{ github.run_number }}
492495
path: bench_results/
@@ -505,7 +508,8 @@ jobs:
505508
echo "Run number: ${{ github.run_number }}"
506509
echo "Triggered by: ${{ github.actor }}"
507510
echo "Branch: ${{ github.ref_name }}"
508-
echo "App version: ${{ github.event.inputs.app_version || 'both' }}"
511+
echo "Run Core: ${{ env.RUN_CORE }}"
512+
echo "Run Pro: ${{ env.RUN_PRO }}"
509513
echo ""
510514
if [ "${{ job.status }}" == "success" ]; then
511515
echo "✅ All steps completed successfully"

0 commit comments

Comments
 (0)