Skip to content

Commit

Permalink
chore: add polkadotjs tests to ci (ChainSafe#1567)
Browse files Browse the repository at this point in the history
* chore: add polkadotjs tests to ci

* Update .github/workflows/tests.yml

Co-authored-by: Edward Mack <ed@edwardmack.com>

* chore: update dockerfile to install yarn and cd into js test dir and install dependencies

* chore:updated dockerfile to run polkadotjs tests

* chore: updated deps to include js tests

* chore: removed unneeded command in test wrkflow

* add rpc module to gossamer start-up

* fix linter rants

Co-authored-by: Edward Mack <ed@edwardmack.com>
Co-authored-by: noot <36753753+noot@users.noreply.github.com>
  • Loading branch information
3 people authored and timwu20 committed Dec 6, 2021
1 parent 7ec0b79 commit 958a881
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 1,321 deletions.
26 changes: 25 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,30 @@ jobs:
push: false
tags: chainsafe/gossamer:test
-
name: Run stress
name: Run grandpa
run: |
docker run chainsafe/gossamer:test sh -c "make it-grandpa"
docker-polkadotjs-tests:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Build
id: docker_build
uses: docker/build-push-action@v2
with:
load: true
file: ./Dockerfile
platforms: linux/amd64
push: false
tags: chainsafe/gossamer:test
-
name: Run polkadotjs tests
run: |
docker run chainsafe/gossamer:test sh -c "make it-polkadotjs"
17 changes: 15 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ RUN apt-get update && \
apt-get install -y \
gcc \
cmake \
wget
wget \
curl \
npm

# Install node source for polkadotjs tests
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -

# Install nodejs for polkadotjs tests
RUN apt-get update && \
apt-get install -y \
nodejs

# Install Go
RUN wget https://dl.google.com/go/go1.15.5.linux-amd64.tar.gz
Expand Down Expand Up @@ -36,6 +46,9 @@ RUN go mod download
# Copy gossamer sources
COPY . $GOPATH/src/github.com/ChainSafe/gossamer

# Install js dependencies for polkadot.js tests
RUN cd $GOPATH/src/github.com/ChainSafe/gossamer/tests/polkadotjs_test && npm install

# Build
RUN GOBIN=$GOPATH/src/github.com/ChainSafe/gossamer/bin go run scripts/ci.go install

Expand All @@ -48,4 +61,4 @@ RUN chmod +x $GOPATH/src/github.com/ChainSafe/gossamer/scripts/docker-entrypoint
# Expose gossamer command and port
ENTRYPOINT ["/gocode/src/github.com/ChainSafe/gossamer/scripts/docker-entrypoint.sh"]
CMD ["/usr/local/gossamer"]
EXPOSE 7001
EXPOSE 7001 8546 8540
2 changes: 1 addition & 1 deletion tests/polkadotjs_test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@polkadot/api": "^3.11.1"
"@polkadot/api": "2.8.1"
},
"devDependencies": {
"chai": "^4.2.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/polkadotjs_test/start_polkadotjs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestStartGossamerAndPolkadotAPI(t *testing.T) {
command := "npx mocha ./test"
parts := strings.Fields(command)
data, err := exec.Command(parts[0], parts[1:]...).Output()
require.NoError(t, err, data)
require.NoError(t, err, fmt.Sprintf("%s", data))

//uncomment this to see log results from javascript tests
//fmt.Printf("%s\n", data)
Expand Down
2 changes: 1 addition & 1 deletion tests/polkadotjs_test/test/test-polkadot.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,4 @@ describe('Testing polkadot.js/api calls:', function () {
});
});

});
});
Loading

0 comments on commit 958a881

Please sign in to comment.