Skip to content

Commit ad3649e

Browse files
authored
New: [AEA-5411] - Initialise notify load test action (#453)
## Summary - ✨ New Feature ### Details In order to run a Github Action, it needs to be present on the main branch. This is a small PR that just brings over my YAML action definition from #452 so I can run and test it from that PR without needing to merge it.
1 parent 9be2d3a commit ad3649e

File tree

1 file changed

+129
-0
lines changed

1 file changed

+129
-0
lines changed
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Run psu notify load test
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
environment:
7+
description: 'Environment to run tests against. Allowed values are dev or ref'
8+
required: true
9+
default: 'ref'
10+
arrivalRate:
11+
description: 'The number of new users to add every second'
12+
required: true
13+
default: '275'
14+
duration:
15+
description: 'The duration of the main test'
16+
required: true
17+
default: '900'
18+
rampUpDuration:
19+
description: 'The duration to ramp up to the arrival rate'
20+
required: true
21+
default: '900'
22+
maxVusers:
23+
description: 'Maximum number of vusers to create'
24+
required: true
25+
default: '10000'
26+
27+
jobs:
28+
run_artillery:
29+
name: Run Artillery
30+
runs-on: ubuntu-latest
31+
permissions:
32+
id-token: write
33+
contents: read
34+
steps:
35+
- name: Show input params
36+
shell: bash
37+
run: |
38+
echo "## environment : ${{ github.event.inputs.environment }}" >> "$GITHUB_STEP_SUMMARY"
39+
echo "## arrivalRate : ${{ github.event.inputs.arrivalRate }}" >> "$GITHUB_STEP_SUMMARY"
40+
echo "## duration : ${{ github.event.inputs.duration }}" >> "$GITHUB_STEP_SUMMARY"
41+
echo "## rampUpDuration : ${{ github.event.inputs.rampUpDuration }}" >> "$GITHUB_STEP_SUMMARY"
42+
echo "## maxVusers : ${{ github.event.inputs.maxVusers }}" >> "$GITHUB_STEP_SUMMARY"
43+
44+
- name: Checkout repo
45+
uses: actions/checkout@v4
46+
with:
47+
ref: ${{ env.BRANCH_NAME }}
48+
49+
- name: Install asdf
50+
uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
51+
with:
52+
asdf_branch: v0.14.0
53+
54+
- name: Cache asdf
55+
uses: actions/cache@v4
56+
with:
57+
path: |
58+
~/.asdf
59+
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
60+
restore-keys: |
61+
${{ runner.os }}-asdf-
62+
63+
- name: Install asdf dependencies in .tool-versions
64+
uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
65+
with:
66+
asdf_branch: v0.14.0
67+
env:
68+
PYTHON_CONFIGURE_OPTS: --enable-shared
69+
70+
- name: Install Dependencies
71+
run: make install
72+
73+
- name: Assume dev artillery runner role
74+
if: github.event.inputs.environment == 'dev'
75+
uses: aws-actions/configure-aws-credentials@v4
76+
with:
77+
aws-region: eu-west-2
78+
role-to-assume: ${{ secrets.DEV_ARTILLERY_RUNNER_ROLE }}
79+
role-session-name: github-actions-artillery
80+
81+
- name: Assume ref artillery runner role
82+
if: github.event.inputs.environment == 'ref'
83+
uses: aws-actions/configure-aws-credentials@v4
84+
with:
85+
aws-region: eu-west-2
86+
role-to-assume: ${{ secrets.REF_ARTILLERY_RUNNER_ROLE }}
87+
role-session-name: github-actions-artillery
88+
89+
- name: Run load tests
90+
shell: bash
91+
env:
92+
environment: ${{ github.event.inputs.environment }}
93+
arrivalRate: ${{ github.event.inputs.arrivalRate }}
94+
duration: ${{ github.event.inputs.duration }}
95+
rampUpDuration: ${{ github.event.inputs.rampUpDuration }}
96+
maxVusers: ${{ github.event.inputs.maxVusers }}
97+
run: |
98+
./scripts/run_notify_load_test.sh
99+
100+
- uses: actions/upload-artifact@v4
101+
if: always()
102+
name: Upload test_report
103+
with:
104+
name: test_report
105+
path: |
106+
notify_load_test.json
107+
notify_load_test.json.html
108+
109+
- name: Upload artifacts to S3, if we are using REF environment
110+
if: github.event.inputs.environment == 'ref'
111+
continue-on-error: true
112+
env:
113+
AWS_REGION: eu-west-2
114+
BUCKET_NAME: artilleryio-test-data-${{ secrets.AWS_ACCOUNT_ID }}
115+
RUN_ID: ${{ github.run_id }}
116+
run: |
117+
aws s3 cp notify_load_test.json s3://$BUCKET_NAME/reports/$RUN_ID/notify_load_test.json --acl public-read
118+
aws s3 cp notify_load_test.json.html s3://$BUCKET_NAME/reports/$RUN_ID/notify_load_test.json.html --acl public-read
119+
120+
- name: Output link to HTML report
121+
if: github.event.inputs.environment == 'ref'
122+
env:
123+
AWS_REGION: eu-west-2
124+
BUCKET_NAME: artilleryio-test-data-${{ secrets.AWS_ACCOUNT_ID }}
125+
RUN_ID: ${{ github.run_id }}
126+
run: |
127+
REPORT_URL="https://$BUCKET_NAME.s3.${AWS_REGION}.amazonaws.com/reports/$RUN_ID/notify_load_test.json.html"
128+
echo "Test report is hosted at: $REPORT_URL" >> "$GITHUB_STEP_SUMMARY"
129+
echo "::set-output name=report_url::$REPORT_URL"

0 commit comments

Comments
 (0)