Skip to content

Commit

Permalink
Merge pull request #527 from Joystream/update-nodejs
Browse files Browse the repository at this point in the history
Fix ci e2e-tests build and update node to v18
  • Loading branch information
mnaamani authored Sep 25, 2023
2 parents db6b2d4 + 70eeba2 commit 69e4a46
Show file tree
Hide file tree
Showing 18 changed files with 520 additions and 79 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/hydra-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -17,13 +17,20 @@ jobs:
#- uses: satackey/action-docker-layer-caching@v0.0.11
# Ignore the failure of a step and avoid terminating the job.
# continue-on-error: true
- name: run e2e tests
- name: build e2e tests
# We use `sudo rm -rf /usr/share/dotnet` as a workaround to free up some space,
# as suggested in https://github.com/actions/runner-images/issues/2606#issuecomment-772683150
# because by default the runner will run out of space.
run: |
sudo rm -rf /usr/share/dotnet
yarn
yarn build
- name: Docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: run e2e test
run: |
yarn e2e-test
7 changes: 6 additions & 1 deletion .github/workflows/hydra-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -18,6 +18,11 @@ jobs:
run: |
yarn
yarn workspaces run lint
- name: Docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: run unit tests
# We use `sudo rm -rf /usr/share/dotnet` as a workaround to free up some space
# (see hydra-e2e-tests.yml for explaination)
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:18

# TODO: optimize this
#
Expand Down
4 changes: 2 additions & 2 deletions examples/indexers/node-template/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ services:

## node-template image
substrate:
image: paritytech/substrate-playground-template-node-template:sha-7212614
image: joystream/node:2f8fe07f801618c1371ecc5d5ee944fe4e2c0d1f
restart: unless-stopped
ports:
- "9944:9944"
command: ["./target/release/node-template", "--dev", "--tmp", "--ws-external"]
command: ["--dev", "--tmp", "--ws-external"]

redis:
image: redis:6.0-alpine
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"prettier": "^2.7.1"
},
"resolutions": {
"@polkadot/types": "8.9.1"
"@polkadot/types": "8.9.1",
"node-gyp": "^9.4.0"
},
"lint-staged": {
"*.ts": "yarn lint --fix"
Expand Down
2 changes: 1 addition & 1 deletion packages/hydra-cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:18

RUN mkdir -p /home/hydra-cli && chown -R node:node /home/hydra-cli
RUN mkdir -p /home/hydra && chown -R node:node /home/hydra
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:18

RUN mkdir -p /home/hydra-builder && chown -R node:node /home/hydra-builder

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:18

RUN mkdir -p /home/hydra-processor && chown -R node:node /home/hydra-processor

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:18

RUN mkdir -p /home/query-node && chown -R node:node /home/query-node
WORKDIR /home/query-node
Expand Down
4 changes: 2 additions & 2 deletions packages/hydra-e2e-tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ services:


node-template:
image: paritytech/substrate-playground-template-node-template:sha-af065c19
image: joystream/node:2f8fe07f801618c1371ecc5d5ee944fe4e2c0d1f
restart: unless-stopped
ports:
- "9944:9944"
command: ["./target/debug/node-template", "--dev", "--tmp", "--ws-external"]
command: ["--dev", "--tmp", "--ws-external"]

redis:
image: redis:6.0-alpine
Expand Down
4 changes: 2 additions & 2 deletions packages/hydra-e2e-tests/fixtures/mappings/mappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {

// run 'NODE_URL=<RPC_ENDPOINT> EVENTS=<comma separated list of events> yarn codegen:mappings-types'
// to genenerate typescript classes for events, such as Balances.TransferEvent
import { Balances_TransferEvent_V100, SetCall } from './generated/types'
import { Balances_TransferEvent_V2001, SetCall } from './generated/types'
import BN from 'bn.js'
import {
ExtrinsicContext,
Expand Down Expand Up @@ -43,7 +43,7 @@ export async function balancesTransfer({
extrinsic,
}: EventContext & StoreContext) {
const transfer = new Transfer()
const [from, to, value] = new Balances_TransferEvent_V100(event).params
const [from, to, value] = new Balances_TransferEvent_V2001(event).params
transfer.from = Buffer.from(from.toHex())
transfer.to = Buffer.from(to.toHex())
transfer.value = value.toBn()
Expand Down
10 changes: 5 additions & 5 deletions packages/hydra-e2e-tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

cleanup()
{
(echo "## Processor Logs ##" && docker logs hydra-e2e-tests_hydra-processor_1 --tail 50) || :
(echo "## Query Node Logs ##" && docker logs hydra-e2e-tests_query-node_1 --tail 50) || :
(echo "## Indexer Logs ##" && docker logs hydra-e2e-tests_hydra-indexer_1 --tail 50) || :
(echo "## Indexer API Server ##" && docker logs hydra-e2e-tests_hydra-indexer-gateway_1 --tail 50) || :
(echo "## Processor Logs ##" && docker logs hydra-e2e-tests_hydra-processor_1 --tail 200) || :
(echo "## Query Node Logs ##" && docker logs hydra-e2e-tests_query-node_1 --tail 200) || :
(echo "## Indexer Logs ##" && docker logs hydra-e2e-tests_hydra-indexer_1 --tail 50) || :
(echo "## Indexer API Server ##" && docker logs hydra-e2e-tests_hydra-indexer-gateway_1 --tail 50) || :
(yarn post-e2e-test) || :
rm -rf ./hydra-test
}
Expand Down Expand Up @@ -37,7 +37,7 @@ until $(curl -s --head --request GET http://localhost:3000/metrics/hydra_proces

printf '.'
attempt_counter=$(($attempt_counter+1))
sleep 5
sleep 10
done

# start rest of services (query-node most importantly)
Expand Down
2 changes: 1 addition & 1 deletion packages/hydra-indexer-gateway/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:18

RUN mkdir -p /home/hydra && chown -R node:node /home/hydra

Expand Down
2 changes: 1 addition & 1 deletion packages/hydra-indexer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:18

# TODO: optimize this
#
Expand Down
4 changes: 2 additions & 2 deletions packages/hydra-indexer/docker-compose-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ version: "3"

services:
substrate:
image: paritytech/substrate-playground-template-node-template:sha-7212614
image: joystream/node:2f8fe07f801618c1371ecc5d5ee944fe4e2c0d1f
ports:
- "9944:9944"
command: ["./target/release/node-template", "--dev", "--tmp", "--ws-external"]
command: ["--dev", "--tmp", "--ws-external"]

redis:
image: redis:6.0-alpine
Expand Down
4 changes: 2 additions & 2 deletions packages/hydra-processor/docker-compose-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ version: "3"

services:
node-template:
image: paritytech/substrate-playground-template-node-template:sha-af065c19
image: joystream/node:2f8fe07f801618c1371ecc5d5ee944fe4e2c0d1f
restart: unless-stopped
ports:
- "9944:9944"
command: ["./target/debug/node-template", "--dev", "--tmp", "--ws-external"]
command: ["--dev", "--tmp", "--ws-external"]

redis:
image: redis:6.0-alpine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export function buildQueryFields<T>(fields: QueryFields<T>): string {
)[key] as QueryFields<T[typeof key]>

output = `
${output}${key} {
${output}${String(key)} {
${buildQueryFields(nestedFields)}
}\n`
}
Expand Down
Loading

0 comments on commit 69e4a46

Please sign in to comment.