-
Notifications
You must be signed in to change notification settings - Fork 6
194 lines (171 loc) · 6.98 KB
/
ci.yml
File metadata and controls
194 lines (171 loc) · 6.98 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Test Flow
on:
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Run build
run: npm run build
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Run lint
run: npm run lint
test_system:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.19.0'
- name: Cache node_modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-test-integration-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-test-integration-${{ env.cache-name }}-
- name: Set ADDRESS_FILE
run: echo "ADDRESS_FILE=${HOME}/.ocean/ocean-contracts/artifacts/address.json" >> $GITHUB_ENV
- name: Checkout Barge
uses: actions/checkout@v3
with:
repository: 'oceanprotocol/barge'
path: 'barge'
ref: 'feature/barge_with_node'
- name: Login to Docker Hub
if: ${{ env.DOCKERHUB_PASSWORD && env.DOCKERHUB_USERNAME }}
run: |
echo "Login to Docker Hub"
echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Run Barge
working-directory: ${{ github.workspace }}/barge
run: |
bash -x start_ocean.sh --with-typesense 2>&1 > start_ocean.log &
- run: npm ci
- run: npm run build
- run: docker image ls
- name: Delete default runner images
run: |
docker image rm -f node:20
docker image rm -f node:20-alpine
docker image rm -f node:18
docker image rm -f node:18-alpine
docker image rm -f debian:10
docker image rm -f debian:11
docker image rm -f ubuntu:22.04
docker image rm -f ubuntu:20.04
docker image rm -f moby/buildkit:latest
rm -rf /usr/share/swift/
- name: Wait for node to be ready
run: |
max_attempts=60
attempt=1
echo "Waiting for node container to be ready (timeout: 300s)..."
while [ $attempt -le $max_attempts ]; do
if [ "$(docker inspect -f '{{.State.Running}}' ocean-node-1 2>/dev/null)" = "true" ]; then
echo "Node container is running!"
break
fi
echo "Attempt $attempt/$max_attempts: Node container not ready yet, waiting..."
if [ $attempt -eq $max_attempts ]; then
echo "Error: Node container failed to start within 300 seconds"
docker ps -a
docker inspect ocean-node-1
exit 1
fi
sleep 10
attempt=$((attempt + 1))
done
- name: docker logs
run: docker logs ocean-ocean-contracts-1 && docker logs ocean-ganache-1 && docker logs ocean-typesense-1
- name: docker logs
run: docker logs ocean_ocean-contracts_1 && docker logs ocean_typesense_1
if: ${{ failure() }}
- name: Checkout Ocean Node
uses: actions/checkout@v3
with:
repository: 'oceanprotocol/ocean-node'
path: 'ocean-node'
ref: 'main'
- name: Extract Ocean address using jq
run: |
OCEAN_ADDRESS=$(jq -r '.development | select(.chainId == 8996) | .Ocean' "$ADDRESS_FILE")
echo "OCEAN_ADDRESS_DEV=$OCEAN_ADDRESS" >> $GITHUB_ENV
echo "Extracted Ocean address: $OCEAN_ADDRESS"
- name: Use the extracted Ocean address
run: |
echo "Using Ocean address for development: ${{ env.OCEAN_ADDRESS_DEV }}"
- name: Start Ocean Node
working-directory: ${{ github.workspace }}/ocean-node
run: |
npm ci
npm run build
npm run start > ocean-node.log 2>&1 &
env:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
IPFS_GATEWAY: http://172.15.0.16:8080/
ARWEAVE_GATEWAY: https://arweave.net/
P2P_ipV4BindTcpPort: 8000
HTTP_API_PORT: 8001
RPCS: '{ "8996": {"rpc": "http://127.0.0.1:8545", "chainId": 8996, "network": "development", "chunkSize": 100} }'
DB_URL: 'http://localhost:9200'
DB_TYPE: 'elasticsearch'
FEE_TOKENS: '{ "1": "0x967da4048cD07aB37855c090aAF366e4ce1b9F48", "137": "0x282d8efCe846A88B159800bd4130ad77443Fa1A1", "80001": "0xd8992Ed72C445c35Cb4A2be468568Ed1079357c8", "56": "0xDCe07662CA8EbC241316a15B611c89711414Dd1a" }'
FEE_AMOUNT: '{ "amount": 0, "unit": "MB" }'
AUTHORIZED_DECRYPTERS: '["0xe2DD09d719Da89e5a3D0F2549c7E24566e947260","0x529043886F21D9bc1AE0feDb751e34265a246e47"]'
AUTHORIZED_PUBLISHERS: '["0xe2DD09d719Da89e5a3D0F2549c7E24566e947260","0x529043886F21D9bc1AE0feDb751e34265a246e47"]'
ALLOWED_ADMINS: '["0xe2DD09d719Da89e5a3D0F2549c7E24566e947260"]'
MAX_REQ_PER_MINUTE: 320
MAX_CONNECTIONS_PER_MINUTE: 500
DOCKER_COMPUTE_ENVIRONMENTS: '[{"socketPath":"/var/run/docker.sock","resources":[{"id":"disk","total":1000000000}],"storageExpiry":604800,"maxJobDuration":3600,"fees":{"8996":[{"feeToken": "${{ env.OCEAN_ADDRESS_DEV }}","prices":[{"id":"cpu","price":1}]}]},"free":{"maxJobDuration":60,"maxJobs":3,"resources":[{"id":"cpu","max":1},{"id":"ram","max":1000000000},{"id":"disk","max":1000000000}]}}]'
- name: Check Ocean Node is running
run: |
for i in $(seq 1 30); do
if curl --output /dev/null --silent --head --fail "http://127.0.0.1:8001"; then
echo "Ocean Node is up"
exit 0
fi
sleep 10
attempt=$((attempt + 1))
done
- name: docker logs
run: docker logs ocean-ocean-contracts-1 && docker logs ocean-ganache-1 && docker logs ocean-typesense-1
if: ${{ failure() }}
- name: Run system tests
run: npm run test:system
env:
INDEXING_RETRY_INTERVAL: 4000
INDEXING_MAX_RETRIES: 120
NODE_URL: 'http://127.0.0.1:8001'
AVOID_LOOP_RUN: true
- name: Print Ocean Node Logs if tests fail
if: ${{ failure() }}
run: |
echo "========== Ocean Node Logs =========="
tac ${{ github.workspace }}/ocean-node/ocean-node.log || echo "Log file not found"