Skip to content

Commit bc3f395

Browse files
authored
Merge pull request #6 from OceanProtocolEnterprise/galex-dev
Updates on PolicyServer implementation.
2 parents c4d5844 + 1295b7b commit bc3f395

File tree

16 files changed

+1821
-181
lines changed

16 files changed

+1821
-181
lines changed

.github/workflows/ci.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: 'CI'
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- '**'
8+
pull_request:
9+
branches:
10+
- '**'
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: 'v20.16.0'
20+
- name: Cache node_modules
21+
uses: actions/cache@v3
22+
with:
23+
path: ~/.npm
24+
key: ${{ runner.os }}-lint-cache-node-modules-${{ hashFiles('**/package-lock.json') }}
25+
restore-keys: ${{ runner.os }}-lint-cache-node-modules-
26+
- run: npm ci
27+
- run: npm run lint
28+
29+
build:
30+
runs-on: ${{ matrix.os }}
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
os: [ubuntu-latest]
36+
node: ['18.20.4', 'v20.16.0', 'v22.5.1']
37+
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: actions/setup-node@v4
41+
with:
42+
node-version: ${{ matrix.node }}
43+
- name: Cache node_modules
44+
uses: actions/cache@v3
45+
with:
46+
path: ~/.npm
47+
key: ${{ runner.os }}-${{ matrix.node }}-build-cache-node-modules-${{ hashFiles('**/package-lock.json') }}
48+
restore-keys: ${{ runner.os }}-${{ matrix.node }}-build-cache-node-modules-
49+
- run: npm ci
50+
- run: npm run build
51+
52+
test_unit:
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/checkout@v4
56+
- uses: actions/setup-node@v4
57+
with:
58+
node-version: 'v20.16.0'
59+
- name: Cache node_modules
60+
uses: actions/cache@v3
61+
with:
62+
path: ~/.npm
63+
key: ${{ runner.os }}-test-unit-cache-node-modules-${{ hashFiles('**/package-lock.json') }}
64+
restore-keys: ${{ runner.os }}-test-unit-cache-node-modules-
65+
- run: npm ci
66+
- run: npm run test:unit
67+
env:
68+
AUTH_TYPE: "waltid"
69+
WALTID_VERIFIER_URL: "https://verifier.portal.walt.id"
70+
WALTID_SUCCESS_REDIRECT_URL: "https://example.com/success?id=$id"
71+
WALTID_VERIFY_RESPONSE_REDIRECT_URL: "https://verifier.portal.walt.id/openid4vc/verify/$id"
72+
WALTID_VERIFY_PRESENTATION_DEFINITION_URL: "https://verifier.portal.walt.id/openid4vc/pd/$id"
73+
DEFAULT_VP_POLICIES: '["expired","signature","revoked-status-list","not-before"]'
74+
DEFAULT_VC_POLICIES: '["expired","signature","revoked-status-list","not-before"]'
75+
- uses: actions/upload-artifact@v4
76+
with:
77+
name: coverage
78+
path: coverage/
79+
test_system:
80+
runs-on: ubuntu-latest
81+
82+
steps:
83+
- name: Checkout code
84+
uses: actions/checkout@v4
85+
86+
- name: Set up Node.js
87+
uses: actions/setup-node@v4
88+
with:
89+
node-version: 'v20.16.0'
90+
91+
- name: Cache node_modules
92+
uses: actions/cache@v3
93+
env:
94+
cache-name: cache-node-modules
95+
with:
96+
path: ~/.npm
97+
key: ${{ runner.os }}-test-integration-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
98+
restore-keys: ${{ runner.os }}-test-integration-${{ env.cache-name }}-
99+
- name: Start Policy Server
100+
working-directory: ${{ github.workspace }}
101+
run: |
102+
npm ci
103+
npm run build
104+
npm run start &
105+
env:
106+
AUTH_TYPE: "waltid"
107+
WALTID_VERIFIER_URL: "https://verifier.portal.walt.id"
108+
WALTID_SUCCESS_REDIRECT_URL: "https://example.com/success?id=$id"
109+
WALTID_VERIFY_RESPONSE_REDIRECT_URL: "https://verifier.portal.walt.id/openid4vc/verify/$id"
110+
DEFAULT_VP_POLICIES: '["expired","signature","revoked-status-list","not-before"]'
111+
DEFAULT_VC_POLICIES: '["expired","signature","revoked-status-list","not-before"]'
112+
- name: Check Policy Server is running
113+
run: |
114+
for i in $(seq 1 90); do
115+
if curl --output /dev/null --silent --head --fail "http://localhost:3000/api-docs"; then
116+
echo "Policy Server is up"
117+
exit 0
118+
fi
119+
sleep 10
120+
done
121+
echo "Policy Server did not start in time"
122+
exit 1

Dockerfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ RUN npm run build
3636
EXPOSE 8000
3737

3838
# Set environment variables
39-
ENV NODE_ENV=production \
40-
PORT=8000 \
41-
AUTH_TYPE=waltid
42-
39+
ENV NODE_ENV=production
4340
# Run the application directly from the dist directory
4441
CMD ["npm","run","start"]

0 commit comments

Comments
 (0)