-
Notifications
You must be signed in to change notification settings - Fork 133
181 lines (180 loc) · 5.76 KB
/
pandoras_box.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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
---
name: Pandora's Box
on: # yamllint disable-line rule:truthy
workflow_dispatch:
inputs:
runner:
description: The runner to execute on
default: 'ubuntu-latest'
type: choice
options:
- ubuntu-latest
- devnet
- testnet
environment:
description: The environment to run against
required: false
type: environment
transaction_count:
default: '10000'
description: The number of transactions to send
type: string
transaction_batch:
default: '100'
description: The transaction batch size
type: string
mode:
default: 'EOA'
description: The mode for the stress test
type: choice
options:
- EOA
- ERC20
- ERC721
workflow_call:
inputs:
transaction_count:
required: true
description: The number of transactions to send
type: string
transaction_batch:
required: true
description: The transaction batch size
type: string
environment:
description: The environment to run against
type: string
required: true
runner:
required: true
type: string
description: The runner label to use
mode:
required: true
description: The mode for the stress test
type: string
secrets:
SLACK_PERFORMANCE_WEBHOOK_URL:
required: true
PANDORAS_TARGET:
required: true
PANDORAS_MNEMONIC:
required: true
jobs:
open_pandoras_box:
name: Open Pandora's Box
concurrency: ${{ inputs.environment }}_performance
environment: ${{ inputs.environment }}
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout Pandora's Box Repository
uses: actions/checkout@v3
with:
repository: trapesys/pandoras-box
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Prepare Pandora's Box
run: |
npm install -g yarn
yarn install && yarn build && yarn link
echo "$HOME/.yarn/bin" >> $GITHUB_PATH
- name: Notify Slack
if: false
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_PERFORMANCE_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "GitHub Action - Pandora's Box - Starting"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Status>"
}
}
]
}
- name: Install JQ
run: |
mkdir -p $HOME/.local/bin
curl -sLo $HOME/.local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 && chmod +x $HOME/.local/bin/jq
echo "$HOME/.local/bin" >> $GITHUB_PATH
- id: pandora
name: Open Pandora's Box
run: |
pandoras-box -url ${{ secrets.PANDORAS_TARGET }} --mode "${{ inputs.mode }}" -m "${{ secrets.PANDORAS_MNEMONIC }}" -b ${{ inputs.transaction_batch }} -t ${{ inputs.transaction_count }} -o pandorasConsequences.json
echo "::set-output name=tps::$(cat pandorasConsequences.json | jq -r '.averageTPS')"
- name: Archive Pandora's Consequences
continue-on-error: true
uses: actions/upload-artifact@v3
with:
name: pandoras-consequences-report
path: pandorasConsequences.json
- name: Notify Slack
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_PERFORMANCE_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Pandora's Box Results"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Approximate TPS: `${{ steps.pandora.outputs.tps }}`"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Total Transactions Sent: `${{ inputs.transaction_count }}`"
}
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Environment: `${{ inputs.environment }}`"
},
{
"type": "mrkdwn",
"text": "Test Mode: `${{ inputs.mode }}`"
},
{
"type": "mrkdwn",
"text": "JSON-RPC Endpoint: ${{ secrets.PANDORAS_TARGET }}"
},
{
"type": "mrkdwn",
"text": "Workflow: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Results>"
}
]
}
]
}