|
| 1 | +version: 2 |
| 2 | +jobs: |
| 3 | + build: |
| 4 | + working_directory: /go/src/github.com/gopherjs/gopherjs |
| 5 | + docker: |
| 6 | + # We have a custom installation of Go below so this version is (largely) irrelevant. |
| 7 | + - image: circleci/golang:1.10 |
| 8 | + |
| 9 | + environment: |
| 10 | + SOURCE_MAP_SUPPORT: false |
| 11 | + NVM_VERSION: v0.33.9 |
| 12 | + GO_VERSION: 1.10.1 |
| 13 | + NODE_VERSION: 6.2.2 |
| 14 | + |
| 15 | + steps: |
| 16 | + - checkout |
| 17 | + |
| 18 | + - run: | |
| 19 | + # Install nvm. |
| 20 | + git clone https://github.com/creationix/nvm.git $HOME/.nvm |
| 21 | + cd $HOME/.nvm && git checkout $NVM_VERSION |
| 22 | + echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV |
| 23 | + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV |
| 24 | +
|
| 25 | + - run: | |
| 26 | + # Install our own local Go version; we need src/path/filepath to be writable for certain tests. |
| 27 | + mkdir $HOME/goroot |
| 28 | + curl https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz | tar -C $HOME/goroot --strip-components=1 -xz |
| 29 | + chmod a+w $HOME/goroot/src/path/filepath |
| 30 | + echo 'export PATH="$HOME/goroot/bin:$PATH"' >> $BASH_ENV |
| 31 | +
|
| 32 | + - run: | |
| 33 | + # Per https://github.com/gopherjs/gopherjs/pull/687. |
| 34 | + echo 'ulimit -s 10000' >> $BASH_ENV |
| 35 | +
|
| 36 | + - run: | |
| 37 | + # Setup our required Node version now that nvm is installed. |
| 38 | + nvm install $NODE_VERSION node |
| 39 | + nvm alias default $NODE_VERSION |
| 40 | +
|
| 41 | + - run: | |
| 42 | + # Verify our environment setup. |
| 43 | + which node |
| 44 | + which go |
| 45 | + node --version |
| 46 | + go version |
| 47 | + go env |
| 48 | +
|
| 49 | + - run: | |
| 50 | + # Per https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md. |
| 51 | + npm install --global node-gyp |
| 52 | + cd node-syscall && node-gyp rebuild && mkdir -p $HOME/.node_libraries/ && cp build/Release/syscall.node $HOME/.node_libraries/syscall.node |
| 53 | +
|
| 54 | + - run: | |
| 55 | + go get -t ./... |
| 56 | + go install github.com/gopherjs/gopherjs |
| 57 | +
|
| 58 | + - run: |
| 59 | + # because this is a long-running test suite |
| 60 | + no_output_timeout: 30m |
| 61 | + command: | |
| 62 | + # Ensure all go code is well formatted. |
| 63 | + diff -u <(echo -n) <(gofmt -d .) |
| 64 | +
|
| 65 | + # Vetting github.com/gopherjs/gopherjs |
| 66 | + go tool vet *.go |
| 67 | +
|
| 68 | + # vet all subdirectories except "tests" and "third_party". |
| 69 | + for d in */; do echo $d; done | grep -v tests/ | grep -v third_party/ | xargs go tool vet |
| 70 | +
|
| 71 | + # All those packages should have // +build js. |
| 72 | + diff -u <(echo -n) <(go list ./compiler/natives/src/...) |
| 73 | +
|
| 74 | + # Should build successfully (can't run tests, since only client is supported). |
| 75 | + gopherjs install -v net/http |
| 76 | +
|
| 77 | + # Run the core gopherjs tests; exclusions take from .std_test_pkg_exclusions. |
| 78 | + go list std | grep -v -x -f .std_test_pkg_exclusions | xargs gopherjs test --minify -v --short github.com/gopherjs/gopherjs/tests/... |
| 79 | +
|
| 80 | + # Race tests. |
| 81 | + go test -v -race ./... |
| 82 | +
|
| 83 | + # Non-minified gopherjs tests should also work. |
| 84 | + gopherjs test -v fmt |
0 commit comments