mirror of https://github.com/status-im/js-waku.git
Make testing in CI possible
By adding nim-waku as a submodule and building it as part of the tests.
This commit is contained in:
parent
e3a488bbf5
commit
3115874a05
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "nim-waku"]
|
||||||
|
path = nim-waku
|
||||||
|
url = https://github.com/status-im/nim-waku.git
|
17
README.md
17
README.md
|
@ -2,4 +2,19 @@
|
||||||
|
|
||||||
A JavaScript implementation of the [Waku v2 protocol](https://specs.vac.dev/specs/waku/v2/waku-v2).
|
A JavaScript implementation of the [Waku v2 protocol](https://specs.vac.dev/specs/waku/v2/waku-v2).
|
||||||
|
|
||||||
**Work In Progress**
|
**This repo is a Work In Progress**
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
To build and test this repository, you need:
|
||||||
|
|
||||||
|
- [Node.js & npm](https://nodejs.org/en/)
|
||||||
|
- [bufbuild](https://github.com/bufbuild/buf)
|
||||||
|
- [protoc](https://grpc.io/docs/protoc-installation/)
|
||||||
|
|
||||||
|
To ensure interoperability with [nim-waku](https://github.com/status-im/nim-waku/), some tests are run against a nim-waku node.
|
||||||
|
This is why `nim-waku` is present as a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules), which itself contain several submodules.
|
||||||
|
At this stage, it is not possible to exclude nim-waku tests, hence `git submodule update --init --recursive` is run before testing (see [`pretest` script](https://github.com/status-im/js-waku/blob/main/package.json)).
|
||||||
|
|
||||||
|
To build nim-waku, you also need [Rust](https://www.rust-lang.org/tools/install).
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit b3208b343f35baebd2adea0da28bc9bf664d45ee
|
File diff suppressed because it is too large
Load Diff
|
@ -16,6 +16,9 @@
|
||||||
"fix": "run-s fix:*",
|
"fix": "run-s fix:*",
|
||||||
"fix:prettier": "prettier \"src/**/*.ts\" --write",
|
"fix:prettier": "prettier \"src/**/*.ts\" --write",
|
||||||
"fix:lint": "eslint src --ext .ts --fix",
|
"fix:lint": "eslint src --ext .ts --fix",
|
||||||
|
"pretest": "run-s pretest:*",
|
||||||
|
"pretest:1-init-git-submodules": "git submodule update --init --recursive",
|
||||||
|
"pretest:2-build-nim-waku": "cd nim-waku; [ -f './build/wakunode2' ] || make -j$(nproc --all 2>/dev/null || echo 2) wakunode2",
|
||||||
"test": "run-s build test:*",
|
"test": "run-s build test:*",
|
||||||
"test:lint": "eslint src --ext .ts",
|
"test:lint": "eslint src --ext .ts",
|
||||||
"test:prettier": "prettier \"src/**/*.ts\" --list-different",
|
"test:prettier": "prettier \"src/**/*.ts\" --list-different",
|
||||||
|
@ -59,11 +62,13 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ava/typescript": "^1.1.1",
|
"@ava/typescript": "^1.1.1",
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.1",
|
"@istanbuljs/nyc-config-typescript": "^1.0.1",
|
||||||
|
"@types/app-root-path": "^1.2.4",
|
||||||
"@types/axios": "^0.14.0",
|
"@types/axios": "^0.14.0",
|
||||||
"@types/node": "^14.14.31",
|
"@types/node": "^14.14.31",
|
||||||
"@types/tail": "^2.0.0",
|
"@types/tail": "^2.0.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.0.1",
|
"@typescript-eslint/eslint-plugin": "^4.0.1",
|
||||||
"@typescript-eslint/parser": "^4.0.1",
|
"@typescript-eslint/parser": "^4.0.1",
|
||||||
|
"app-root-path": "^3.0.0",
|
||||||
"ava": "^3.15.0",
|
"ava": "^3.15.0",
|
||||||
"ava-fast-check": "^4.0.2",
|
"ava-fast-check": "^4.0.2",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { ChildProcess, spawn } from 'child_process';
|
import { ChildProcess, spawn } from 'child_process';
|
||||||
import { randomInt } from 'crypto';
|
import { randomInt } from 'crypto';
|
||||||
|
|
||||||
|
import appRoot from 'app-root-path';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import Multiaddr from 'multiaddr';
|
import Multiaddr from 'multiaddr';
|
||||||
import multiaddr from 'multiaddr';
|
import multiaddr from 'multiaddr';
|
||||||
|
@ -14,7 +15,8 @@ import waitForLine from './log_file';
|
||||||
|
|
||||||
const NIM_WAKU_DEFAULT_P2P_PORT = 60000;
|
const NIM_WAKU_DEFAULT_P2P_PORT = 60000;
|
||||||
const NIM_WAKU_DEFAULT_RPC_PORT = 8545;
|
const NIM_WAKU_DEFAULT_RPC_PORT = 8545;
|
||||||
const NIM_WAKU_BIN = '/home/froyer/src/status-im/nim-waku/build/wakunode2';
|
const NIM_WAKU_DIR = appRoot + '/nim-waku';
|
||||||
|
const NIM_WAKU_BIN = NIM_WAKU_DIR + '/build/wakunode2';
|
||||||
|
|
||||||
const LOG_DIR = './log';
|
const LOG_DIR = './log';
|
||||||
|
|
||||||
|
@ -64,7 +66,7 @@ export class NimWaku {
|
||||||
|
|
||||||
const argsArray = argsToArray(mergedArgs);
|
const argsArray = argsToArray(mergedArgs);
|
||||||
this.process = spawn(NIM_WAKU_BIN, argsArray, {
|
this.process = spawn(NIM_WAKU_BIN, argsArray, {
|
||||||
cwd: '/home/froyer/src/status-im/nim-waku/',
|
cwd: NIM_WAKU_DIR,
|
||||||
stdio: [
|
stdio: [
|
||||||
'ignore', // stdin
|
'ignore', // stdin
|
||||||
logFile, // stdout
|
logFile, // stdout
|
||||||
|
|
Loading…
Reference in New Issue