-
Notifications
You must be signed in to change notification settings - Fork 168
179 lines (165 loc) · 5.12 KB
/
api-after-commit.yml
File metadata and controls
179 lines (165 loc) · 5.12 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
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
name: Guardian CI API Tests (After commit)
on:
push:
branches-ignore:
- 'dependabot/**'
jobs:
buildAndTest:
name: Build and Test
runs-on: guardian-linux-medium
services:
cache:
image: registry.redict.io/redict
ports:
- 6379:6379
strategy:
matrix:
node-version: [ 20.19.5 ]
mongodb-version: [ 7.0.21 ]
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with:
egress-policy: audit
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 #v6.2.0
with:
node-version: ${{ matrix.node-version }}
- name: Setup Yarn
uses: Borales/actions-yarn@3766bb1335b98fb13c60eaf358fe20811b730a88 # v5.0.0
with:
cmd: install
- name: Install dependencies
run: yarn install
- name: Build packages
run: |
pushd interfaces
yarn run build
popd
pushd common
yarn run build
popd
pushd notification-service
yarn run build
popd
pushd logger-service
yarn run build
popd
pushd auth-service
yarn run build
popd
pushd queue-service
yarn run build
popd
pushd topic-listener-service
yarn run build
popd
pushd guardian-service
yarn run build
popd
pushd policy-service
yarn run build
popd
pushd worker-service
yarn run build
popd
pushd api-gateway
yarn run build
popd
- name: Start NatsMQ
uses: step-security/nats-action@4c3a6529e7e03047bc23f178a4b47ea8f901d215 # v0.1.3
with:
port: '4222'
- name: Start MongoDB
uses: step-security/mongodb-github-action@7263579321780efeb685cdd6a2a356aad687ebab # v1.12.3
with:
mongodb-version: ${{ matrix.mongodb-version }}
- name: Run Guardian
run: |
pushd notification-service
npm start &
sleep 20
popd
pushd logger-service
npm start &
sleep 20
popd
pushd auth-service
npm start &
sleep 20
popd
pushd guardian-service
npm start &
sleep 20
popd
pushd policy-service
npm start &
sleep 20
popd
pushd queue-service
npm start &
sleep 20
popd
pushd topic-listener-service
npm start &
sleep 20
popd
pushd worker-service
npm start &
npm start &
npm start &
npm start &
npm start &
sleep 20
popd
pushd api-gateway
npm start &
sleep 20
popd
sleep 60
env:
CI: true
NODE_OPTIONS: '--openssl-legacy-provider'
OPERATOR_ID: ${{ secrets.CI_HEDERA_ACCOUNT }}
OPERATOR_KEY: ${{ secrets.CI_HEDERA_PRIV_KEY }}
JWT_PRIVATE_KEY: ${{ secrets.CI_JWT_PRIVATE_KEY }}
JWT_PUBLIC_KEY: ${{ secrets.CI_JWT_PUBLIC_KEY }}
SERVICE_JWT_PUBLIC_KEY_ALL: ${{ secrets.CI_JWT_PUBLIC_KEY }}
SERVICE_JWT_SECRET_KEY_ALL: ${{ secrets.CI_JWT_PRIVATE_KEY }}
IPFS_NODE_ADDRESS: http://localhost:5001
IPFS_PROVIDER: web3storage
IPFS_PUBLIC_GATEWAY: https://dweb.link/ipfs/${cid}
IPFS_STORAGE_KEY: ${{ secrets.E2E_IPFS_STORAGE_KEY }}
IPFS_STORAGE_PROOF: ${{ secrets.E2E_IPFS_STORAGE_PROOF }}
ACCESS_TOKEN_UPDATE_INTERVAL: 600000
MIN_PASSWORD_LENGTH: 4
PASSWORD_COMPLEXITY: easy
INITIAL_BALANCE: 2
INITIAL_STANDARD_REGISTRY_BALANCE: 10
- name: Build Cypress Docker image
run: docker build -t cypress-runner ./e2e-tests
- name: Run Cypress Tests in Docker
run: |
docker run --network host --name cypress-test-run \
-e CYPRESS_portApi=3002 \
-e CYPRESS_operatorId=${{ secrets.CI_HEDERA_ACCOUNT }} \
-e CYPRESS_operatorKey=${{ secrets.CI_HEDERA_PRIV_KEY }} \
-e CYPRESS_grepTags=smoke \
-e CYPRESS_grepFilterSpecs=true \
cypress-runner \
--browser chrome
- name: Copy test results from Docker container
if: always()
run: |
docker cp cypress-test-run:/e2e/cypress/test_results ./e2e-tests/cypress/test_results || true
- name: Cleanup Docker resources
if: always()
run: |
docker rm -f cypress-test-run || true
- name: Publish API Test Results
uses: step-security/publish-unit-test-result-action@7dff603bf17ef13dee847147bef8d7cd1728b566 # v2.22.0
if: always()
with:
files: e2e-tests/cypress/test_results/**/*.xml