-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
44 lines (38 loc) · 2.02 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
sudo: false
install:
# Manually download and install Go because the Travis / gimme version has been broken in the past:
# https://travis-ci.community/t/goos-js-goarch-wasm-go-run-fails-panic-newosproc-not-implemented/1651/6
- wget -O go.tar.gz https://dl.google.com/go/go1.15.linux-amd64.tar.gz
- tar -C ~ -xzf go.tar.gz
- rm go.tar.gz
- export GOROOT=~/go
- export PATH=$GOROOT/bin:$PATH
- go version
- go env
# Install NodeJS (for testing WebAssembly support)
- nvm install 14.7.0
# Linters, etc.
- go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
- go get -u github.com/haya14busa/goverage
- go get -u mvdan.cc/gofumpt
- go get -u mvdan.cc/gofumpt/gofumports
script:
# Fetch dependencies.
- go get -d .
- GOOS=js GOARCH=wasm go get -d ./...
# Ensure consistent code style.
- diff -u <(echo -n) <(gofumpt -d -s .)
- diff -u <(echo -n) <(gofumports -d .)
# Consult golangci-lint (multiple Go linting tools).
- golangci-lint run . ./elem/... ./event/...
- golangci-lint run --exclude 'exported .* should have comment .*or be unexported' ./prop/... ./style/... # https://github.com/hexops/vecty/issues/227
- GOOS=js GOARCH=wasm golangci-lint run --build-tags 'js wasm' . ./elem/... ./event/...
- GOOS=js GOARCH=wasm golangci-lint run --build-tags 'js wasm' --exclude 'exported .* should have comment .*or be unexported' ./prop/... ./style/... # https://github.com/hexops/vecty/issues/227
- bash -c 'cd example && golangci-lint run ./markdown'
- bash -c 'cd example && GOOS=js GOARCH=wasm golangci-lint run --build-tags 'js wasm' ./...'
# Test with Go compiler (under amd64 and wasm architectures.)
- go test -race ./...
- GOOS=js GOARCH=wasm go test -exec="$(go env GOROOT)/misc/wasm/go_js_wasm_exec" ./...
# Generate and upload coverage to codecov.io
- goverage -covermode=atomic -coverprofile=coverage.out $(go list ./... | grep -v -e vecty/elem -e vecty/event -e vecty/example -e vecty/prop -e vecty/style)
- include_cov=coverage.out bash <(curl -s https://codecov.io/bash)