Skip to content

Commit

Permalink
Move parsing performance to own step
Browse files Browse the repository at this point in the history
  • Loading branch information
sirbrillig committed Dec 8, 2024
1 parent a3759ff commit f45a26a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/csqa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,17 @@ jobs:
run: |
PHPCS_OUTPUT=$(./vendor/bin/phpcs --standard=VariableAnalysis --report=Performance ./PHPMailer.php)
echo "${PHPCS_OUTPUT}"
TOTAL_SECS=$(echo ${PHPCS_OUTPUT}| grep -Eo 'TOTAL SNIFF PROCESSING TIME[ ]+[0-9.]+'|awk '{ print $5 }')
echo "-----"
echo "PHPCS_PERF_REPORT=${PHPCS_OUTPUT}" >> $GITHUB_OUTPUT
- name: Parse performance report
id: parse_performance_report
run: |
TOTAL_SECS=$(echo ${{ steps.performance_report.outputs.PHPCS_PERF_REPORT }}| grep -Eo 'TOTAL SNIFF PROCESSING TIME[ ]+[0-9.]+'|awk '{ print $5 }')
echo "Performance time was ${TOTAL_SECS} (max ${{ env.MAX_PHPCS_PERF_SECS }})"
echo "PHPCS_PERF_SECS=${TOTAL_SECS}" >> $GITHUB_OUTPUT
# fromJSON is used to convert strings to numbers in github actions.
# @link https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#operators
- name: Compare performance to baseline
if: ${{ fromJSON( steps.performance_report.outputs.PHPCS_PERF_SECS ) > fromJSON( env.MAX_PHPCS_PERF_SECS ) }}
if: ${{ fromJSON( steps.parse_performance_report.outputs.PHPCS_PERF_SECS ) > fromJSON( env.MAX_PHPCS_PERF_SECS ) }}
run: exit 1

0 comments on commit f45a26a

Please sign in to comment.