Skip to content

Commit 16292ea

Browse files
nohwndCopilot
andcommitted
Run mock perf benchmark on push to the benchmark branch
workflow_dispatch only works for workflows on the default branch, so trigger on push to this feature branch instead, and revert the perf changes from the fixed pre-fix base commit so the toggle is independent of commit ordering. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 38f52ab commit 16292ea

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

.github/workflows/perf-mock-benchmark.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ name: Mock perf benchmark
22

33
# Temporary, manually-triggered benchmark to compare the mock hot path with and
44
# without the perf changes on Windows PowerShell 5.1 and PowerShell 7.
5-
# Trigger with: gh workflow run "Mock perf benchmark" --ref <branch>
5+
# Runs automatically on every push to the benchmark branch (workflow_dispatch
6+
# does not work here because this file is not on the default branch).
67

78
on:
89
workflow_dispatch:
10+
push:
11+
branches:
12+
- nohwnd-perf-profiling-pester
913

1014
jobs:
1115
benchmark:
@@ -15,7 +19,7 @@ jobs:
1519
- name: Checkout
1620
uses: actions/checkout@v4
1721
with:
18-
fetch-depth: 2 # need HEAD~1 to revert to the clean source
22+
fetch-depth: 10 # need history back to the clean base commit to revert the perf changes
1923

2024
- name: Build Pester (with perf changes)
2125
shell: pwsh
@@ -29,11 +33,11 @@ jobs:
2933
shell: powershell
3034
run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label 'CHANGES'
3135

32-
- name: Revert the perf changes (clean source)
36+
- name: Revert the perf changes (clean source at the pre-fix base commit)
3337
shell: pwsh
3438
run: |
35-
git checkout HEAD~1 -- src/functions/Mock.ps1 src/functions/Pester.Scoping.ps1
36-
git --no-pager diff --stat HEAD -- src/functions/Mock.ps1 src/functions/Pester.Scoping.ps1
39+
git checkout 2f6ca66 -- src/functions/Mock.ps1 src/functions/Pester.Scoping.ps1
40+
git --no-pager diff --stat 2f6ca66 -- src/functions/Mock.ps1 src/functions/Pester.Scoping.ps1
3741
3842
- name: Rebuild Pester (clean source, PowerShell-only change)
3943
shell: pwsh

0 commit comments

Comments
 (0)