Skip to content

Commit 698b1dd

Browse files
committed
Refactor to print output of phpcs alone
1 parent f0271f8 commit 698b1dd

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

.github/workflows/csqa.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ jobs:
110110
name: "Basic Performance Guard"
111111
runs-on: ubuntu-latest
112112

113+
env:
114+
MAX_PHPCS_PERF_SECS: 0.6
115+
113116
steps:
114117
- name: Checkout code
115118
uses: actions/checkout@v4
@@ -134,13 +137,18 @@ jobs:
134137

135138
- name: Run performance report
136139
id: performance_report
137-
run: echo "PHPCS_PERF_SECS=$(./vendor/bin/phpcs --standard=VariableAnalysis --report=Performance ./PHPMailer.php | grep -Eo 'TOTAL SNIFF PROCESSING TIME[ ]+[0-9.]+'|awk '{ print $5 }')" >> $GITHUB_OUTPUT
138-
139-
- name: Log performance
140-
run: echo "${{ steps.performance_report.outputs.PHPCS_PERF_SECS }}"
140+
run: |
141+
set -x
142+
PHPCS_OUTPUT=$(./vendor/bin/phpcs --standard=VariableAnalysis --report=Performance ./PHPMailer.php)
143+
set +x
144+
echo "${PHPCS_OUTPUT}"
145+
TOTAL_SECS=$(echo ${PHPCS_OUTPUT}| grep -Eo 'TOTAL SNIFF PROCESSING TIME[ ]+[0-9.]+'|awk '{ print $5 }')
146+
echo "-----"
147+
echo "Performance time was ${TOTAL_SECS} (max ${{ env.MAX_PHPCS_PERF_SECS }})"
148+
echo "PHPCS_PERF_SECS=${TOTAL_SECS}" >> $GITHUB_OUTPUT
141149
142150
# fromJSON is used to convert strings to numbers in github actions.
143151
# @link https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#operators
144152
- name: Compare performance to baseline
145-
if: ${{ fromJSON( steps.performance_report.outputs.PHPCS_PERF_SECS ) > 0.6 }}
153+
if: ${{ fromJSON( steps.performance_report.outputs.PHPCS_PERF_SECS ) > fromJSON( env.MAX_PHPCS_PERF_SECS ) }}
146154
run: exit 1

0 commit comments

Comments
 (0)