Skip to content

Commit c887f14

Browse files
committed
Add perf-guard github workflow
1 parent eb2b351 commit c887f14

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/csqa.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,35 @@ jobs:
105105

106106
- name: Run Static Analysis
107107
run: composer static-analysis
108+
109+
perf-guard:
110+
name: "Basic Performance Guard"
111+
runs-on: ubuntu-latest
112+
113+
steps:
114+
- name: Checkout code
115+
uses: actions/checkout@v4
116+
117+
- name: Install PHP
118+
uses: shivammathur/setup-php@v2
119+
with:
120+
php-version: "8.1"
121+
coverage: none
122+
123+
# Install dependencies and handle caching in one go.
124+
# Dependencies need to be installed to make sure the PHPUnit classes are recognized.
125+
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
126+
- name: Install Composer dependencies
127+
uses: "ramsey/composer-install@v3"
128+
with:
129+
# Bust the cache at least once a month - output format: YYYY-MM.
130+
custom-cache-suffix: $(date -u "+%Y-%m")
131+
132+
- name: Download performance test fixture
133+
run: wget https://raw.githubusercontent.com/WordPress/WordPress/refs/heads/master/wp-includes/PHPMailer/PHPMailer.php
134+
135+
- name: Run performance report
136+
run: _PHPCS_RUNTIME=$(./vendor/bin/phpcs --standard=VariableAnalysis --report=Performance ./PHPMailer.php | grep -Eo 'TOTAL RUN TIME[ ]+[0-9.]+'|awk '{ print $4 }')
137+
138+
- name: Compare performance to baseline
139+
run: if awk "BEGIN {exit !($_PHPC_RUNTIME > 0.6)}"; then exit 1; fi

0 commit comments

Comments
 (0)