Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
chore: http-rpc-runtime.sh
Browse files Browse the repository at this point in the history
the Rube Goldberg machine for testing HTTP RPC wire format change
end-to-end
  • Loading branch information
lidel committed Oct 21, 2021
1 parent 99502a7 commit e4660c9
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 7 deletions.
30 changes: 26 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
IPFS_JS_HTTP_MODULE: '/tmp/js-ipfs/packages/ipfs-http-client/dist'

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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
types
tmp
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
38 changes: 38 additions & 0 deletions setup-http-rpc-runtime.sh
Original file line number Diff line number Diff line change
@@ -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
export IPFS_JS_HTTP_MODULE=/tmp/js-ipfs/packages/ipfs-http-client/dist

0 comments on commit e4660c9

Please sign in to comment.