Skip to content

Cover just mal package in code coverage (#20) #56

Cover just mal package in code coverage (#20)

Cover just mal package in code coverage (#20) #56

Workflow file for this run

name: tests
on:
push:
branches:
- main
pull_request:
jobs:
test:
strategy:
matrix:
go-version: [1.x]
platform: [ubuntu-latest]
include:
# Upload coverage only on this combination.
- go-version: 1.x
platform: ubuntu-latest
upload-coverage: true
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Download go modules
run: go mod download
- name: Cache go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Mod verify
run: go mod verify
- name: Run gofmt
if: runner.os != 'Windows'
run: '[ -z $(gofmt -s -l .) ] || (gofmt -s -d . && exit 1)'
- name: Run go vet
run: go vet ./...
- name: Run golint
run: |
go install golang.org/x/lint/golint@latest
golint `go list ./... | grep -v /vendor/`
- name: Run go test
run: go test -v -race -covermode=atomic -coverprofile=coverage.out github.com/nstratos/go-myanimelist/mal/...
- name: Upload test coverage to Coveralls
if: ${{ matrix.upload-coverage }}
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
go install github.com/mattn/goveralls@latest
goveralls -coverprofile=coverage.out -service=github