-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (57 loc) · 2.14 KB
/
performance-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: 📋 Performance Test
on:
pull_request:
types: [ synchronize, opened, reopened, ready_for_review ]
concurrency:
group: preview-${{ github.head_ref }}
cancel-in-progress: true
env:
K6_SCRIPTS_DIR: ./performance-testing/scripts
K6_SCENARIO: ./performance-testing/scenarios/basic.js
K6_RESULTS_DIR: ./performance-testing/results
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: ⬇️ Git clone the repository
uses: actions/checkout@v3
- name: 📁 Init
run: |
# Set permissions for checkout.
sudo chown -R 1000:1000 $(pwd)
# Create performance testing results directory.
sudo mkdir -p ${K6_RESULTS_DIR}
sudo chmod 777 ${K6_RESULTS_DIR}
- name: 📦 Setup
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 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
run: |
docker compose stop
docker compose up -d --wait
- name: 🧪 K6 - Execute OpenTelemetry Enabled Performance Test
run: |
bash ${K6_SCRIPTS_DIR}/k6_run.sh ${K6_SCENARIO} ${K6_RESULTS_DIR} otel.json
- name: 📋 Review Test Results
id: review
run: |
BUDGET=200
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
if: always()
run: |
echo "results=$(cat ${K6_RESULTS_DIR}/comment.txt)" >> "$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.run.outputs.results }}