File tree 12 files changed +43
-73
lines changed
12 files changed +43
-73
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ CI must pass on your changes for them to be merged.
28
28
### CI
29
29
30
30
CI will ensure your code is formatted, lints and passes tests.
31
- It will collect coverage and report it to [ codecov ] ( https://codecov .io/gh /nhooyr/websocket )
31
+ It will collect coverage and report it to [ coveralls ] ( https://coveralls .io/github /nhooyr/websocket )
32
32
and also upload a html ` coverage ` artifact that you can download to browse coverage.
33
33
34
34
You can run CI locally.
@@ -42,7 +42,4 @@ See [ci/image/Dockerfile](../ci/image/Dockerfile) for the installation of the CI
42
42
43
43
For coverage details locally, see ` ci/out/coverage.html ` after running ` make test ` .
44
44
45
- You can also run tests normally with ` go test ` . ` make test ` just passes a default set of flags to
46
- ` go test ` to collect coverage and runs the WASM tests.
47
-
48
- Coverage percentage from codecov and the CI scripts will be different because they are calculated differently.
45
+ You can run tests normally with ` go test ` . ` make test ` wraps around ` go test ` to collect coverage.
Original file line number Diff line number Diff line change 1
1
name : ci
2
- on : [push]
2
+ on : [push, pull_request ]
3
3
4
4
jobs :
5
5
fmt :
6
6
runs-on : ubuntu-latest
7
- container : nhooyr/websocket-ci@sha256:ea94e078d2d589d654a2c759d952bf4199c754d80dadb20696dc3902359027cb
7
+ container : nhooyr/websocket-ci@sha256:8a8fd73fdea33585d50a33619c4936adfd016246a2ed6bbfbf06def24b518a6a
8
8
steps :
9
9
- uses : actions/checkout@v1
10
10
- run : make fmt
11
11
lint :
12
12
runs-on : ubuntu-latest
13
- container : nhooyr/websocket-ci@sha256:ea94e078d2d589d654a2c759d952bf4199c754d80dadb20696dc3902359027cb
13
+ container : nhooyr/websocket-ci@sha256:8a8fd73fdea33585d50a33619c4936adfd016246a2ed6bbfbf06def24b518a6a
14
14
steps :
15
15
- uses : actions/checkout@v1
16
16
- run : make lint
17
17
test :
18
18
runs-on : ubuntu-latest
19
- container : nhooyr/websocket-ci@sha256:ea94e078d2d589d654a2c759d952bf4199c754d80dadb20696dc3902359027cb
19
+ container : nhooyr/websocket-ci@sha256:8a8fd73fdea33585d50a33619c4936adfd016246a2ed6bbfbf06def24b518a6a
20
20
steps :
21
21
- uses : actions/checkout@v1
22
22
- run : make test
23
23
env :
24
- CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
24
+ COVERALLS_TOKEN : ${{ secrets.github_token }}
25
25
- name : Upload coverage.html
26
26
uses : actions/upload-artifact@master
27
27
with :
Original file line number Diff line number Diff line change @@ -4,10 +4,14 @@ all: fmt lint test
4
4
5
5
.PHONY : *
6
6
7
+ .ONESHELL :
8
+ SHELL = bash
9
+ .SHELLFLAGS = -ceuo pipefail
10
+
7
11
include ci/fmt.mk
8
12
include ci/lint.mk
9
13
include ci/test.mk
10
14
11
15
ci-image :
12
- docker build -f ./ci/image/ Dockerfile -t nhooyr/websocket-ci .
16
+ docker build -f ./ci/Dockerfile -t nhooyr/websocket-ci .
13
17
docker push nhooyr/websocket-ci
Original file line number Diff line number Diff line change 1
1
# websocket
2
2
3
- [ ![ GitHub release (latest SemVer) ] ( https://img.shields.io/github/v/release/nhooyr/websocket?color=6b9ded&sort=semver )] ( https://github.com/nhooyr/websocket/releases )
3
+ [ ![ GitHub Release ] ( https://img.shields.io/github/v/release/nhooyr/websocket?color=6b9ded&sort=semver )] ( https://github.com/nhooyr/websocket/releases )
4
4
[ ![ GoDoc] ( https://godoc.org/nhooyr.io/websocket?status.svg )] ( https://godoc.org/nhooyr.io/websocket )
5
- [ ![ Codecov ] ( https://img.shields.io/codecov/c/ github/nhooyr/websocket.svg ?color=65d6a4 )] ( https://codecov .io/gh /nhooyr/websocket )
5
+ [ ![ Coveralls ] ( https://img.shields.io/coveralls/ github/nhooyr/websocket?color=65d6a4 )] ( https://coveralls .io/github /nhooyr/websocket )
6
6
[ ![ Actions Status] ( https://github.com/nhooyr/websocket/workflows/ci/badge.svg )] ( https://github.com/nhooyr/websocket/actions )
7
7
8
8
websocket is a minimal and idiomatic WebSocket library for Go.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ FROM golang:1
3
3
RUN apt-get update
4
4
RUN apt-get install -y chromium
5
5
RUN apt-get install -y npm
6
- RUN apt-get install -y shellcheck
6
+ RUN apt-get install -y jq
7
7
8
8
ENV GOPATH=/root/gopath
9
9
ENV PATH=$GOPATH/bin:$PATH
@@ -12,15 +12,12 @@ ENV PAGER=cat
12
12
ENV CI=true
13
13
ENV MAKEFLAGS="--jobs=8 --output-sync=target"
14
14
15
- COPY ./ci/image/gitignore /root/.config/git/ignore
16
- RUN git config --system color.ui always
17
-
18
15
RUN npm install -g prettier
19
16
RUN go get golang.org/x/tools/cmd/stringer
20
17
RUN go get golang.org/x/tools/cmd/goimports
21
- RUN go get mvdan.cc/sh/cmd/shfmt
22
18
RUN go get golang.org/x/lint/golint
23
19
RUN go get github.com/agnivade/wasmbrowsertest
20
+ RUN go get github.com/mattn/goveralls
24
21
25
22
# Cache go modules and build cache.
26
23
COPY . /tmp/websocket
Original file line number Diff line number Diff line change 1
- fmt : modtidy gofmt goimports prettier shfmt
1
+ fmt : modtidy gofmt goimports prettier
2
2
ifdef CI
3
- ./ci/fmtcheck.sh
3
+ if [[ $$(git ls-files --other --modified --exclude-standard) != "" ]]; then
4
+ echo "Files need generation or are formatted incorrectly:"
5
+ git -c color.ui=always status | grep --color=no '\e\[31m'
6
+ echo "Please run the following locally:"
7
+ echo " make fmt"
8
+ exit 1
9
+ fi
4
10
endif
5
11
6
12
modtidy : gen
@@ -12,11 +18,8 @@ gofmt: gen
12
18
goimports : gen
13
19
goimports -w " -local=$$ (go list -m)" .
14
20
15
- prettier : gen
16
- prettier --write --print-width=120 --no-semi --trailing-comma=all --loglevel=warn $$(git ls-files "*.yaml" "*.yml" "*.md" "*.ts" )
17
-
18
- shfmt : gen
19
- shfmt -i 2 -w -s -sr .
21
+ prettier :
22
+ prettier --write --print-width=120 --no-semi --trailing-comma=all --loglevel=warn $$(git ls-files "*.yml" "*.md" )
20
23
21
24
gen :
22
25
go generate ./...
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- lint : govet golint govet-wasm golint-wasm shellcheck
1
+ lint : govet golint govet-wasm golint-wasm
2
2
3
3
govet :
4
4
go vet ./...
@@ -11,6 +11,3 @@ golint:
11
11
12
12
golint-wasm :
13
13
GOOS=js GOARCH=wasm golint -set_exit_status ./...
14
-
15
- shellcheck :
16
- shellcheck -x $$(git ls-files "*.sh" )
Original file line number Diff line number Diff line change 1
- test : gotest
2
-
3
- gotest : _gotest htmlcov
1
+ test : gotest ci/out/coverage.html
4
2
ifdef CI
5
- gotest : codecov
3
+ test : coveralls
6
4
endif
7
5
8
- htmlcov : _gotest
6
+ ci/out/coverage.html : gotest
9
7
go tool cover -html=ci/out/coverage.prof -o=ci/out/coverage.html
10
8
11
- codecov : _gotest
12
- curl -s https://codecov.io/bash | bash -s -- -Z -f ci/out/coverage.prof
13
-
14
- _gotest :
15
- go test -parallel=32 -coverprofile=ci/out/coverage.prof -coverpkg=./... $$ TESTFLAGS ./...
9
+ coveralls : gotest
10
+ # https://github.com/coverallsapp/github-action/blob/master/src/run.ts
11
+ echo " --- coveralls"
12
+ export GIT_BRANCH=" $$ GITHUB_REF"
13
+ export BUILD_NUMBER=" $$ GITHUB_SHA"
14
+ if [[ $$ GITHUB_EVENT_NAME == pull_request ]]; then
15
+ export CI_PULL_REQUEST=" $$ (jq .number " $$ GITHUB_EVENT_PATH" )"
16
+ BUILD_NUMBER=" $$ BUILD_NUMBER-PR-$$ CI_PULL_REQUEST"
17
+ fi
18
+ goveralls -coverprofile=ci/out/coverage.prof -service=github
19
+ gotest :
20
+ go test -covermode=count -coverprofile=ci/out/coverage.prof -coverpkg=./... $$ {GOTESTFLAGS-} ./...
16
21
sed -i ' /_stringer\.go/d' ci/out/coverage.prof
17
22
sed -i ' /wsecho\.go/d' ci/out/coverage.prof
18
23
sed -i ' /assert\.go/d' ci/out/coverage.prof
Original file line number Diff line number Diff line change @@ -1023,14 +1023,7 @@ func TestAutobahn(t *testing.T) {
1023
1023
t .Run (name , func (t * testing.T ) {
1024
1024
t .Parallel ()
1025
1025
1026
- t .Run ("server" , func (t * testing.T ) {
1027
- t .Parallel ()
1028
- run2 (t , false )
1029
- })
1030
- t .Run ("client" , func (t * testing.T ) {
1031
- t .Parallel ()
1032
- run2 (t , true )
1033
- })
1026
+ run2 (t , true )
1034
1027
})
1035
1028
}
1036
1029
You can’t perform that action at this time.
0 commit comments