Skip to content

Commit

Permalink
Adds Github comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nickschuch committed Feb 27, 2024
1 parent 4b0beb9 commit 9fb3382
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/performance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
K6_RESULTS_DIR: ./performance-testing/results

jobs:
performance-test:
run:
runs-on: ubuntu-latest

steps:
Expand All @@ -34,13 +34,13 @@ jobs:
run: |
OTEL_PHP_AUTOLOAD_ENABLED=false docker compose up -d --wait
docker compose exec php-cli composer install --prefer-dist
docker compose exec php-cli ./vendor/drush/drush/drush si demo_umami -y
docker compose exec php-cli drush si demo_umami -y
- name: 🧪 K6 - Execute Baseline Performance Test
run: |
bash ${K6_SCRIPTS_DIR}/k6_run.sh ${K6_SCENARIO} ${K6_RESULTS_DIR} baseline.json
- name: ⚙️ Enable OTEL
- name: ⚙️ Enable OpenTelemetry Auto Instrumentation
run: |
docker compose stop
docker compose up -d --wait
Expand All @@ -52,4 +52,21 @@ jobs:
- name: 📋 Review Test Results
run: |
BUDGET=200
bash ${K6_SCRIPTS_DIR}/review_results.sh ${K6_RESULTS_DIR}/baseline.json ${K6_RESULTS_DIR}/otel.json ${BUDGET}
bash ${K6_SCRIPTS_DIR}/review_results.sh ${K6_RESULTS_DIR}/baseline.json ${K6_RESULTS_DIR}/otel.json ${BUDGET} ${K6_RESULTS_DIR}/comment.txt
- name: 📦 Collect Test Result Comment Details
id: comment
if: always()
run: |
results=$(cat ${K6_RESULTS_DIR}/comment.txt)
echo "results=$results" >> "$GITHUB_OUTPUT"
- name: 📋 Post Test Results to Comment
uses: peter-evans/create-or-update-comment@v4
if: always()
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Performance Data
----------------
${{ steps.comment.outputs.results }}
5 changes: 3 additions & 2 deletions performance-testing/scripts/review_results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ if [[ "${BASH_SOURCE[0]}" = "$0" ]]; then
BASELINE_FILE=$1
OTEL_FILE=$2
BUDGET=$3

info "Starting performance review..."
PRETTY_REPORT=$4

fails_baseline=$(cat ${BASELINE_FILE} | jq -r .root_group.checks.ok.fails)
fails_otel=$(cat ${OTEL_FILE} | jq -r .root_group.checks.ok.fails)
Expand Down Expand Up @@ -53,6 +52,8 @@ if [[ "${BASH_SOURCE[0]}" = "$0" ]]; then

http_req_duration_diff=`expr $http_req_duration_otel - $http_req_duration_baseline`

echo "Before = ${http_req_duration_baseline}\nAfter = ${http_req_duration_otel}\nDifference = ${http_req_duration_diff}" > $PRETTY_REPORT

info "http_req_duration diff = ${http_req_duration_diff}"

if (( $http_req_duration_diff > $BUDGET )); then
Expand Down

0 comments on commit 9fb3382

Please sign in to comment.