diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..ddd18653f --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,84 @@ +version: 2 +jobs: + build: + working_directory: /go/src/github.com/gopherjs/gopherjs + docker: + # We have a custom installation of Go below so this version is (largely) irrelevant. + - image: circleci/golang:1.10 + + environment: + SOURCE_MAP_SUPPORT: false + NVM_VERSION: v0.33.9 + GO_VERSION: 1.10.3 + NODE_VERSION: 10.0.0 + + steps: + - checkout + + - run: | + # Install nvm. + git clone https://github.com/creationix/nvm.git $HOME/.nvm + cd $HOME/.nvm && git checkout $NVM_VERSION + echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV + + - run: | + # Install our own local Go version; we need src/path/filepath to be writable for certain tests. + mkdir $HOME/goroot + curl https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz | tar -C $HOME/goroot --strip-components=1 -xz + chmod a+w $HOME/goroot/src/path/filepath + echo 'export PATH="$HOME/goroot/bin:$PATH"' >> $BASH_ENV + + - run: | + # Per https://github.com/gopherjs/gopherjs/pull/687. + echo 'ulimit -s 10000' >> $BASH_ENV + + - run: | + # Setup our required Node version now that nvm is installed. + nvm install $NODE_VERSION node + nvm alias default $NODE_VERSION + + - run: | + # Verify our environment setup. + which node + which go + node --version + go version + go env + + - run: | + # Per https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md. + npm install --global node-gyp + cd node-syscall && node-gyp rebuild && mkdir -p $HOME/.node_libraries/ && cp build/Release/syscall.node $HOME/.node_libraries/syscall.node + + - run: | + go get -t ./... + go install github.com/gopherjs/gopherjs + + - run: + # because this is a long-running test suite + no_output_timeout: 30m + command: | + echo ">> Ensure all go code is well formatted." + diff -u <(echo -n) <(gofmt -d .) + + echo ">> Vetting github.com/gopherjs/gopherjs" + go tool vet *.go + + echo ">> vet all subdirectories except tests and third_party." + for d in */; do echo $d; done | grep -v tests/ | grep -v third_party/ | xargs go tool vet + + echo ">> All those packages should have // +build js." + diff -u <(echo -n) <(go list ./compiler/natives/src/...) + + echo ">> Should build successfully (can't run tests, since only client is supported)." + gopherjs install -v net/http + + echo ">> Run the core gopherjs tests; exclusions take from .std_test_pkg_exclusions." + go list std | grep -v -x -f .std_test_pkg_exclusions | xargs gopherjs test --minify -v --short github.com/gopherjs/gopherjs/tests/... + + echo ">> Race tests." + go test -v -race ./... + + echo ">> Non-minified gopherjs tests should also work." + gopherjs test -v fmt diff --git a/.std_test_pkg_exclusions b/.std_test_pkg_exclusions new file mode 100644 index 000000000..474568539 --- /dev/null +++ b/.std_test_pkg_exclusions @@ -0,0 +1,81 @@ +# these are go list std packages we want to exclude from our tests +context +crypto +crypto/internal/cipherhw +crypto/tls +crypto/x509/pkix +debug/gosym +debug/plan9obj +encoding +go/build +go/importer +go/internal/gccgoimporter +go/internal/gcimporter +go/internal/srcimporter +go/types +hash +image/color/palette +image/internal/imageutil +internal/cpu +internal/nettrace +internal/poll +internal/race +internal/singleflight +internal/syscall/unix +internal/syscall/windows +internal/syscall/windows/registry +internal/syscall/windows/sysdll +internal/testenv +internal/testlog +internal/trace +log +log/syslog +net +net/http +net/http/cgi +net/http/httptest +net/http/httptrace +net/http/httputil +net/http/internal +net/http/pprof +net/internal/socktest +net/rpc +net/smtp +os +os/exec +os/signal +os/signal/internal/pty +os/user +plugin +runtime +runtime/cgo +runtime/debug +runtime/internal/atomic +runtime/internal/sys +runtime/pprof +runtime/pprof/internal/profile +runtime/race +runtime/trace +syscall +testing +testing/internal/testdeps +testing/iotest +unsafe +vendor/golang_org/x/crypto/chacha20poly1305 +vendor/golang_org/x/crypto/chacha20poly1305/internal/chacha20 +vendor/golang_org/x/crypto/cryptobyte +vendor/golang_org/x/crypto/cryptobyte/asn1 +vendor/golang_org/x/crypto/curve25519 +vendor/golang_org/x/crypto/poly1305 +vendor/golang_org/x/net/http2/hpack +vendor/golang_org/x/net/idna +vendor/golang_org/x/net/internal/nettest +vendor/golang_org/x/net/lex/httplex +vendor/golang_org/x/net/nettest +vendor/golang_org/x/net/proxy +vendor/golang_org/x/text/secure +vendor/golang_org/x/text/secure/bidirule +vendor/golang_org/x/text/transform +vendor/golang_org/x/text/unicode +vendor/golang_org/x/text/unicode/bidi +vendor/golang_org/x/text/unicode/norm diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 1a5f62651..000000000 --- a/circle.yml +++ /dev/null @@ -1,137 +0,0 @@ -machine: - node: - version: 10.0.0 - environment: - SOURCE_MAP_SUPPORT: false - -dependencies: - pre: - - cd /usr/local && sudo rm -rf go && curl https://storage.googleapis.com/golang/go1.10.1.linux-amd64.tar.gz | sudo tar -xz && sudo chmod a+w go/src/path/filepath - post: - - mv ./gopherjs $HOME/bin - - npm install --global node-gyp - - npm install # install our (dev) dependencies from package.json - - cd node-syscall && node-gyp rebuild && mkdir -p ~/.node_libraries/ && cp build/Release/syscall.node ~/.node_libraries/syscall.node - -test: - override: - - go generate github.com/gopherjs/gopherjs/compiler/prelude - - diff -u <(echo -n) <(git status --porcelain) - - diff -u <(echo -n) <(gofmt -d .) - - go tool vet *.go # Go package in root directory. - - for d in */; do echo $d; done | grep -v tests/ | grep -v third_party/ | xargs go tool vet # All subdirectories except "tests", "third_party". - - diff -u <(echo -n) <(go list ./compiler/natives/src/...) # All those packages should have // +build js. - - gopherjs install -v net/http # Should build successfully (can't run tests, since only client is supported). - - > - ulimit -s 10000 && gopherjs test --minify -v --short - github.com/gopherjs/gopherjs/tests - github.com/gopherjs/gopherjs/tests/main - github.com/gopherjs/gopherjs/js - archive/tar - archive/zip - bufio - bytes - compress/bzip2 - compress/flate - compress/gzip - compress/lzw - compress/zlib - container/heap - container/list - container/ring - crypto/aes - crypto/cipher - crypto/des - crypto/dsa - crypto/ecdsa - crypto/elliptic - crypto/hmac - crypto/md5 - crypto/rand - crypto/rc4 - crypto/rsa - crypto/sha1 - crypto/sha256 - crypto/sha512 - crypto/subtle - crypto/x509 - database/sql - database/sql/driver - debug/dwarf - debug/elf - debug/macho - debug/pe - encoding/ascii85 - encoding/asn1 - encoding/base32 - encoding/base64 - encoding/binary - encoding/csv - encoding/gob - encoding/hex - encoding/json - encoding/pem - encoding/xml - errors - expvar - flag - fmt - go/ast - go/constant - go/doc - go/format - go/parser - go/printer - go/scanner - go/token - hash/adler32 - hash/crc32 - hash/crc64 - hash/fnv - html - html/template - image - image/color - image/draw - image/gif - image/jpeg - image/png - index/suffixarray - io - io/ioutil - math - math/big - math/bits - math/cmplx - math/rand - mime - mime/multipart - mime/quotedprintable - net/http/cookiejar - net/http/fcgi - net/mail - net/rpc/jsonrpc - net/textproto - net/url - os/user - path - path/filepath - reflect - regexp - regexp/syntax - sort - strconv - strings - sync - sync/atomic - testing/quick - text/scanner - text/tabwriter - text/template - text/template/parse - time - unicode - unicode/utf16 - unicode/utf8 - - go test -v -race ./... - - gopherjs test -v fmt # No minification should work.