Skip to content

Commit 2166f8a

Browse files
committed
Cleanup coveralls setup
1 parent b0ac42c commit 2166f8a

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
name: ci
2-
on: [push]
2+
on: [push, pull_request]
33

44
jobs:
55
fmt:
66
runs-on: ubuntu-latest
7-
container: nhooyr/websocket-ci@sha256:046cd02e79dcbf81dc06eb6fd333fa8643f2503f437ddd46a4c1af9132078a2c
7+
container: nhooyr/websocket-ci@sha256:8a8fd73fdea33585d50a33619c4936adfd016246a2ed6bbfbf06def24b518a6a
88
steps:
99
- uses: actions/checkout@v1
1010
- run: make fmt
1111
lint:
1212
runs-on: ubuntu-latest
13-
container: nhooyr/websocket-ci@sha256:046cd02e79dcbf81dc06eb6fd333fa8643f2503f437ddd46a4c1af9132078a2c
13+
container: nhooyr/websocket-ci@sha256:8a8fd73fdea33585d50a33619c4936adfd016246a2ed6bbfbf06def24b518a6a
1414
steps:
1515
- uses: actions/checkout@v1
1616
- run: make lint
1717
test:
1818
runs-on: ubuntu-latest
19-
container: nhooyr/websocket-ci@sha256:046cd02e79dcbf81dc06eb6fd333fa8643f2503f437ddd46a4c1af9132078a2c
19+
container: nhooyr/websocket-ci@sha256:8a8fd73fdea33585d50a33619c4936adfd016246a2ed6bbfbf06def24b518a6a
2020
steps:
2121
- uses: actions/checkout@v1
2222
- run: make test
2323
env:
24-
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
24+
COVERALLS_TOKEN: ${{ secrets.github_token }}
2525
- name: Upload coverage.html
2626
uses: actions/upload-artifact@master
2727
with:

ci/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FROM golang:1
33
RUN apt-get update
44
RUN apt-get install -y chromium
55
RUN apt-get install -y npm
6+
RUN apt-get install -y jq
67

78
ENV GOPATH=/root/gopath
89
ENV PATH=$GOPATH/bin:$PATH

ci/test.mk

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ ci/out/coverage.html: gotest
77
go tool cover -html=ci/out/coverage.prof -o=ci/out/coverage.html
88

99
coveralls: gotest
10+
# https://github.com/coverallsapp/github-action/blob/master/src/run.ts
1011
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
1519
gotest:
1620
go test -covermode=count -coverprofile=ci/out/coverage.prof -coverpkg=./... $${GOTESTFLAGS-} ./...
1721
sed -i '/_stringer\.go/d' ci/out/coverage.prof

0 commit comments

Comments
 (0)