-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from commonlispbr/feature/tests
Add unit tests and CI config
- Loading branch information
Showing
4 changed files
with
311 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
on: [push, pull_request] | ||
name: test | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13.x | ||
- name: Checkout code | ||
uses: actions/checkout@v1 | ||
- name: Install golangci-lint | ||
run: | | ||
go get github.com/golangci/golangci-lint/cmd/golangci-lint | ||
- name: Run linters | ||
run: | | ||
export PATH=$PATH:$(go env GOPATH)/bin | ||
golangci-lint -E bodyclose,misspell,gocyclo,dupl,gofmt,golint,unconvert,goimports,depguard,gocritic,funlen,interfacer run | ||
test: | ||
strategy: | ||
matrix: | ||
go-version: [1.13.x, 1.14.x] | ||
platform: [ubuntu-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Install Go | ||
if: success() | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Checkout code | ||
uses: actions/checkout@v1 | ||
- name: Run tests | ||
run: go test -v -covermode=count | ||
|
||
coverage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
if: success() | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13.x | ||
- name: Checkout code | ||
uses: actions/checkout@v1 | ||
- name: Calc coverage | ||
run: | | ||
export PATH=$PATH:$(go env GOPATH)/bin | ||
go test -v -covermode=count -coverprofile=coverage.out | ||
- name: Convert coverage to lcov | ||
uses: jandelgado/gcov2lcov-action@v1.0.0 | ||
with: | ||
infile: coverage.out | ||
outfile: coverage.lcov | ||
- name: Codecov | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./coverage.lcov | ||
flags: unittests | ||
fail_ci_if_error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.