File tree Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Expand file tree Collapse file tree 3 files changed +14
-9
lines changed 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:046cd02e79dcbf81dc06eb6fd333fa8643f2503f437ddd46a4c1af9132078a2c
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:046cd02e79dcbf81dc06eb6fd333fa8643f2503f437ddd46a4c1af9132078a2c
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:046cd02e79dcbf81dc06eb6fd333fa8643f2503f437ddd46a4c1af9132078a2c
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
- COVERALLS_TOKEN : ${{ secrets.COVERALLS_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 @@ -3,6 +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 jq
6
7
7
8
ENV GOPATH=/root/gopath
8
9
ENV PATH=$GOPATH/bin:$PATH
Original file line number Diff line number Diff line change @@ -7,11 +7,15 @@ ci/out/coverage.html: gotest
7
7
go tool cover -html=ci/out/coverage.prof -o=ci/out/coverage.html
8
8
9
9
coveralls : gotest
10
+ # https://github.com/coverallsapp/github-action/blob/master/src/run.ts
10
11
echo " --- coveralls"
11
- export GIT_BRANCH=$$ {GITHUB_REF}
12
- export BUILD_NUMBER=$$ {GITHUB_ACTION}
13
- goveralls -coverprofile=ci/out/coverage.prof -service=github-actions
14
-
12
+ export GIT_BRANCH=" $$ (basename " $$ 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 -debug -coverprofile=ci/out/coverage.prof -service=github
15
19
gotest :
16
20
go test -covermode=count -coverprofile=ci/out/coverage.prof -coverpkg=./... $$ {GOTESTFLAGS-} ./...
17
21
sed -i ' /_stringer\.go/d' ci/out/coverage.prof
You can’t perform that action at this time.
0 commit comments