Skip to content

RUN K6 LOAD TESTS

RUN K6 LOAD TESTS #60

Workflow file for this run

name: RUN K6 LOAD TESTS
on:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
inputs:
server_url:
required: false
type: string
description: server url that will be used as target of load test
default: https://condo.d.doma.ai
workflow_run:
workflows:
- '[review] Deploy'
types:
- completed
env:
SERVER_URL: ${{ inputs.server_url || 'https://review-master-condo.r.doma.ai' }}
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout code with submodules
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
ssh-key: ${{ secrets.SSH_DOCK_SERVER_PRIVATE_KEY }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: install packages
run: |
npm i -g turbo
yarn install --immutable
sudo gpg -k
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
sudo apt-get update
sudo apt-get install k6
- name: run k6 tests
run: |
yarn --cwd ./apps/condo/k6 webpack
export K6_BROWSER_HEADLESS=true
export K6_PROMETHEUS_RW_SERVER_URL=${{ secrets.K6_PROMETHEUS_RW_SERVER_URL }}
export K6_PROMETHEUS_RW_USERNAME=${{ secrets.K6_PROMETHEUS_USER }}
export K6_PROMETHEUS_RW_PASSWORD=${{ secrets.K6_PROMETHEUS_PASSWORD }}
export K6_PROMETHEUS_RW_TREND_STATS="avg,min,med,max,p(90),p(95),p(99)"
export BASE_URL=${{ github.event_name == 'schedule' && 'https://condo.d.doma.ai' || env.SERVER_URL }}
export AUTH_EMAIL=${{ secrets.K6_AUTH_EMAIL }}
export AUTH_PASSWORD=${{ secrets.K6_AUTH_PASSWORD }}
k6 -o experimental-prometheus-rw run --summary-trend-stats="avg,min,med,max,p(90),p(95),p(99)" apps/condo/k6/dist/ticket.test.js
k6 -o experimental-prometheus-rw run --summary-trend-stats="avg,min,med,max,p(90),p(95),p(99)" apps/condo/k6/dist/payment.test.js
k6 -o experimental-prometheus-rw run --summary-trend-stats="avg,min,med,max,p(90),p(95),p(99)" apps/condo/k6/dist/news.test.js
- name: Upload screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: screenshots
path: ./apps/condo/k6/screenshots
retention-days: 2