3535 NODE_VERSION : ' 20'
3636 PYTHON_VERSION : ' 3.11'
3737
38+ permissions :
39+ contents : read
40+
3841jobs :
3942 benchmark :
4043 name : Run Framework Benchmarks
@@ -43,18 +46,19 @@ jobs:
4346
4447 steps :
4548 - name : 📥 Checkout Repository
46- uses : actions/checkout@v4
49+ uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
4750 with :
4851 fetch-depth : 1
52+ persist-credentials : false
4953
5054 - name : 🔧 Setup Node.js
51- uses : actions/setup-node@v4
55+ uses : actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
5256 with :
5357 node-version : ${{ env.NODE_VERSION }}
5458 cache : ' npm'
5559
5660 - name : 🐍 Setup Python
57- uses : actions/setup-python@v4
61+ uses : actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
5862 with :
5963 python-version : ${{ env.PYTHON_VERSION }}
6064 cache : ' pip'
@@ -86,15 +90,17 @@ jobs:
8690 sudo apt-get install -y libasound2t64 || sudo apt-get install -y libasound2
8791
8892 - name : 🌐 Install Google Chrome
89- uses : browser-actions/setup-chrome@v1
93+ uses : browser-actions/setup-chrome@c785b87e244131f27c9f19c1a33e2ead956ab7ce # v1
9094 with :
9195 chrome-version : stable
9296 id : setup-chrome
9397
9498 - name : 📋 Verify Chrome Installation
99+ env :
100+ CHROME_PATH : ${{ steps.setup-chrome.outputs.chrome-path }}
95101 run : |
96- echo "Chrome path: ${{ steps.setup-chrome.outputs.chrome-path }} "
97- ${{ steps.setup-chrome.outputs.chrome-path }} --version
102+ echo "Chrome path: $CHROME_PATH "
103+ "$CHROME_PATH" --version
98104 which google-chrome || which chromium-browser || echo "Chrome executable not found in PATH"
99105
100106 - name : 🔧 Setup Project
@@ -162,48 +168,57 @@ jobs:
162168 echo "✅ Project verification complete"
163169
164170 - name : 🔧 Prepare Benchmark Environment
171+ env :
172+ COMMIT_TO_MAIN_INPUT : ${{ github.event.inputs.commit_to_main || 'false' }}
173+ BENCHMARK_TYPES_INPUT : ${{ github.event.inputs.benchmark_types || 'all' }}
174+ FRAMEWORKS_INPUT : ${{ github.event.inputs.frameworks || 'all' }}
175+ EXECUTIONS_INPUT : ${{ github.event.inputs.executions || '1' }}
165176 run : |
166- echo "PYTHONPATH=$PWD:$PWD/scripts" >> $GITHUB_ENV
167-
177+ echo "PYTHONPATH=$PWD:$PWD/scripts" >> " $GITHUB_ENV"
178+
168179 # Set commit behavior based on event type or manual input
169180 if [ "${{ github.event_name }}" = "schedule" ]; then
170- echo "COMMIT_TO_MAIN=false" >> $GITHUB_ENV
181+ echo "COMMIT_TO_MAIN=false" >> " $GITHUB_ENV"
171182 echo "⏰ Scheduled run - will skip main branch commit"
172- echo "SCHEDULED_RUN=true" >> $GITHUB_ENV
183+ echo "SCHEDULED_RUN=true" >> " $GITHUB_ENV"
173184 else
174- echo "COMMIT_TO_MAIN=${{ github.event.inputs.commit_to_main || 'false' }} " >> $GITHUB_ENV
175- echo "👤 Manual run - commit to main: ${{ github.event.inputs.commit_to_main || 'false' }} "
176- echo "SCHEDULED_RUN=false" >> $GITHUB_ENV
185+ echo "COMMIT_TO_MAIN=$COMMIT_TO_MAIN_INPUT " >> " $GITHUB_ENV"
186+ echo "👤 Manual run - commit to main: $COMMIT_TO_MAIN_INPUT "
187+ echo "SCHEDULED_RUN=false" >> " $GITHUB_ENV"
177188 fi
178-
189+
179190 echo "📊 Benchmark Configuration:"
180- if [ "${{ env. SCHEDULED_RUN }} " = "true" ]; then
191+ if [ "$SCHEDULED_RUN" = "true" ]; then
181192 echo " Types: lighthouse,bundle-size,source-analysis,build-time,dev-server,resource-usage (scheduled)"
182193 echo " Frameworks: all (scheduled)"
183194 echo " Executions: 5 (scheduled)"
184195 else
185- echo " Types: ${{ github.event.inputs.benchmark_types || 'all' }} "
186- echo " Frameworks: ${{ github.event.inputs.frameworks || 'all' }} "
187- echo " Executions: ${{ github.event.inputs.executions || '1' }} "
196+ echo " Types: $BENCHMARK_TYPES_INPUT "
197+ echo " Frameworks: $FRAMEWORKS_INPUT "
198+ echo " Executions: $EXECUTIONS_INPUT "
188199 fi
189- echo " Commit to Main: ${{ env. COMMIT_TO_MAIN }} "
200+ echo " Commit to Main: $COMMIT_TO_MAIN"
190201
191202 - name : 🧪 Run Benchmarks
203+ env :
204+ BENCHMARK_TYPES_INPUT : ${{ github.event.inputs.benchmark_types }}
205+ FRAMEWORKS_INPUT : ${{ github.event.inputs.frameworks }}
206+ EXECUTIONS_INPUT : ${{ github.event.inputs.executions }}
192207 run : |
193208 set -e # Exit on error
194-
209+
195210 # Configure parameters based on trigger type
196- if [ "${{ env. SCHEDULED_RUN }} " = "true" ]; then
211+ if [ "$SCHEDULED_RUN" = "true" ]; then
197212 # Scheduled run: comprehensive benchmarks
198213 benchmark_types="lighthouse,bundle-size,source-analysis,build-time,dev-server,resource-usage"
199214 frameworks="" # All frameworks
200215 executions="5"
201216 echo "⏰ Scheduled run configuration: all benchmarks, all frameworks, 5 executions"
202217 else
203218 # Manual run: use provided inputs
204- benchmark_types="${{ github.event.inputs.benchmark_types }} "
205- frameworks="${{ github.event.inputs.frameworks }} "
206- executions="${{ github.event.inputs.executions }} "
219+ benchmark_types="$BENCHMARK_TYPES_INPUT "
220+ frameworks="$FRAMEWORKS_INPUT "
221+ executions="$EXECUTIONS_INPUT "
207222 fi
208223
209224 # Build command arguments for the benchmark script
@@ -260,36 +275,42 @@ jobs:
260275 - name : 📊 Generate Benchmark Summary
261276 if : always()
262277 run : |
263- echo "## 📊 Benchmark Results Summary" >> $GITHUB_STEP_SUMMARY
264- echo "" >> $GITHUB_STEP_SUMMARY
265- echo "- **Run Date**: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY
278+ {
279+ echo "## 📊 Benchmark Results Summary"
280+ echo ""
281+ echo "- **Run Date**: $(date -u '+%Y-%m-%d %H:%M:%S UTC')"
282+ } >> "$GITHUB_STEP_SUMMARY"
266283
267284 # Check if benchmarks ran successfully
268285 if [ -d "benchmark-results" ] && [ "$(find benchmark-results -name "*.json" -type f | wc -l)" -gt 0 ]; then
269286 result_count=$(find benchmark-results -name "*.json" -type f | wc -l)
270287 latest_dir=$(find benchmark-results -mindepth 1 -maxdepth 1 -type d | sort -r | head -1)
271288
272- echo "- **Status**: ✅ Success" >> $GITHUB_STEP_SUMMARY
273- echo "- **Results Generated**: $result_count files" >> $GITHUB_STEP_SUMMARY
274- echo "- **Artifacts**: Available for download below" >> $GITHUB_STEP_SUMMARY
289+ {
290+ echo "- **Status**: ✅ Success"
291+ echo "- **Results Generated**: $result_count files"
292+ echo "- **Artifacts**: Available for download below"
293+ } >> "$GITHUB_STEP_SUMMARY"
275294
276295 if [ -n "$latest_dir" ]; then
277- echo "- **Latest Results**: $(basename "$latest_dir")" >> $GITHUB_STEP_SUMMARY
296+ echo "- **Latest Results**: $(basename "$latest_dir")" >> " $GITHUB_STEP_SUMMARY"
278297 fi
279298 else
280- echo "- **Status**: ❌ Failed" >> $GITHUB_STEP_SUMMARY
281- echo "- **Reason**: Benchmarks did not complete successfully" >> $GITHUB_STEP_SUMMARY
282- echo "- **Check**: Review the workflow logs for error details" >> $GITHUB_STEP_SUMMARY
283- echo "- **Artifacts**: Debug logs may be available below (if any)" >> $GITHUB_STEP_SUMMARY
299+ {
300+ echo "- **Status**: ❌ Failed"
301+ echo "- **Reason**: Benchmarks did not complete successfully"
302+ echo "- **Check**: Review the workflow logs for error details"
303+ echo "- **Artifacts**: Debug logs may be available below (if any)"
304+ } >> "$GITHUB_STEP_SUMMARY"
284305 fi
285306
286307 - name : 📋 Save Workflow Context
287308 run : |
288- echo '{ "commit_to_main": "${{ env. COMMIT_TO_MAIN }}"}' > workflow-context.json
309+ echo "{\ "commit_to_main\ ": \ "${COMMIT_TO_MAIN}\"}" > workflow-context.json
289310 cat workflow-context.json
290311
291312 - name : 📤 Upload Benchmark Results
292- uses : actions/upload-artifact@v4
313+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
293314 if : always()
294315 with :
295316 name : benchmark-results-${{ github.run_number }}
@@ -301,7 +322,7 @@ jobs:
301322 compression-level : 6
302323
303324 - name : 📤 Upload Detailed Logs
304- uses : actions/upload-artifact@v4
325+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
305326 if : failure()
306327 with :
307328 name : benchmark-logs-${{ github.run_number }}
0 commit comments