good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit a2abcd49 authored by Anmol Sethi's avatar Anmol Sethi
Browse files

Switch to arch linux for CI

Race detector doesn't work on alpine.

See https://github.com/golang/go/issues/14481
parent 1e606557
Branches
Tags
No related merge requests found
......@@ -7,15 +7,15 @@ jobs:
- checkout
- restore_cache:
keys:
- go-{{ checksum "go.sum" }}
- go-v1-{{ checksum "go.sum" }}
# Fallback to using the latest cache if no exact match is found.
- go-
- go-v1-
- run: ./ci/fmt.sh
- save_cache:
paths:
- /go
- /root/go
- /root/.cache/go-build
key: go-{{ checksum "go.sum" }}
key: go-v1-{{ checksum "go.sum" }}
lint:
docker:
......@@ -24,15 +24,15 @@ jobs:
- checkout
- restore_cache:
keys:
- go-{{ checksum "go.sum" }}
- go-v1-{{ checksum "go.sum" }}
# Fallback to using the latest cache if no exact match is found.
- go-
- go-v1-
- run: ./ci/lint.sh
- save_cache:
paths:
- /go
- /root/go
- /root/.cache/go-build
key: go-{{ checksum "go.sum" }}
key: go-v1-{{ checksum "go.sum" }}
test:
docker:
......@@ -41,17 +41,20 @@ jobs:
- checkout
- restore_cache:
keys:
- go-{{ checksum "go.sum" }}
- go-v1-{{ checksum "go.sum" }}
# Fallback to using the latest cache if no exact match is found.
- go-
- go-v1-
- run: ./ci/test.sh
- store_artifacts:
path: ci/out
destination: out
- save_cache:
paths:
- /go
- /root/go
- /root/.cache/go-build
key: go-{{ checksum "go.sum" }}
key: go-v1-{{ checksum "go.sum" }}
- store_test_results:
path: ci/out
bench:
docker:
......@@ -60,17 +63,18 @@ jobs:
- checkout
- restore_cache:
keys:
- go-{{ checksum "go.sum" }}
- go-v1-{{ checksum "go.sum" }}
# Fallback to using the latest cache if no exact match is found.
- go-
- go-v1-
- run: ./ci/bench.sh
- store_artifacts:
path: ci/out
destination: out
- save_cache:
paths:
- /go
- /root/go
- /root/.cache/go-build
key: go-{{ checksum "go.sum" }}
key: go-v1-{{ checksum "go.sum" }}
workflows:
version: 2
......
......@@ -5,12 +5,25 @@ cd "$(dirname "${0}")"
cd "$(git rev-parse --show-toplevel)"
mkdir -p ci/out
go test -vet=off -run=^$ -bench=. -o=ci/out/websocket.test \
-cpuprofile=ci/out/cpu.prof \
-memprofile=ci/out/mem.prof \
-blockprofile=ci/out/block.prof \
-mutexprofile=ci/out/mutex.prof \
benchArgs=(
"-vet=off"
"-run=^$"
"-bench=."
"-o=ci/out/websocket.test"
"-cpuprofile=ci/out/cpu.prof"
"-memprofile=ci/out/mem.prof"
"-blockprofile=ci/out/block.prof"
"-mutexprofile=ci/out/mutex.prof"
.
)
if [[ ${CI-} ]]; then
# https://circleci.com/docs/2.0/collect-test-data/
go test "${benchArgs[@]}" | tee /dev/stderr |
go run github.com/jstemmer/go-junit-report > ci/out/testReport.xml
else
go test "${benchArgs[@]}"
fi
echo
echo "Profiles are in ./ci/out/*.prof
......
FROM golang:1-alpine
FROM archlinux/base
RUN apk add --update bash git
RUN pacman -Syu --noconfirm
# Autobahn Test suite.
RUN apk add py2-pip python2-dev gcc libffi-dev libc-dev openssl-dev && \
pip install autobahntestsuite
RUN pacman -S --noconfirm go git shellcheck tar openssh gzip ca-certificates
# prettier.
RUN apk add npm && npm install -g prettier
RUN pacman -S --noconfirm gcc python2-pip && \
pip2 install autobahntestsuite
# shellcheck
RUN apk add xz curl && \
curl -o /tmp/shellcheck.tar.xz -L https://storage.googleapis.com/shellcheck/shellcheck-stable.linux.x86_64.tar.xz && \
tar -xf /tmp/shellcheck.tar.xz && \
ln -s "${PWD}/shellcheck-stable/shellcheck" /usr/local/bin/shellcheck
\ No newline at end of file
RUN pacman -S --noconfirm npm && \
npm install -g prettier
ENV GOFLAGS -mod=readonly
\ No newline at end of file
......@@ -5,6 +5,6 @@ cd "$(dirname "${0}")"
cd "$(git rev-parse --show-toplevel)"
# shellcheck disable=SC2046
shellcheck -e SC1091 -x $(git ls-files "*.sh")
shellcheck -x $(git ls-files "*.sh")
go vet ./...
go run golang.org/x/lint/golint -set_exit_status ./...
......@@ -5,12 +5,16 @@ cd "$(dirname "${0}")"
cd "$(git rev-parse --show-toplevel)"
mkdir -p ci/out
# If you'd like to modify the args to go test, just run go test directly, this script is meant
# for running tests at the end to get coverage and test under the race detector.
go test -race -vet=off -coverprofile=ci/out/coverage.prof -coverpkg=./... ./...
testFlags=(-race "-vet=off" "-coverprofile=ci/out/coverage.prof" "-coverpkg=./...")
if [[ ${CI-} ]]; then
# https://circleci.com/docs/2.0/collect-test-data/
go test "${testFlags[@]}" -v ./... 2>&1 | tee /dev/stderr |
go run github.com/jstemmer/go-junit-report > ci/out/testReport.xml
else
go test "${testFlags[@]}" ./...
fi
go tool cover -html=ci/out/coverage.prof -o=ci/out/coverage.html
if [[ ${CI:-} ]]; then
bash <(curl -s https://codecov.io/bash) -f ci/out/coverage.prof
else
go tool cover -html=ci/out/coverage.prof -o=ci/out/coverage.html
fi
......@@ -34,10 +34,8 @@ For remote coverage, you can use either [codecov](https://codecov.io/gh/nhooyr/w
You can also run any of the CI steps individually. All of them are scripts in the `ci` directory.
See [../ci/lint.sh](../ci/lint.sh) and [../ci/test.sh](../ci/test.sh) for the
installation of shellcheck, node and the Autobahn test suite on Debian or Ubuntu.
See [../ci/image/Dockerfile](../ci/image/Dockerfile) for the
installation of the CI dependencies on arch linux.
For Go, please refer to the [offical docs](https://golang.org/doc/install).
You can benchmark the library with `./ci/benchmark.sh`. You only need Go to run that script. Benchmark
profiles generated by that script are also available as artifacts on the bench step.
You can benchmark the library with `./ci/benchmark.sh`. You only need Go to run that script.
Benchmark profiles generated by that script are also available as artifacts on the bench step.
......@@ -5,6 +5,7 @@ go 1.12
require (
github.com/golang/protobuf v1.3.1
github.com/google/go-cmp v0.2.0
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024
github.com/kr/pretty v0.1.0 // indirect
go.coder.com/go-tools v0.0.0-20190317003359-0c6a35b74a16
golang.org/x/lint v0.0.0-20190409202823-959b441ac422
......
......@@ -4,6 +4,7 @@ package tools
// See https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md
import (
_ "github.com/jstemmer/go-junit-report"
_ "go.coder.com/go-tools/cmd/goimports"
_ "golang.org/x/lint/golint"
_ "golang.org/x/tools/cmd/stringer"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment