Skip to content

Commit e94d4e0

Browse files
committed
Fix app version handling in the benchmark workflow
1 parent bf1b6ef commit e94d4e0

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
@@ -67,6 +67,9 @@ env:
6767
FORTIO_VERSION: "1.73.0"
6868
K6_VERSION: "1.3.0"
6969
VEGETA_VERSION: "12.13.0"
70+
# Determine which apps to run (default is 'pro_only' for all triggers)
71+
RUN_CORE: ${{ (github.event.inputs.app_version || 'pro_only') != 'pro_only' && 'true' || '' }}
72+
RUN_PRO: ${{ (github.event.inputs.app_version || 'pro_only') != 'core_only' && 'true' || '' }}
7073
# Benchmark parameters (defaults in bench.rb unless overridden here for CI)
7174
ROUTES: ${{ github.event.inputs.routes }}
7275
RATE: ${{ github.event.inputs.rate || 'max' }}
@@ -213,30 +216,30 @@ jobs:
213216
run: cd packages/react-on-rails && yarn install --no-progress --no-emoji --frozen-lockfile && yalc publish
214217

215218
- name: yalc add react-on-rails
216-
if: github.event.inputs.app_version != 'pro_only'
219+
if: env.RUN_CORE
217220
run: cd spec/dummy && yalc add react-on-rails
218221

219-
- name: Install Node modules with Yarn for dummy app
220-
if: github.event.inputs.app_version != 'pro_only'
222+
- name: Install Node modules with Yarn for Core dummy app
223+
if: env.RUN_CORE
221224
run: cd spec/dummy && yarn install --no-progress --no-emoji
222225

223-
- name: Save dummy app ruby gems to cache
224-
if: github.event.inputs.app_version != 'pro_only'
226+
- name: Save Core dummy app ruby gems to cache
227+
if: env.RUN_CORE
225228
uses: actions/cache@v4
226229
with:
227230
path: spec/dummy/vendor/bundle
228231
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}
229232

230-
- name: Install Ruby Gems for dummy app
231-
if: github.event.inputs.app_version != 'pro_only'
233+
- name: Install Ruby Gems for Core dummy app
234+
if: env.RUN_CORE
232235
run: |
233236
cd spec/dummy
234237
bundle lock --add-platform 'x86_64-linux'
235238
bundle config set path vendor/bundle
236239
bundle _2.5.4_ check || bundle _2.5.4_ install --jobs=4 --retry=3
237240
238-
- name: Prepare production assets
239-
if: github.event.inputs.app_version != 'pro_only'
241+
- name: Prepare Core production assets
242+
if: env.RUN_CORE
240243
run: |
241244
set -e # Exit on any error
242245
echo "🔨 Building production assets..."
@@ -249,8 +252,8 @@ jobs:
249252
250253
echo "✅ Production assets built successfully"
251254
252-
- name: Start production server
253-
if: github.event.inputs.app_version != 'pro_only'
255+
- name: Start Core production server
256+
if: env.RUN_CORE
254257
run: |
255258
set -e # Exit on any error
256259
echo "🚀 Starting production server..."
@@ -279,7 +282,7 @@ jobs:
279282
# ============================================
280283

281284
- name: Execute Core benchmark suite
282-
if: github.event.inputs.app_version != 'pro_only'
285+
if: env.RUN_CORE
283286
timeout-minutes: 120
284287
run: |
285288
set -e # Exit on any error
@@ -293,7 +296,7 @@ jobs:
293296
echo "✅ Benchmark suite completed successfully"
294297
295298
- name: Validate Core benchmark results
296-
if: github.event.inputs.app_version != 'pro_only'
299+
if: env.RUN_CORE
297300
run: |
298301
set -e # Exit on any error
299302
echo "🔍 Validating benchmark output files..."
@@ -333,7 +336,7 @@ jobs:
333336
334337
- name: Upload Core benchmark results
335338
uses: actions/upload-artifact@v4
336-
if: github.event.inputs.app_version != 'pro_only' && always()
339+
if: env.RUN_CORE && always()
337340
with:
338341
name: benchmark-core-results-${{ github.run_number }}
339342
path: bench_results/
@@ -344,51 +347,51 @@ jobs:
344347
# STEP 6: SETUP PRO APPLICATION SERVER
345348
# ============================================
346349
- name: Cache Pro package node modules
347-
if: github.event.inputs.app_version != 'core_only'
350+
if: env.RUN_PRO
348351
uses: actions/cache@v4
349352
with:
350353
path: react_on_rails_pro/node_modules
351354
key: v4-pro-package-node-modules-cache-${{ hashFiles('react_on_rails_pro/yarn.lock') }}
352355

353356
- name: Cache Pro dummy app node modules
354-
if: github.event.inputs.app_version != 'core_only'
357+
if: env.RUN_PRO
355358
uses: actions/cache@v4
356359
with:
357360
path: react_on_rails_pro/spec/dummy/node_modules
358361
key: v4-pro-dummy-app-node-modules-cache-${{ hashFiles('react_on_rails_pro/spec/dummy/yarn.lock') }}
359362

360363
- name: Cache Pro dummy app Ruby gems
361-
if: github.event.inputs.app_version != 'core_only'
364+
if: env.RUN_PRO
362365
uses: actions/cache@v4
363366
with:
364367
path: react_on_rails_pro/spec/dummy/vendor/bundle
365368
key: v4-pro-dummy-app-gem-cache-${{ hashFiles('react_on_rails_pro/spec/dummy/Gemfile.lock') }}
366369

367370
- name: Install Node modules with Yarn for Pro package
368-
if: github.event.inputs.app_version != 'core_only'
371+
if: env.RUN_PRO
369372
run: |
370373
cd react_on_rails_pro
371374
sudo yarn global add yalc
372375
yarn install --frozen-lockfile --no-progress --no-emoji
373376
374377
- name: Install Node modules with Yarn for Pro dummy app
375-
if: github.event.inputs.app_version != 'core_only'
378+
if: env.RUN_PRO
376379
run: cd react_on_rails_pro/spec/dummy && yarn install --frozen-lockfile --no-progress --no-emoji
377380

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

390393
- name: Prepare Pro production assets
391-
if: github.event.inputs.app_version != 'core_only'
394+
if: env.RUN_PRO
392395
run: |
393396
set -e
394397
echo "🔨 Building Pro production assets..."
@@ -402,7 +405,7 @@ jobs:
402405
echo "✅ Production assets built successfully"
403406
404407
- name: Start Pro production server
405-
if: github.event.inputs.app_version != 'core_only'
408+
if: env.RUN_PRO
406409
run: |
407410
set -e
408411
echo "🚀 Starting Pro production server..."
@@ -431,7 +434,7 @@ jobs:
431434
# ============================================
432435

433436
- name: Execute Pro benchmark suite
434-
if: github.event.inputs.app_version != 'core_only'
437+
if: env.RUN_PRO
435438
timeout-minutes: 120
436439
run: |
437440
set -e
@@ -445,7 +448,7 @@ jobs:
445448
echo "✅ Benchmark suite completed successfully"
446449
447450
- name: Validate Pro benchmark results
448-
if: github.event.inputs.app_version != 'core_only'
451+
if: env.RUN_PRO
449452
run: |
450453
set -e
451454
echo "🔍 Validating Pro benchmark output files..."
@@ -481,7 +484,7 @@ jobs:
481484
482485
- name: Upload Pro benchmark results
483486
uses: actions/upload-artifact@v4
484-
if: github.event.inputs.app_version != 'core_only' && always()
487+
if: env.RUN_PRO && always()
485488
with:
486489
name: benchmark-pro-results-${{ github.run_number }}
487490
path: bench_results/
@@ -500,7 +503,8 @@ jobs:
500503
echo "Run number: ${{ github.run_number }}"
501504
echo "Triggered by: ${{ github.actor }}"
502505
echo "Branch: ${{ github.ref_name }}"
503-
echo "App version: ${{ github.event.inputs.app_version || 'both' }}"
506+
echo "Run Core: ${{ env.RUN_CORE }}"
507+
echo "Run Pro: ${{ env.RUN_PRO }}"
504508
echo ""
505509
if [ "${{ job.status }}" == "success" ]; then
506510
echo "✅ All steps completed successfully"

0 commit comments

Comments
 (0)