From a185b80c257a281fe76fedb68305bf81eefc09ad Mon Sep 17 00:00:00 2001 From: Jonathan Yu Date: Thu, 11 Feb 2021 21:45:21 -0800 Subject: [PATCH] chore: add code coverage reporting * 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 --- .github/workflows/test.yaml | 26 ++++++++++++++------------ Makefile | 9 +++++++++ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 81d4dcdd..45ac921d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -3,10 +3,10 @@ on: [push] jobs: fmt: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v1 - - uses: actions/cache@v1 + - uses: actions/checkout@v2 + - uses: actions/cache@v2 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} @@ -18,19 +18,19 @@ jobs: args: make -j fmt - run: ./ci/scripts/files_changed.sh lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.29 + version: v1.36 test: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v1 - - uses: actions/cache@v1 + - uses: actions/checkout@v2 + - uses: actions/cache@v2 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} @@ -38,13 +38,15 @@ jobs: ${{ runner.os }}-go- - name: test uses: ./ci/image + env: + COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - args: make -j test/go + args: make -j test/coverage gendocs: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v1 - - uses: actions/cache@v1 + - uses: actions/checkout@v2 + - uses: actions/cache@v2 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} diff --git a/Makefile b/Makefile index a926a30f..6703f8fa 100644 --- a/Makefile +++ b/Makefile @@ -33,3 +33,12 @@ gendocs: test/go: go test $$(go list ./... | grep -v pkg/tcli | grep -v ci/integration | grep -v coder-sdk) + +test/coverage: + go test \ + -race \ + -covermode atomic \ + -coverprofile coverage \ + $$(go list ./... | grep -v pkg/tcli | grep -v ci/integration | grep -v coder-sdk) + + goveralls -coverprofile=coverage -service=github