Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit ca68fdb

Browse files
authored
chore: add code coverage reporting (#243)
* Update actions to latest versions * Update golangci-lint to latest version, 1.36 * Pin Ubuntu to the latest, version 20.04 * Add coverage profiling test and send results to Coveralls
1 parent 4eafe01 commit ca68fdb

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

.github/workflows/test.yaml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ on: [push]
33

44
jobs:
55
fmt:
6-
runs-on: ubuntu-latest
6+
runs-on: ubuntu-20.04
77
steps:
8-
- uses: actions/checkout@v1
9-
- uses: actions/cache@v1
8+
- uses: actions/checkout@v2
9+
- uses: actions/cache@v2
1010
with:
1111
path: ~/go/pkg/mod
1212
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
@@ -18,33 +18,35 @@ jobs:
1818
args: make -j fmt
1919
- run: ./ci/scripts/files_changed.sh
2020
lint:
21-
runs-on: ubuntu-latest
21+
runs-on: ubuntu-20.04
2222
steps:
2323
- uses: actions/checkout@v2
2424
- name: golangci-lint
2525
uses: golangci/golangci-lint-action@v2
2626
with:
2727
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
28-
version: v1.29
28+
version: v1.36
2929
test:
30-
runs-on: ubuntu-latest
30+
runs-on: ubuntu-20.04
3131
steps:
32-
- uses: actions/checkout@v1
33-
- uses: actions/cache@v1
32+
- uses: actions/checkout@v2
33+
- uses: actions/cache@v2
3434
with:
3535
path: ~/go/pkg/mod
3636
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
3737
restore-keys: |
3838
${{ runner.os }}-go-
3939
- name: test
4040
uses: ./ci/image
41+
env:
42+
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4143
with:
42-
args: make -j test/go
44+
args: make -j test/coverage
4345
gendocs:
44-
runs-on: ubuntu-latest
46+
runs-on: ubuntu-20.04
4547
steps:
46-
- uses: actions/checkout@v1
47-
- uses: actions/cache@v1
48+
- uses: actions/checkout@v2
49+
- uses: actions/cache@v2
4850
with:
4951
path: ~/go/pkg/mod
5052
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,12 @@ gendocs:
3333

3434
test/go:
3535
go test $$(go list ./... | grep -v pkg/tcli | grep -v ci/integration | grep -v coder-sdk)
36+
37+
test/coverage:
38+
go test \
39+
-race \
40+
-covermode atomic \
41+
-coverprofile coverage \
42+
$$(go list ./... | grep -v pkg/tcli | grep -v ci/integration | grep -v coder-sdk)
43+
44+
goveralls -coverprofile=coverage -service=github

0 commit comments

Comments
 (0)