-
Notifications
You must be signed in to change notification settings - Fork 23
172 lines (153 loc) · 6.33 KB
/
performance-tests.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
name: Performance tests
concurrency:
group: ${{ github.head_ref }}${{ github.ref }}-performance-tests
cancel-in-progress: true
on:
pull_request:
push:
branches:
- "main"
workflow_dispatch:
env:
BENCHMARKING_DIR: "tests/performance-tests/agent-performance-tests-k6"
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
run-e2e-tests:
name: "Run performance tests"
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.title, '[skip ci]') }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java and Scala
uses: olafurpg/setup-scala@v14
with:
java-version: [email protected]
- name: Setup Gradle
uses: gradle/gradle-build-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ env.GITHUB_ACTOR }}
password: ${{ env.GITHUB_TOKEN }}
- uses: KengoTODA/actions-setup-docker-compose@v1
name: Install `docker-compose`
with:
version: "2.14.2"
- name: Build local version of Cloud Agent
env:
ENV_FILE: "infrastructure/local/.env"
run: |
sbt docker:publishLocal
AGENT_VERSION=$(cut version.sbt -d '=' -f2 | tr -d '" ')
sed -i.bak "s/AGENT_VERSION=.*/AGENT_VERSION=${AGENT_VERSION}/" "${ENV_FILE}" && rm -f "${ENV_FILE}.bak"
cat "${ENV_FILE}"
- name: Create Docker Network
run: |
docker network create agent-network || echo "Network already exists"
- name: Start services for prism node & postgres
env:
PG_PORT: 5432
NODE_REFRESH_AND_SUBMIT_PERIOD: 1s
NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD: 1s
NODE_WALLET_MAX_TPS: 1000
uses: hoverkraft-tech/[email protected]
with:
compose-file: "./infrastructure/shared/docker-compose-node.yml"
compose-flags: "--env-file ./infrastructure/local/.env -p prism-node"
up-flags: "--wait"
down-flags: "--volumes"
- name: Start services for issuer
env:
PORT: 8080
ADMIN_TOKEN: admin
DEFAULT_WALLET_ENABLED: true
DEFAULT_WALLET_AUTH_API_KEY: default
API_KEY_AUTO_PROVISIONING: false
API_KEY_ENABLED: true
DOCKERHOST: "host.docker.internal"
PG_PORT: 5432
NODE_REFRESH_AND_SUBMIT_PERIOD: 1s
NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD: 1s
NODE_WALLET_MAX_TPS: 1000
uses: hoverkraft-tech/[email protected]
with:
compose-file: "./infrastructure/shared/docker-compose-agent.yml"
compose-flags: "--env-file ./infrastructure/local/.env -p issuer"
up-flags: "--wait"
down-flags: "--volumes"
- name: Start services for holder
env:
PORT: 8090
ADMIN_TOKEN: admin
DEFAULT_WALLET_ENABLED: true
DEFAULT_WALLET_AUTH_API_KEY: default
API_KEY_AUTO_PROVISIONING: false
API_KEY_ENABLED: true
DOCKERHOST: "host.docker.internal"
PG_PORT: 5433
uses: isbang/[email protected]
with:
compose-file: "./infrastructure/shared/docker-compose-agent.yml"
compose-flags: "--env-file ./infrastructure/local/.env -p holder"
up-flags: "--wait"
down-flags: "--volumes"
- name: Start services for verifier
env:
PORT: 8100
ADMIN_TOKEN: admin
DEFAULT_WALLET_ENABLED: true
DEFAULT_WALLET_AUTH_API_KEY: default
API_KEY_AUTO_PROVISIONING: false
API_KEY_ENABLED: true
DOCKERHOST: "host.docker.internal"
PG_PORT: 5434
uses: isbang/[email protected]
with:
compose-file: "./infrastructure/shared/docker-compose-agent.yml"
compose-flags: "--env-file ./infrastructure/local/.env -p verifier"
up-flags: "--wait"
down-flags: "--volumes"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 16.x
registry-url: "https://npm.pkg.github.com"
scope: "input-output-hk"
- name: Install dependencies
uses: borales/actions-yarn@v5
with:
cmd: install
dir: ${{ env.BENCHMARKING_DIR }}
- name: Compile tests to JS
uses: borales/actions-yarn@v5
with:
cmd: webpack
dir: ${{ env.BENCHMARKING_DIR }}
- name: All Smoke Tests
env:
ISSUER_AGENT_API_KEY: default
HOLDER_AGENT_API_KEY: default
VERIFIER_AGENT_API_KEY: default
run: |
# Have to use manual download because GitHub action doesnt support localhost execution
curl https://github.com/grafana/k6/releases/download/v0.45.0/k6-v0.45.0-linux-amd64.tar.gz -L | tar xvz --strip-components 1
ls -la
./k6 run -e SCENARIO_LABEL=create-prism-did-smoke ${{ env.BENCHMARKING_DIR }}/dist/create-prism-did-test.js
./k6 run -e SCENARIO_LABEL=credential-offer-smoke ${{ env.BENCHMARKING_DIR }}/dist/credential-offer-test.js
./k6 run -e SCENARIO_LABEL=credential-definition-smoke ${{ env.BENCHMARKING_DIR }}/dist/credential-definition-test.js
./k6 run -e SCENARIO_LABEL=credential-schema-smoke ${{ env.BENCHMARKING_DIR }}/dist/credential-schema-test.js
./k6 run -e SCENARIO_LABEL=did-publishing-smoke ${{ env.BENCHMARKING_DIR }}/dist/did-publishing-test.js
./k6 run -e SCENARIO_LABEL=connection-flow-smoke ${{ env.BENCHMARKING_DIR }}/dist/connection-flow-test.js
./k6 run -e SCENARIO_LABEL=issuance-flow-smoke ${{ env.BENCHMARKING_DIR }}/dist/issuance-flow-test.js
./k6 run -e SCENARIO_LABEL=present-proof-flow-smoke ${{ env.BENCHMARKING_DIR }}/dist/present-proof-flow-test.js
- name: Remove Docker Network
if: always()
run: |
echo "Forcefully stopping all containers on agent-network"
docker ps -q --filter network=agent-network | xargs -r docker stop || echo "No containers to stop"
docker ps -a -q --filter network=agent-network | xargs -r docker rm || echo "No containers to remove"
docker network rm agent-network || echo "Network not found"