Skip to content

Commit 9b3dd8f

Browse files
committed
Fix app version handling in the benchmark workflow
1 parent 65a114d commit 9b3dd8f

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.4.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' }}
@@ -229,30 +232,30 @@ jobs:
229232
run: cd packages/react-on-rails && yarn install --no-progress --no-emoji --frozen-lockfile && yalc publish
230233

231234
- name: yalc add react-on-rails
232-
if: github.event.inputs.app_version != 'pro_only'
235+
if: env.RUN_CORE
233236
run: cd spec/dummy && yalc add react-on-rails
234237

235-
- name: Install Node modules with Yarn for dummy app
236-
if: github.event.inputs.app_version != 'pro_only'
238+
- name: Install Node modules with Yarn for Core dummy app
239+
if: env.RUN_CORE
237240
run: cd spec/dummy && yarn install --no-progress --no-emoji
238241

239-
- name: Save dummy app ruby gems to cache
240-
if: github.event.inputs.app_version != 'pro_only'
242+
- name: Save Core dummy app ruby gems to cache
243+
if: env.RUN_CORE
241244
uses: actions/cache@v4
242245
with:
243246
path: spec/dummy/vendor/bundle
244247
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}
245248

246-
- name: Install Ruby Gems for dummy app
247-
if: github.event.inputs.app_version != 'pro_only'
249+
- name: Install Ruby Gems for Core dummy app
250+
if: env.RUN_CORE
248251
run: |
249252
cd spec/dummy
250253
bundle lock --add-platform 'x86_64-linux'
251254
bundle config set path vendor/bundle
252255
bundle _2.5.4_ check || bundle _2.5.4_ install --jobs=4 --retry=3
253256
254-
- name: Prepare production assets
255-
if: github.event.inputs.app_version != 'pro_only'
257+
- name: Prepare Core production assets
258+
if: env.RUN_CORE
256259
run: |
257260
set -e # Exit on any error
258261
echo "🔨 Building production assets..."
@@ -265,8 +268,8 @@ jobs:
265268
266269
echo "✅ Production assets built successfully"
267270
268-
- name: Start production server
269-
if: github.event.inputs.app_version != 'pro_only'
271+
- name: Start Core production server
272+
if: env.RUN_CORE
270273
run: |
271274
set -e # Exit on any error
272275
echo "🚀 Starting production server..."
@@ -295,7 +298,7 @@ jobs:
295298
# ============================================
296299

297300
- name: Execute Core benchmark suite
298-
if: github.event.inputs.app_version != 'pro_only'
301+
if: env.RUN_CORE
299302
timeout-minutes: 120
300303
run: |
301304
set -e # Exit on any error
@@ -309,7 +312,7 @@ jobs:
309312
echo "✅ Benchmark suite completed successfully"
310313
311314
- name: Validate Core benchmark results
312-
if: github.event.inputs.app_version != 'pro_only'
315+
if: env.RUN_CORE
313316
run: |
314317
set -e # Exit on any error
315318
echo "🔍 Validating benchmark output files..."
@@ -349,7 +352,7 @@ jobs:
349352
350353
- name: Upload Core benchmark results
351354
uses: actions/upload-artifact@v4
352-
if: github.event.inputs.app_version != 'pro_only' && always()
355+
if: env.RUN_CORE && always()
353356
with:
354357
name: benchmark-core-results-${{ github.run_number }}
355358
path: bench_results/
@@ -360,51 +363,51 @@ jobs:
360363
# STEP 6: SETUP PRO APPLICATION SERVER
361364
# ============================================
362365
- name: Cache Pro package node modules
363-
if: github.event.inputs.app_version != 'core_only'
366+
if: env.RUN_PRO
364367
uses: actions/cache@v4
365368
with:
366369
path: react_on_rails_pro/node_modules
367370
key: v4-pro-package-node-modules-cache-${{ hashFiles('react_on_rails_pro/yarn.lock') }}
368371

369372
- name: Cache Pro dummy app node modules
370-
if: github.event.inputs.app_version != 'core_only'
373+
if: env.RUN_PRO
371374
uses: actions/cache@v4
372375
with:
373376
path: react_on_rails_pro/spec/dummy/node_modules
374377
key: v4-pro-dummy-app-node-modules-cache-${{ hashFiles('react_on_rails_pro/spec/dummy/yarn.lock') }}
375378

376379
- name: Cache Pro dummy app Ruby gems
377-
if: github.event.inputs.app_version != 'core_only'
380+
if: env.RUN_PRO
378381
uses: actions/cache@v4
379382
with:
380383
path: react_on_rails_pro/spec/dummy/vendor/bundle
381384
key: v4-pro-dummy-app-gem-cache-${{ hashFiles('react_on_rails_pro/spec/dummy/Gemfile.lock') }}
382385

383386
- name: Install Node modules with Yarn for Pro package
384-
if: github.event.inputs.app_version != 'core_only'
387+
if: env.RUN_PRO
385388
run: |
386389
cd react_on_rails_pro
387390
sudo yarn global add yalc
388391
yarn install --frozen-lockfile --no-progress --no-emoji
389392
390393
- name: Install Node modules with Yarn for Pro dummy app
391-
if: github.event.inputs.app_version != 'core_only'
394+
if: env.RUN_PRO
392395
run: cd react_on_rails_pro/spec/dummy && yarn install --frozen-lockfile --no-progress --no-emoji
393396

394397
- name: Install Ruby Gems for Pro dummy app
395-
if: github.event.inputs.app_version != 'core_only'
398+
if: env.RUN_PRO
396399
run: |
397400
cd react_on_rails_pro/spec/dummy
398401
bundle lock --add-platform 'x86_64-linux'
399402
bundle config set path vendor/bundle
400403
bundle _2.5.4_ check || bundle _2.5.4_ install --jobs=4 --retry=3
401404
402405
- name: Generate file-system based entrypoints for Pro
403-
if: github.event.inputs.app_version != 'core_only'
406+
if: env.RUN_PRO
404407
run: cd react_on_rails_pro/spec/dummy && bundle exec rake react_on_rails:generate_packs
405408

406409
- name: Prepare Pro production assets
407-
if: github.event.inputs.app_version != 'core_only'
410+
if: env.RUN_PRO
408411
run: |
409412
set -e
410413
echo "🔨 Building Pro production assets..."
@@ -418,7 +421,7 @@ jobs:
418421
echo "✅ Production assets built successfully"
419422
420423
- name: Start Pro production server
421-
if: github.event.inputs.app_version != 'core_only'
424+
if: env.RUN_PRO
422425
run: |
423426
set -e
424427
echo "🚀 Starting Pro production server..."
@@ -447,7 +450,7 @@ jobs:
447450
# ============================================
448451

449452
- name: Execute Pro benchmark suite
450-
if: github.event.inputs.app_version != 'core_only'
453+
if: env.RUN_PRO
451454
timeout-minutes: 120
452455
run: |
453456
set -e
@@ -461,7 +464,7 @@ jobs:
461464
echo "✅ Benchmark suite completed successfully"
462465
463466
- name: Validate Pro benchmark results
464-
if: github.event.inputs.app_version != 'core_only'
467+
if: env.RUN_PRO
465468
run: |
466469
set -e
467470
echo "🔍 Validating Pro benchmark output files..."
@@ -497,7 +500,7 @@ jobs:
497500
498501
- name: Upload Pro benchmark results
499502
uses: actions/upload-artifact@v4
500-
if: github.event.inputs.app_version != 'core_only' && always()
503+
if: env.RUN_PRO && always()
501504
with:
502505
name: benchmark-pro-results-${{ github.run_number }}
503506
path: bench_results/
@@ -516,7 +519,8 @@ jobs:
516519
echo "Run number: ${{ github.run_number }}"
517520
echo "Triggered by: ${{ github.actor }}"
518521
echo "Branch: ${{ github.ref_name }}"
519-
echo "App version: ${{ github.event.inputs.app_version || 'both' }}"
522+
echo "Run Core: ${{ env.RUN_CORE }}"
523+
echo "Run Pro: ${{ env.RUN_PRO }}"
520524
echo ""
521525
if [ "${{ job.status }}" == "success" ]; then
522526
echo "✅ All steps completed successfully"

0 commit comments

Comments
 (0)