Skip to content

Commit

Permalink
use docker to get js coverage (travis fails to run wasm tests on its …
Browse files Browse the repository at this point in the history
…own)
  • Loading branch information
djherbis committed Dec 31, 2018
1 parent 59d450f commit b46264f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ script() {
# add js coverage
if [ "$TRAVIS_OS_NAME" == "linux" ];
then
export PATH="$PATH:$(go env GOROOT)/misc/wasm"
GOOS=js GOARCH=wasm go test -covermode=count -coverprofile=profile.cov
bash js.cover.sh
$HOME/gopath/bin/goveralls -coverprofile=profile.cov -service=travis-ci -repotoken $COVERALLS_TOKEN
fi
fi
Expand Down
9 changes: 9 additions & 0 deletions js.cover.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang:1.11

RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
RUN apt-get install --yes nodejs

WORKDIR /go/src/github.com/djherbis/times
COPY . .

RUN GOOS=js GOARCH=wasm go test -covermode=count -coverprofile=profile.cov -exec="$(go env GOROOT)/misc/wasm/go_js_wasm_exec"
7 changes: 7 additions & 0 deletions js.cover.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -e

docker build -f js.cover.dockerfile -t js.cover.djherbis.times .
docker create --name js.cover.djherbis.times js.cover.djherbis.times
docker cp js.cover.djherbis.times:/go/src/github.com/djherbis/times/profile.cov .
docker rm -v js.cover.djherbis.times

0 comments on commit b46264f

Please sign in to comment.