-
Notifications
You must be signed in to change notification settings - Fork 2
127 lines (113 loc) · 3.69 KB
/
performance_tests.yml
File metadata and controls
127 lines (113 loc) · 3.69 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Performance Tests
concurrency:
group: ${{ github.workflow }}
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to run tests against'
type: environment
required: true
default: "dev"
users:
description: 'Number of users to simulate'
type: number
required: true
default: 100
spawn_rate:
description: 'Rate to spawn users'
type: number
required: true
default: 20
run_time:
description: 'Duration to run the test for (e.g. 1m, 30s)'
type: string
required: true
default: "30s"
jobs:
performance_tests:
permissions:
id-token: write
issues: write
pull-requests: write
runs-on: ubuntu-22.04
environment: ${{ inputs.environment }}
steps:
- name: show_input_parameters
env:
environment: ${{ inputs.environment }}
log_level: "INFO"
run_time : ${{ inputs.run_time }}
users: ${{ inputs.users }}
spawn_rate: ${{ inputs.spawn_rate }}
run: |
echo "environment: ${environment}"
echo "log_level: ${log_level}"
echo "run_time: ${run_time}"
echo "users: ${users}"
echo "spawn_rate: ${spawn_rate}"
- name: Checkout
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
# using git commit sha for version of action to ensure we have stable version
- name: Install asdf
uses: asdf-vm/actions/setup@b7bcd026f18772e44fe1026d729e1611cc435d47
with:
asdf_version: 0.18.0
- name: Cache asdf
uses: actions/cache@v5
with:
path: |
~/.asdf
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
- name: Install asdf dependencies in .tool-versions
uses: asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47
with:
asdf_version: 0.18.0
env:
PYTHON_CONFIGURE_OPTS: --enable-shared
- name: Cache Virtualenv
uses: actions/cache@v5
id: cache-venv
with:
path: .venv
key: ${{ runner.os }}-venv-${{ hashFiles('pyproject.toml') }}
- name: Install Dependencies
if: steps.cache-venv.outputs.cache-hit != 'true'
run: make install
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v6.0.0 # NOSONAR
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/Eligibility-Signposting-API-E2E-Regression-Tests
aws-region: eu-west-2
- name: Validate performance test inputs
env:
USERS: ${{ inputs.users }}
SPAWN_RATE: ${{ inputs.spawn_rate }}
RUN_TIME: ${{ inputs.run_time }}
run: python tests/performance_tests/validate_inputs.py
- name: Performance Tests
id: tests
env:
ENVIRONMENT: ${{ inputs.environment }}
LOG_LEVEL: "INFO"
INPUT_TAG: "@performance"
USERS: ${{ inputs.users }}
SPAWN_RATE: ${{ inputs.spawn_rate }}
RUN_TIME: ${{ inputs.run_time }}
run: |
make run-performance-tests \
env="$ENVIRONMENT" \
log_level="$LOG_LEVEL" \
users="$USERS" \
spawn_rate="$SPAWN_RATE" \
run_time="$RUN_TIME"
- name: Upload Performance Report
if: always()
uses: actions/upload-artifact@v7
with:
name: performance-locust-report
path: |
temp/locust_report.html
temp/xray_metrics.json
temp/aws_logs_report.html
temp/locust_results.csv