From f45a26ac8c5d6b863ae092cfd2aa14c3cffa68df Mon Sep 17 00:00:00 2001 From: Payton Swick Date: Sun, 8 Dec 2024 13:52:26 -0500 Subject: [PATCH] Move parsing performance to own step --- .github/workflows/csqa.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/csqa.yml b/.github/workflows/csqa.yml index cdfd6a0..4fbbc9b 100644 --- a/.github/workflows/csqa.yml +++ b/.github/workflows/csqa.yml @@ -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