diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index c0c181a85..076865d23 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -46,6 +46,33 @@ jobs: retention-days: 7 if-no-files-found: ignore + - name: Archive raw log file + uses: actions/upload-artifact@v3 + if: always() + with: + name: raw.log + path: ~/Library/Logs/scan/IntegrationTests-IntegrationTests.log + retention-days: 2 + if-no-files-found: ignore + + + - name: Checkout gh-pages branch (for perf stats) + if: always() + uses: actions/checkout@v3 + with: + ref: gh-pages + path: gh-pages + + - name: Post-process archive to obtain performance metrics and upload to gh-pages + if: always() + run: | + ./Tools/Scripts/parsePerformanceMetrics.sh ~/Library/Logs/scan/IntegrationTests-IntegrationTests.log $GITHUB_SHA | tee perf-results.csv + cat perf-results.csv >> $GITHUB_WORKSPACE/gh-pages/performance/perf-data.csv + cd $GITHUB_WORKSPACE/gh-pages/performance/ + git add . + git commit -m "Results for $GITHUB_SHA" + git push + - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: diff --git a/Tools/Scripts/parsePerformanceMetrics.sh b/Tools/Scripts/parsePerformanceMetrics.sh new file mode 100755 index 000000000..33a4d5a41 --- /dev/null +++ b/Tools/Scripts/parsePerformanceMetrics.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Parses performance metrics from the full report of a IntegrationTest run (do not use xcpretty first!) +# This file can normally be found in `~/Library/Logs/scan/IntegrationTests-IntegrationTests.log` + +# Provide file as $1 +# Provide identifier (eg, date, GITHUB_SHA) as $2 + +echo "Parsing $1 for test results with identifier $2" >&2 + +NOW=`date -u -Iminutes` + +# Find all the measurement lines in the file, then strip out the gumph into a CSV-like format. +grep ".*measured.*values" $1 | sed -e "s/.*Test Case .*-\[//" -e "s/\]' measured \[/,/" -e "s/\].*values: \[/,/" -e "s/\], performance.*//" -e "s/^/$2,/" \ + -e "s/IntegrationTests.ApplicationTests testLaunchPerformance,Duration (AppLaunch), s/launchPerformance/" \ + -e "s/IntegrationTests.LoginTests testLoginFlow/loginPerformance/" \ + -e "s/^/$NOW,/" + +# The output should contain fields for the identifier, name, type, unit, then a list of recorded values (normally 5) + +# Put this into a file somewhere for later usage.