Skip to content

Commit 4e5177f

Browse files
committed
Back to GH Actions
See agnivade/wasmbrowsertest#15
1 parent 1f37f5d commit 4e5177f

File tree

13 files changed

+134
-131
lines changed

13 files changed

+134
-131
lines changed

.github/workflows/ci.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: ci
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
fmt:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v1
10+
- name: Run ./ci/fmt.sh
11+
uses: ./ci/container
12+
with:
13+
args: ./ci/fmt.sh
14+
15+
lint:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v1
19+
- name: Run ./ci/lint.sh
20+
uses: ./ci/container
21+
with:
22+
args: ./ci/lint.sh
23+
24+
test:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v1
28+
- name: Run ./ci/test.sh
29+
uses: ./ci/container
30+
with:
31+
args: ./ci/test.sh
32+
env:
33+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
34+
NETLIFY_SITE_ID: 9b3ee4dc-8297-4774-b4b9-a61561fbbce7
35+
- name: Upload coverage.html
36+
uses: actions/upload-artifact@v2
37+
with:
38+
name: coverage.html
39+
path: ./ci/out/coverage.html

.travis.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

Makefile

Lines changed: 0 additions & 7 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# websocket
22

33
[![godoc](https://godoc.org/nhooyr.io/websocket?status.svg)](https://pkg.go.dev/nhooyr.io/websocket)
4+
[![coverage](https://img.shields.io/badge/coverage-88%25-success)](https://nhooyrio-websocket-coverage.netlify.app)
45

56
websocket is a minimal and idiomatic WebSocket library for Go.
67

@@ -10,12 +11,11 @@ websocket is a minimal and idiomatic WebSocket library for Go.
1011
go get nhooyr.io/websocket
1112
```
1213

13-
## Features
14+
## Highlights
1415

1516
- Minimal and idiomatic API
1617
- First class [context.Context](https://blog.golang.org/context) support
1718
- Fully passes the WebSocket [autobahn-testsuite](https://github.com/crossbario/autobahn-testsuite)
18-
- Thorough tests with [90% coverage](https://coveralls.io/github/nhooyr/websocket)
1919
- [Single dependency](https://pkg.go.dev/nhooyr.io/websocket?tab=imports)
2020
- JSON and protobuf helpers in the [wsjson](https://pkg.go.dev/nhooyr.io/websocket/wsjson) and [wspb](https://pkg.go.dev/nhooyr.io/websocket/wspb) subpackages
2121
- Zero alloc reads and writes

ci/container/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM golang
2+
3+
RUN apt-get update
4+
RUN apt-get install -y npm shellcheck chromium
5+
6+
ENV GO111MODULE=on
7+
RUN go get golang.org/x/tools/cmd/goimports
8+
RUN go get mvdan.cc/sh/v3/cmd/shfmt
9+
RUN go get golang.org/x/tools/cmd/stringer
10+
RUN go get golang.org/x/lint/golint
11+
RUN go get github.com/agnivade/wasmbrowsertest
12+
13+
RUN npm install -g prettier
14+
RUN npm install -g netlify-cli

ci/ensure_fmt.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

ci/fmt.mk

Lines changed: 0 additions & 22 deletions
This file was deleted.

ci/fmt.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
main() {
5+
cd "$(dirname "$0")/.."
6+
7+
go mod tidy
8+
gofmt -w -s .
9+
goimports -w "-local=$(go list -m)" .
10+
11+
prettier \
12+
--write \
13+
--print-width=120 \
14+
--no-semi \
15+
--trailing-comma=all \
16+
--loglevel=warn \
17+
--arrow-parens=avoid \
18+
$(git ls-files "*.yml" "*.md" "*.js" "*.css" "*.html")
19+
shfmt -i 2 -w -s -sr $(git ls-files "*.sh")
20+
21+
stringer -type=opcode,MessageType,StatusCode -output=stringer.go
22+
23+
if [[ ${CI-} ]]; then
24+
ensure_fmt
25+
fi
26+
}
27+
28+
ensure_fmt() {
29+
if [[ $(git ls-files --other --modified --exclude-standard) ]]; then
30+
git -c color.ui=always --no-pager diff
31+
echo
32+
echo "Please run the following locally:"
33+
echo " ./ci/fmt.sh"
34+
exit 1
35+
fi
36+
}
37+
38+
main "$@"

ci/lint.mk

Lines changed: 0 additions & 16 deletions
This file was deleted.

ci/lint.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
main() {
5+
cd "$(dirname "$0")/.."
6+
7+
go vet ./...
8+
GOOS=js GOARCH=wasm go vet ./...
9+
10+
golint -set_exit_status ./...
11+
GOOS=js GOARCH=wasm golint -set_exit_status ./...
12+
13+
shellcheck --exclude=SC2046 $(git ls-files "*.sh")
14+
}
15+
16+
main "$@"

0 commit comments

Comments
 (0)