Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use nwaku docker instead of building binaries #1259

Merged
merged 5 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
"webfonts",
"websockets",
"wifi",
"xsalsa20"
"xsalsa20",
"statusteam"
],
"flagWords": [],
"ignorePaths": [
Expand Down
68 changes: 8 additions & 60 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
pull_request:

env:
NWAKU_VERSION: "v0.16.0"
NODE_JS: "18"

jobs:
Expand Down Expand Up @@ -57,24 +56,15 @@ jobs:

node:
runs-on: ubuntu-latest
env:
WAKUNODE_IMAGE: "statusteam/nim-waku:v0.16.0"
steps:
- uses: actions/checkout@v3
- name: Get nwaku
shell: bash
run: |
mkdir -p nwaku/build
cd nwaku
wget "https://github.com/status-im/nwaku/releases/download/${NWAKU_VERSION}/nim-waku-ubuntu-latest.tar.gz"
tar xavf nim-waku-ubuntu-latest.tar.gz
- name: Ensure wakunode2 is ready
shell: bash
run: |
uname -a
cd nwaku/build
./wakunode2 --help

- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}

- uses: ./.github/actions/npm
- run: npm run build:esm
- run: npm run test:node
Expand All @@ -95,35 +85,15 @@ jobs:
name: nwaku-logs
path: packages/tests/log/

node_with_go_waku:
node_with_go_waku_master:
runs-on: ubuntu-latest
env:
GO_WAKU_VERSION: "0.5.2"
WAKU_SERVICE_NODE_DIR: ../../go-waku
WAKU_SERVICE_NODE_BIN: ./waku
WAKUNODE_IMAGE: "statusteam/go-waku:latest"
WAKU_SERVICE_NODE_PARAMS: "--min-relay-peers-to-publish=0" # Can be removed once https://github.com/status-im/nwaku/issues/1004 is done
DEBUG: "waku*"
steps:
- uses: actions/checkout@v3

- name: Get go-waku
shell: bash
run: |
pwd
mkdir -p go-waku/
cd go-waku
wget "https://github.com/status-im/go-waku/releases/download/v${GO_WAKU_VERSION}/gowaku-${GO_WAKU_VERSION}-x86_64.deb"
sudo apt install ./gowaku-${GO_WAKU_VERSION}-x86_64.deb
cp $(which waku) ./

- name: Ensure go-waku is ready
shell: bash
run: |
uname -a
cd packages/core
cd "${WAKU_SERVICE_NODE_DIR}"
"${WAKU_SERVICE_NODE_BIN}" --version

- name: Install NodeJS
uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -153,37 +123,15 @@ jobs:
runs-on: ubuntu-latest
env:
DEBUG: "waku*"
WAKUNODE_IMAGE: "statusteam/nim-waku:deploy-wakuv2-test"
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
fetch-depth: 0

- name: Install NodeJS
uses: actions/setup-node@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}

- name: Pull nwaku origin/master
run: |
cd nwaku
git fetch origin
git checkout origin/master

- uses: ./.github/actions/npm

- name: build nwaku
run: |
cd packages/tests
npm run nwaku:force-build

- name: Ensure wakunode2 is ready
shell: bash
run: |
uname -a
cd nwaku
./build/wakunode2 --help

- run: npm run build:esm
- run: npm run test:node
env:
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "nim-waku"]
path = nwaku
url = https://github.com/status-im/nim-waku.git
19 changes: 8 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,21 @@ This project board is to prioritize the work of core contributors so do not be d
Do note that we have a [CI](./.github/workflows/ci.yml) powered by GitHub Action.
To help ensure your PR passes, just run before committing:

- `npm run fix`: To format your code,
- `npm run test`: To run all tests, including lint checks.

- `npm run fix`: To format your code,
- `npm run check`: To check your code for linting errors,
- `npm run test`: To run all tests

## Build & Test

To build and test this repository, you need:

- [Node.js & npm](https://nodejs.org/en/).
- Chrome (for browser testing).
- g++ & make (to build nim-waku)

- [Node.js & npm](https://nodejs.org/en/).
- Chrome (for browser testing).

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/master/package.json)).
This is why the relevant docker images for the node is pulled as part of the `pretest` script that runs before `npm run test`.

If you do not want to run `npm run test`, you can still build nim-waku by running `npm run pretest`.
If you do not want to run `npm run test`, you can still pull the relevant nim-waku docker image by running `npm run pretest`.

Note that we run tests in both NodeJS and browser environments (using [karma](https://karma-runner.github.io/)).
Files named `*.node.spec.ts` are only run in NodeJS environment;
Expand Down Expand Up @@ -62,4 +60,3 @@ Commit messages should never contain any `@` mentions (usernames prefixed with "

Please refer to the [Git manual](https://git-scm.com/doc) for more information
about Git.

1 change: 0 additions & 1 deletion nwaku
Submodule nwaku deleted from 03f0de
Loading