Skip to content

Testing

Testing #180

Workflow file for this run

name: 📋 Performance Test
on:
pull_request:
types: [ synchronize, opened, reopened, ready_for_review ]
concurrency:
group: performance-test-${{ github.head_ref }}
cancel-in-progress: true
jobs:
test:
name: Performance Test
runs-on: ubuntu-latest
# This is really expensive, so we only want to run it when we need to.
if: contains(github.event.pull_request.labels.*.name, 'performance-test-needed')
strategy:
matrix:
configuration:
- control # Without Compass installed.
- installed # Compass installed but not enabled.
- enabled # Compass enabled by collector not running.
- collector # Compass enabled and collector running.
steps:
- name: ⬇️ Git clone the repository
uses: actions/checkout@v4
# Uncomment for CPU / Memory / IO statistics.
# - name: Collect Workflow Telemetry
# uses: catchpoint/workflow-telemetry-action@v2
- name: 📁 Init
run: |
# Create performance testing results directory.
sudo mkdir -p /tmp/output
sudo chmod 777 /tmp/output
- name: 📦 Build Images
run: |
docker build -t localhost/compass:nginx-latest .github/workflows/performance/docker/compose/nginx
docker build -t localhost/compass:php-fpm-latest .github/workflows/performance/docker/compose/php-fpm
docker build --no-cache --build-arg=PHP_VERSION=8.4 -t localhost/compass:latest .
docker build -t localhost/compass:php-fpm-ext-latest .github/workflows/performance/docker/compose/php-fpm-ext
- name: 📦 Setup
run: |
cd .github/workflows/performance/matrix/${{ matrix.configuration }}
docker compose up -d --wait
docker compose exec --user=root php-fpm chown skpr:skpr /data/app/sites/default/files
docker compose exec --user=root php-fpm chown skpr:skpr /mnt/private
docker compose exec --user=root php-fpm chown skpr:skpr /mnt/temporary
docker compose exec -e PHP_MEMORY_LIMIT=512M php-fpm vendor/bin/drush si demo_umami
- name: 🧪 K6 - Execute Performance Test
run: |
bash .github/workflows/performance/scripts/k6_run.sh .github/workflows/performance/scenarios/basic.js /tmp/output report.json
- name: 📋 Save Logs (Debugging)
if: always()
run: |
cd .github/workflows/performance/matrix/${{ matrix.configuration }}
bash logs.sh /tmp/output
- name: 📋 Archive Output
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.configuration }}
path: |
/tmp/output
results:
name: Compare Results
runs-on: ubuntu-latest
needs: test
# This is really expensive, so we only want to run it when we need to.
if: contains(github.event.pull_request.labels.*.name, 'performance-test-needed')
steps:
- name: ⬇️ Git clone the repository
uses: actions/checkout@v4
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4
- name: 📋 Review Test Results
run: |
go run .github/workflows/performance/scripts/results.go
- name: 📋 Post Test Results to Summary
if: always()
run: cat summary.md >> $GITHUB_STEP_SUMMARY