Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite3004df

Browse files
committed
Update CI
1 parent53231f0 commite3004df

File tree

5 files changed

+68
-57
lines changed

5 files changed

+68
-57
lines changed

‎.github/CODEOWNERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*@nhooyr

‎.github/workflows/ci.yml‎

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,48 @@ on: [push, pull_request]
44
jobs:
55
fmt:
66
runs-on:ubuntu-latest
7-
container:nhooyr/websocket-ci@sha256:8a8fd73fdea33585d50a33619c4936adfd016246a2ed6bbfbf06def24b518a6a
87
steps:
98
-uses:actions/checkout@v1
10-
-run:make fmt
9+
-uses:actions/cache@v1
10+
with:
11+
path:~/go/pkg/mod
12+
key:${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
13+
restore-keys:|
14+
${{ runner.os }}-go-
15+
-name:make fmt
16+
uses:./ci/image
17+
with:
18+
args:make fmt
19+
1120
lint:
1221
runs-on:ubuntu-latest
13-
container:nhooyr/websocket-ci@sha256:8a8fd73fdea33585d50a33619c4936adfd016246a2ed6bbfbf06def24b518a6a
1422
steps:
1523
-uses:actions/checkout@v1
16-
-run:make lint
24+
-uses:actions/cache@v1
25+
with:
26+
path:~/go/pkg/mod
27+
key:${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
28+
restore-keys:|
29+
${{ runner.os }}-go-
30+
-name:make lint
31+
uses:./ci/image
32+
with:
33+
args:make lint
34+
1735
test:
1836
runs-on:ubuntu-latest
19-
container:nhooyr/websocket-ci@sha256:8a8fd73fdea33585d50a33619c4936adfd016246a2ed6bbfbf06def24b518a6a
2037
steps:
2138
-uses:actions/checkout@v1
22-
-run:make test
39+
-uses:actions/cache@v1
40+
with:
41+
path:~/go/pkg/mod
42+
key:${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
43+
restore-keys:|
44+
${{ runner.os }}-go-
45+
-name:make test
46+
uses:./ci/image
47+
with:
48+
args:make test
2349
env:
2450
COVERALLS_TOKEN:${{ secrets.github_token }}
2551
-name:Upload coverage.html

‎Makefile‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,3 @@ SHELL = bash
1111
include ci/fmt.mk
1212
include ci/lint.mk
1313
include ci/test.mk
14-
15-
ci-image:
16-
docker build -f ./ci/Dockerfile -t nhooyr/websocket-ci.
17-
docker push nhooyr/websocket-ci

‎ci/Dockerfile‎renamed to ‎ci/image/Dockerfile‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ RUN apt-get install -y chromium
55
RUN apt-get install -y npm
66
RUN apt-get install -y jq
77

8-
ENV GOPATH=/root/gopath
9-
ENV PATH=$GOPATH/bin:$PATH
108
ENV GOFLAGS="-mod=readonly"
119
ENV PAGER=cat
1210
ENV CI=true
@@ -18,14 +16,3 @@ RUN go get golang.org/x/tools/cmd/goimports
1816
RUN go get golang.org/x/lint/golint
1917
RUN go get github.com/agnivade/wasmbrowsertest
2018
RUN go get github.com/mattn/goveralls
21-
22-
# Cache go modules and build cache.
23-
COPY . /tmp/websocket
24-
RUN cd /tmp/websocket && \
25-
CI= make && \
26-
rm -rf /tmp/websocket
27-
28-
# GitHub actions tries to override HOME to /github/home and then
29-
# mounts a temp directory into there. We do not want this behaviour.
30-
# I assume it is so that $HOME is preserved between steps in a job.
31-
ENTRYPOINT ["env","HOME=/root"]

‎conn_test.go‎

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,41 @@ import (
1717
"nhooyr.io/websocket"
1818
)
1919

20+
funcTestConn(t*testing.T) {
21+
t.Parallel()
22+
23+
t.Run("json",func(t*testing.T) {
24+
s,closeFn:=testServer(t,func(w http.ResponseWriter,r*http.Request) {
25+
c,err:=websocket.Accept(w,r,&websocket.AcceptOptions{
26+
Subprotocols: []string{"echo"},
27+
InsecureSkipVerify:true,
28+
})
29+
assert.Success(t,err)
30+
deferc.Close(websocket.StatusInternalError,"")
31+
32+
err=echoLoop(r.Context(),c)
33+
assertCloseStatus(t,websocket.StatusNormalClosure,err)
34+
},false)
35+
defercloseFn()
36+
37+
wsURL:=strings.Replace(s.URL,"http","ws",1)
38+
39+
ctx,cancel:=context.WithTimeout(context.Background(),time.Minute)
40+
defercancel()
41+
42+
opts:=&websocket.DialOptions{
43+
Subprotocols: []string{"echo"},
44+
}
45+
opts.HTTPClient=s.Client()
46+
47+
c,_,err:=websocket.Dial(ctx,wsURL,opts)
48+
assert.Success(t,err)
49+
50+
assertJSONEcho(t,ctx,c,2)
51+
})
52+
}
53+
54+
2055
functestServer(tb testing.TB,fnfunc(w http.ResponseWriter,r*http.Request),tlsbool) (s*httptest.Server,closeFnfunc()) {
2156
h:=http.HandlerFunc(fn)
2257
iftls {
@@ -108,37 +143,3 @@ func echoLoop(ctx context.Context, c *websocket.Conn) error {
108143
}
109144
}
110145
}
111-
112-
funcTestConn(t*testing.T) {
113-
t.Parallel()
114-
115-
t.Run("json",func(t*testing.T) {
116-
s,closeFn:=testServer(t,func(w http.ResponseWriter,r*http.Request) {
117-
c,err:=websocket.Accept(w,r,&websocket.AcceptOptions{
118-
Subprotocols: []string{"echo"},
119-
InsecureSkipVerify:true,
120-
})
121-
assert.Success(t,err)
122-
deferc.Close(websocket.StatusInternalError,"")
123-
124-
err=echoLoop(r.Context(),c)
125-
assertCloseStatus(t,websocket.StatusNormalClosure,err)
126-
},false)
127-
defercloseFn()
128-
129-
wsURL:=strings.Replace(s.URL,"http","ws",1)
130-
131-
ctx,cancel:=context.WithTimeout(context.Background(),time.Minute)
132-
defercancel()
133-
134-
opts:=&websocket.DialOptions{
135-
Subprotocols: []string{"echo"},
136-
}
137-
opts.HTTPClient=s.Client()
138-
139-
c,_,err:=websocket.Dial(ctx,wsURL,opts)
140-
assert.Success(t,err)
141-
142-
assertJSONEcho(t,ctx,c,2)
143-
})
144-
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp