From ab7eb979460b620427a14157c88f4290c6b701d6 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Thu, 21 Oct 2021 13:17:37 +0200 Subject: [PATCH] chore: http-rpc-runtime.sh the Rube Goldberg machine for testing HTTP RPC wire format changes end-to-end --- .github/workflows/test.yml | 30 ++++++++++++++++++++++++++---- .gitignore | 3 ++- package-lock.json | 3 ++- package.json | 3 ++- setup-http-rpc-runtime.sh | 38 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 7 deletions(-) create mode 100755 setup-http-rpc-runtime.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f22b2fb7..cb506c36 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,13 +4,23 @@ on: branches: - master +# TODO: remove below + use of setup-go +env: + IPFS_GO_EXEC: '/tmp/go-ipfs/cmd/ipfs/ipfs' + IPFS_JS_EXEC: '/tmp/js-ipfs/packages/ipfs/src/cli.js' + IPFS_JS_MODULE: '/tmp/js-ipfs/packages/ipfs/dist/cjs/src/index.js' + IPFS_JS_HTTP_MODULE: '/tmp/js-ipfs/packages/ipfs-http-client/dist/cjs/src/index.js' + jobs: build: name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/setup-go@v2 + with: + go-version: '1.16' + - uses: actions/setup-node@v2 with: node-version: 16 - uses: actions/cache@v2 @@ -32,6 +42,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: '1.16' - uses: actions/setup-node@v2 with: node-version: 16 @@ -59,7 +72,10 @@ jobs: name: test node ${{ matrix.node }} steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/setup-go@v2 + with: + go-version: '1.16' + - uses: actions/setup-node@v2 with: node-version: 16 - uses: actions/cache@v2 @@ -92,7 +108,10 @@ jobs: - webworker steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/setup-go@v2 + with: + go-version: '1.16' + - uses: actions/setup-node@v2 with: node-version: 16 - uses: actions/cache@v2 @@ -122,7 +141,10 @@ jobs: - electron-renderer steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/setup-go@v2 + with: + go-version: '1.16' + - uses: actions/setup-node@v2 with: node-version: 16 - uses: actions/cache@v2 diff --git a/.gitignore b/.gitignore index 729bf0ce..36922669 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,5 @@ dist test/test-data/go-ipfs-repo/LOCK test/test-data/go-ipfs-repo/LOG test/test-data/go-ipfs-repo/LOG.old -types \ No newline at end of file +types +tmp diff --git a/package-lock.json b/package-lock.json index 9b3bf197..e5f5db6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "ipfs-interop", "version": "7.0.3", + "hasInstallScript": true, "license": "MIT", "dependencies": { "aegir": "^35.0.2", @@ -49,7 +50,7 @@ "ipfs-http-client": "^53.0.0" }, "engines": { - "node": ">=12.0.0", + "node": ">=16.0.0", "npm": ">6.0.0" } }, diff --git a/package.json b/package.json index 8d8167f5..673c977b 100644 --- a/package.json +++ b/package.json @@ -19,10 +19,11 @@ "ipfs-interop": "bin/ipfs-interop.js" }, "engines": { - "node": ">=12.0.0", + "node": ">=16.0.0", "npm": ">6.0.0" }, "scripts": { + "postinstall": "bash ./setup-http-rpc-runtime.sh", "lint": "aegir lint", "build": "aegir build", "pretest": "aegir build --esm-tests", diff --git a/setup-http-rpc-runtime.sh b/setup-http-rpc-runtime.sh new file mode 100755 index 00000000..73d9a90b --- /dev/null +++ b/setup-http-rpc-runtime.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +set -xeo pipefail + +# this script sets up the Rube Goldberg machine for testing HTTP RPC wire format change end-to-end +# context: +# - https://github.com/ipfs/go-ipfs/pull/8183 +# - https://github.com/ipfs/js-ipfs/pull/3922 + +WORKDIR=$(pwd) +rm -rf /tmp/js-ipfs /tmp/go-ipfs + + +# use updated GO implementation from https://github.com/ipfs/go-ipfs/pull/8183 +cd /tmp + git clone -b feat/pubsub-require-multibase https://github.com/coryschwartz/go-ipfs.git + cd go-ipfs + make build + make install + +# TODO: go-ipfs binary path to be used as IPFS_GO_EXEC +realpath /tmp/go-ipfs/cmd/ipfs/ipfs + + +# use updated JS implementation from https://github.com/ipfs/js-ipfs/pull/3922 +cd /tmp + git clone -b feat/pubsub-require-multibase https://github.com/ipfs/js-ipfs.git + cd js-ipfs + npm install + npm run build + npm run link + +cd $WORKDIR + +export IPFS_GO_EXEC=/tmp/go-ipfs/cmd/ipfs/ipfs +export IPFS_JS_EXEC=/tmp/js-ipfs/packages/ipfs/src/cli.js +export IPFS_JS_MODULE=/tmp/js-ipfs/packages/ipfs/dist/cjs/src/index.js +export IPFS_JS_HTTP_MODULE=/tmp/js-ipfs/packages/ipfs-http-client/dist/cjs/src/index.js