good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
websocket
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
websocket
Commits
dd107dd1
Unverified
Commit
dd107dd1
authored
5 years ago
by
Anmol Sethi
Browse files
Options
Downloads
Patches
Plain Diff
Update CI
parent
d0a80496
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.github/CODEOWNERS
+1
-0
1 addition, 0 deletions
.github/CODEOWNERS
.github/workflows/ci.yml
+32
-6
32 additions, 6 deletions
.github/workflows/ci.yml
Makefile
+0
-4
0 additions, 4 deletions
Makefile
ci/image/Dockerfile
+0
-13
0 additions, 13 deletions
ci/image/Dockerfile
conn_test.go
+35
-34
35 additions, 34 deletions
conn_test.go
with
68 additions
and
57 deletions
.github/CODEOWNERS
0 → 100644
+
1
−
0
View file @
dd107dd1
*
@nhooyr
This diff is collapsed.
Click to expand it.
.github/workflows/ci.yml
+
32
−
6
View file @
dd107dd1
...
@@ -4,22 +4,48 @@ on: [push, pull_request]
...
@@ -4,22 +4,48 @@ on: [push, pull_request]
jobs
:
jobs
:
fmt
:
fmt
:
runs-on
:
ubuntu-latest
runs-on
:
ubuntu-latest
container
:
nhooyr/websocket-ci@sha256:8a8fd73fdea33585d50a33619c4936adfd016246a2ed6bbfbf06def24b518a6a
steps
:
steps
:
-
uses
:
actions/checkout@v1
-
uses
:
actions/checkout@v1
-
run
:
make fmt
-
uses
:
actions/cache@v1
with
:
path
:
~/go/pkg/mod
key
:
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys
:
|
${{ runner.os }}-go-
-
name
:
make fmt
uses
:
./ci/image
with
:
args
:
make fmt
lint
:
lint
:
runs-on
:
ubuntu-latest
runs-on
:
ubuntu-latest
container
:
nhooyr/websocket-ci@sha256:8a8fd73fdea33585d50a33619c4936adfd016246a2ed6bbfbf06def24b518a6a
steps
:
steps
:
-
uses
:
actions/checkout@v1
-
uses
:
actions/checkout@v1
-
run
:
make lint
-
uses
:
actions/cache@v1
with
:
path
:
~/go/pkg/mod
key
:
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys
:
|
${{ runner.os }}-go-
-
name
:
make lint
uses
:
./ci/image
with
:
args
:
make lint
test
:
test
:
runs-on
:
ubuntu-latest
runs-on
:
ubuntu-latest
container
:
nhooyr/websocket-ci@sha256:8a8fd73fdea33585d50a33619c4936adfd016246a2ed6bbfbf06def24b518a6a
steps
:
steps
:
-
uses
:
actions/checkout@v1
-
uses
:
actions/checkout@v1
-
run
:
make test
-
uses
:
actions/cache@v1
with
:
path
:
~/go/pkg/mod
key
:
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys
:
|
${{ runner.os }}-go-
-
name
:
make test
uses
:
./ci/image
with
:
args
:
make test
env
:
env
:
COVERALLS_TOKEN
:
${{ secrets.github_token }}
COVERALLS_TOKEN
:
${{ secrets.github_token }}
-
name
:
Upload coverage.html
-
name
:
Upload coverage.html
...
...
This diff is collapsed.
Click to expand it.
Makefile
+
0
−
4
View file @
dd107dd1
...
@@ -11,7 +11,3 @@ SHELL = bash
...
@@ -11,7 +11,3 @@ SHELL = bash
include
ci/fmt.mk
include
ci/fmt.mk
include
ci/lint.mk
include
ci/lint.mk
include
ci/test.mk
include
ci/test.mk
ci-image
:
docker build
-f
./ci/Dockerfile
-t
nhooyr/websocket-ci .
docker push nhooyr/websocket-ci
This diff is collapsed.
Click to expand it.
ci/Dockerfile
→
ci/
image/
Dockerfile
+
0
−
13
View file @
dd107dd1
...
@@ -5,8 +5,6 @@ RUN apt-get install -y chromium
...
@@ -5,8 +5,6 @@ RUN apt-get install -y chromium
RUN
apt-get
install
-y
npm
RUN
apt-get
install
-y
npm
RUN
apt-get
install
-y
jq
RUN
apt-get
install
-y
jq
ENV
GOPATH=/root/gopath
ENV
PATH=$GOPATH/bin:$PATH
ENV
GOFLAGS="-mod=readonly"
ENV
GOFLAGS="-mod=readonly"
ENV
PAGER=cat
ENV
PAGER=cat
ENV
CI=true
ENV
CI=true
...
@@ -18,14 +16,3 @@ RUN go get golang.org/x/tools/cmd/goimports
...
@@ -18,14 +16,3 @@ RUN go get golang.org/x/tools/cmd/goimports
RUN
go get golang.org/x/lint/golint
RUN
go get golang.org/x/lint/golint
RUN
go get github.com/agnivade/wasmbrowsertest
RUN
go get github.com/agnivade/wasmbrowsertest
RUN
go get github.com/mattn/goveralls
RUN
go get github.com/mattn/goveralls
# Cache go modules and build cache.
COPY
. /tmp/websocket
RUN
cd
/tmp/websocket
&&
\
CI
=
make
&&
\
rm
-rf
/tmp/websocket
# GitHub actions tries to override HOME to /github/home and then
# mounts a temp directory into there. We do not want this behaviour.
# I assume it is so that $HOME is preserved between steps in a job.
ENTRYPOINT
["env", "HOME=/root"]
This diff is collapsed.
Click to expand it.
conn_test.go
+
35
−
34
View file @
dd107dd1
...
@@ -17,6 +17,41 @@ import (
...
@@ -17,6 +17,41 @@ import (
"nhooyr.io/websocket"
"nhooyr.io/websocket"
)
)
func
TestConn
(
t
*
testing
.
T
)
{
t
.
Parallel
()
t
.
Run
(
"json"
,
func
(
t
*
testing
.
T
)
{
s
,
closeFn
:=
testServer
(
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
c
,
err
:=
websocket
.
Accept
(
w
,
r
,
&
websocket
.
AcceptOptions
{
Subprotocols
:
[]
string
{
"echo"
},
InsecureSkipVerify
:
true
,
})
assert
.
Success
(
t
,
err
)
defer
c
.
Close
(
websocket
.
StatusInternalError
,
""
)
err
=
echoLoop
(
r
.
Context
(),
c
)
assertCloseStatus
(
t
,
websocket
.
StatusNormalClosure
,
err
)
},
false
)
defer
closeFn
()
wsURL
:=
strings
.
Replace
(
s
.
URL
,
"http"
,
"ws"
,
1
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
time
.
Minute
)
defer
cancel
()
opts
:=
&
websocket
.
DialOptions
{
Subprotocols
:
[]
string
{
"echo"
},
}
opts
.
HTTPClient
=
s
.
Client
()
c
,
_
,
err
:=
websocket
.
Dial
(
ctx
,
wsURL
,
opts
)
assert
.
Success
(
t
,
err
)
assertJSONEcho
(
t
,
ctx
,
c
,
2
)
})
}
func
testServer
(
tb
testing
.
TB
,
fn
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
),
tls
bool
)
(
s
*
httptest
.
Server
,
closeFn
func
())
{
func
testServer
(
tb
testing
.
TB
,
fn
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
),
tls
bool
)
(
s
*
httptest
.
Server
,
closeFn
func
())
{
h
:=
http
.
HandlerFunc
(
fn
)
h
:=
http
.
HandlerFunc
(
fn
)
if
tls
{
if
tls
{
...
@@ -108,37 +143,3 @@ func echoLoop(ctx context.Context, c *websocket.Conn) error {
...
@@ -108,37 +143,3 @@ func echoLoop(ctx context.Context, c *websocket.Conn) error {
}
}
}
}
}
}
func
TestConn
(
t
*
testing
.
T
)
{
t
.
Parallel
()
t
.
Run
(
"json"
,
func
(
t
*
testing
.
T
)
{
s
,
closeFn
:=
testServer
(
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
c
,
err
:=
websocket
.
Accept
(
w
,
r
,
&
websocket
.
AcceptOptions
{
Subprotocols
:
[]
string
{
"echo"
},
InsecureSkipVerify
:
true
,
})
assert
.
Success
(
t
,
err
)
defer
c
.
Close
(
websocket
.
StatusInternalError
,
""
)
err
=
echoLoop
(
r
.
Context
(),
c
)
assertCloseStatus
(
t
,
websocket
.
StatusNormalClosure
,
err
)
},
false
)
defer
closeFn
()
wsURL
:=
strings
.
Replace
(
s
.
URL
,
"http"
,
"ws"
,
1
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
time
.
Minute
)
defer
cancel
()
opts
:=
&
websocket
.
DialOptions
{
Subprotocols
:
[]
string
{
"echo"
},
}
opts
.
HTTPClient
=
s
.
Client
()
c
,
_
,
err
:=
websocket
.
Dial
(
ctx
,
wsURL
,
opts
)
assert
.
Success
(
t
,
err
)
assertJSONEcho
(
t
,
ctx
,
c
,
2
)
})
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment