Skip to content

Commit 0bb780d

Browse files
committed
add daily tests run
1 parent 9743447 commit 0bb780d

File tree

3 files changed

+301
-2
lines changed

3 files changed

+301
-2
lines changed
+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: Guardian CI API Tests(after commit)
2+
on:
3+
push:
4+
branches-ignore:
5+
- 'dependabot/**'
6+
7+
jobs:
8+
buildAndTest:
9+
name: Build and Test
10+
runs-on: ubuntu-latest
11+
services:
12+
cache:
13+
image: registry.redict.io/redict
14+
ports:
15+
- 6379:6379
16+
strategy:
17+
matrix:
18+
node-version: [ 20.18.1 ]
19+
mongodb-version: [ 7.0.5 ]
20+
steps:
21+
- name: Harden Runner
22+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
23+
with:
24+
egress-policy: audit
25+
26+
- name: Checkout Code
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
29+
- name: Use Node.js ${{ matrix.node-version }}
30+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af #v4.1.0
31+
with:
32+
node-version: ${{ matrix.node-version }}
33+
34+
- name: Setup Yarn
35+
uses: Borales/actions-yarn@3766bb1335b98fb13c60eaf358fe20811b730a88 # v5.0.0
36+
with:
37+
cmd: install
38+
39+
- name: Install dependencies
40+
run: yarn install
41+
42+
- name: Build packages
43+
run: |
44+
# sudo apt-get update
45+
# sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb
46+
pushd interfaces
47+
yarn run build
48+
popd
49+
pushd common
50+
yarn run build
51+
popd
52+
pushd notification-service
53+
yarn run build
54+
popd
55+
pushd logger-service
56+
yarn run build
57+
popd
58+
pushd auth-service
59+
yarn run build
60+
popd
61+
pushd queue-service
62+
yarn run build
63+
popd
64+
pushd guardian-service
65+
yarn run build
66+
popd
67+
pushd policy-service
68+
yarn run build
69+
popd
70+
pushd worker-service
71+
yarn run build
72+
popd
73+
pushd api-gateway
74+
yarn run build
75+
popd
76+
77+
- name: Start NatsMQ
78+
uses: step-security/nats-action@0306fc1c4e4f49dbe4db5865a3135ab1516a5aee # v0.1.0
79+
with:
80+
port: '4222'
81+
82+
- name: Start MongoDB
83+
uses: step-security/mongodb-github-action@ff3d5a3dec0957be7ef99d3d1c9ca4499e8a4cb8 # v1.11.0
84+
with:
85+
mongodb-version: ${{ matrix.mongodb-version }}
86+
87+
- name: Run Guardian
88+
run: |
89+
pushd notification-service
90+
npm start &
91+
sleep 20
92+
popd
93+
pushd logger-service
94+
npm start &
95+
sleep 20
96+
popd
97+
pushd auth-service
98+
npm start &
99+
sleep 20
100+
popd
101+
pushd guardian-service
102+
npm start &
103+
sleep 20
104+
popd
105+
pushd policy-service
106+
npm start &
107+
sleep 20
108+
popd
109+
pushd queue-service
110+
npm start &
111+
sleep 20
112+
popd
113+
pushd worker-service
114+
npm start &
115+
npm start &
116+
npm start &
117+
npm start &
118+
npm start &
119+
sleep 20
120+
popd
121+
pushd api-gateway
122+
npm start &
123+
sleep 20
124+
popd
125+
sleep 60
126+
env:
127+
CI: true
128+
OPERATOR_ID: ${{ secrets.CI_HEDERA_ACCOUNT }}
129+
OPERATOR_KEY: ${{ secrets.CI_HEDERA_PRIV_KEY }}
130+
JWT_PRIVATE_KEY: ${{ secrets.CI_JWT_PRIVATE_KEY }}
131+
JWT_PUBLIC_KEY: ${{ secrets.CI_JWT_PUBLIC_KEY }}
132+
IPFS_NODE_ADDRESS: http://localhost:5001
133+
IPFS_PROVIDER: web3storage
134+
IPFS_PUBLIC_GATEWAY: https://dweb.link/ipfs/${cid}
135+
IPFS_STORAGE_KEY: ${{ secrets.E2E_IPFS_STORAGE_KEY }}
136+
IPFS_STORAGE_PROOF: ${{ secrets.E2E_IPFS_STORAGE_PROOF }}
137+
ACCESS_TOKEN_UPDATE_INTERVAL: 600000
138+
139+
- name: Run tests with Cypress
140+
run: |
141+
pushd e2e-tests
142+
npm install
143+
npx cypress run --env "portApi=3002,operatorId=${{ secrets.CI_HEDERA_ACCOUNT }},operatorKey=${{ secrets.CI_HEDERA_PRIV_KEY }},grepTags=smoke,grepFilterSpecs=true" --spec "cypress/e2e/api-tests/**/*.cy.js" --browser chrome
144+
popd
145+
146+
- name: Publish API Test Results
147+
uses: EnricoMi/publish-unit-test-result-action@170bf24d20d201b842d7a52403b73ed297e6645b # v2.18.0
148+
if: always()
149+
with:
150+
files: e2e-tests/cypress/test_results/**/*.xml

.github/workflows/api-manual.yml

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ jobs:
2929

3030
- name: Checkout Code
3131
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32-
with:
33-
ref: 'develop'
3432

3533
- name: Use Node.js ${{ matrix.node-version }}
3634
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af #v4.1.0

.github/workflows/api-schedule.yml

+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
name: Guardian CI API Tests daily
2+
on:
3+
schedule:
4+
- cron: '0 1 * * *'
5+
6+
jobs:
7+
buildAndTest:
8+
name: Build and Test
9+
runs-on: ubuntu-latest
10+
services:
11+
cache:
12+
image: registry.redict.io/redict
13+
ports:
14+
- 6379:6379
15+
strategy:
16+
matrix:
17+
node-version: [ 20.18.1 ]
18+
mongodb-version: [ 7.0.5 ]
19+
steps:
20+
- name: Harden Runner
21+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
22+
with:
23+
egress-policy: audit
24+
25+
- name: Checkout Code
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
with:
28+
ref: 'develop'
29+
30+
- name: Use Node.js ${{ matrix.node-version }}
31+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af #v4.1.0
32+
with:
33+
node-version: ${{ matrix.node-version }}
34+
35+
- name: Setup Yarn
36+
uses: Borales/actions-yarn@3766bb1335b98fb13c60eaf358fe20811b730a88 # v5.0.0
37+
with:
38+
cmd: install
39+
40+
- name: Install dependencies
41+
run: yarn install
42+
43+
- name: Build packages
44+
run: |
45+
# sudo apt-get update
46+
# sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb
47+
pushd interfaces
48+
yarn run build
49+
popd
50+
pushd common
51+
yarn run build
52+
popd
53+
pushd notification-service
54+
yarn run build
55+
popd
56+
pushd logger-service
57+
yarn run build
58+
popd
59+
pushd auth-service
60+
yarn run build
61+
popd
62+
pushd queue-service
63+
yarn run build
64+
popd
65+
pushd guardian-service
66+
yarn run build
67+
popd
68+
pushd policy-service
69+
yarn run build
70+
popd
71+
pushd worker-service
72+
yarn run build
73+
popd
74+
pushd api-gateway
75+
yarn run build
76+
popd
77+
78+
- name: Start NatsMQ
79+
uses: step-security/nats-action@0306fc1c4e4f49dbe4db5865a3135ab1516a5aee # v0.1.0
80+
with:
81+
port: '4222'
82+
83+
- name: Start MongoDB
84+
uses: step-security/mongodb-github-action@ff3d5a3dec0957be7ef99d3d1c9ca4499e8a4cb8 # v1.11.0
85+
with:
86+
mongodb-version: ${{ matrix.mongodb-version }}
87+
88+
- name: Run Guardian
89+
run: |
90+
pushd notification-service
91+
npm start &
92+
sleep 20
93+
popd
94+
pushd logger-service
95+
npm start &
96+
sleep 20
97+
popd
98+
pushd auth-service
99+
npm start &
100+
sleep 20
101+
popd
102+
pushd guardian-service
103+
npm start &
104+
sleep 20
105+
popd
106+
pushd policy-service
107+
npm start &
108+
sleep 20
109+
popd
110+
pushd queue-service
111+
npm start &
112+
sleep 20
113+
popd
114+
pushd worker-service
115+
npm start &
116+
npm start &
117+
npm start &
118+
npm start &
119+
npm start &
120+
sleep 20
121+
popd
122+
pushd api-gateway
123+
npm start &
124+
sleep 20
125+
popd
126+
sleep 60
127+
env:
128+
CI: true
129+
OPERATOR_ID: ${{ secrets.CI_HEDERA_ACCOUNT }}
130+
OPERATOR_KEY: ${{ secrets.CI_HEDERA_PRIV_KEY }}
131+
JWT_PRIVATE_KEY: ${{ secrets.CI_JWT_PRIVATE_KEY }}
132+
JWT_PUBLIC_KEY: ${{ secrets.CI_JWT_PUBLIC_KEY }}
133+
IPFS_NODE_ADDRESS: http://localhost:5001
134+
IPFS_PROVIDER: web3storage
135+
IPFS_PUBLIC_GATEWAY: https://dweb.link/ipfs/${cid}
136+
IPFS_STORAGE_KEY: ${{ secrets.E2E_IPFS_STORAGE_KEY }}
137+
IPFS_STORAGE_PROOF: ${{ secrets.E2E_IPFS_STORAGE_PROOF }}
138+
ACCESS_TOKEN_UPDATE_INTERVAL: 600000
139+
140+
- name: Run tests with Cypress
141+
run: |
142+
pushd e2e-tests
143+
npm install
144+
npx cypress run --env "portApi=3002,operatorId=${{ secrets.CI_HEDERA_ACCOUNT }},operatorKey=${{ secrets.CI_HEDERA_PRIV_KEY }},grepTags=all,grepFilterSpecs=true" --spec "cypress/e2e/api-tests/**/*.cy.js" --browser chrome
145+
popd
146+
147+
- name: Publish API Test Results
148+
uses: EnricoMi/publish-unit-test-result-action@170bf24d20d201b842d7a52403b73ed297e6645b # v2.18.0
149+
if: always()
150+
with:
151+
files: e2e-tests/cypress/test_results/**/*.xml

0 commit comments

Comments
 (0)