diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..6a5c43b --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,81 @@ +on: + push: + branches: + - master + pull_request: + branches: + - master + +name: run tests +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: x${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: 1.16.x + - name: Checkout code + uses: actions/checkout@v2 + - name: Run linters + uses: golangci/golangci-lint-action@v2 + with: + version: v1.29 + + test: + needs: lint + strategy: + matrix: + go-version: [1.16.x] + platform: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: x${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Install Go + if: success() + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - name: Run tests + run: go test -v -covermode=count + + coverage: + needs: lint + runs-on: ubuntu-latest + steps: + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: x${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Install Go + if: success() + uses: actions/setup-go@v2 + with: + go-version: 1.16.x + - name: Checkout code + uses: actions/checkout@v2 + - name: Calc coverage + run: | + go test -v -covermode=count -coverprofile=coverage.out + - name: Convert coverage.out to coverage.lcov + uses: jandelgado/gcov2lcov-action@v1.0.6 + - name: Coveralls + uses: coverallsapp/github-action@v1.1.2 + with: + github-token: ${{ secrets.github_token }} + path-to-lcov: coverage.lcov diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 28c8cc2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: go - -go: - - tip - -env: - - "PATH=$HOME/gopath/bin:$PATH" - -before_install: - - go get github.com/stretchr/testify/assert - - go get github.com/axw/gocov/gocov - - go get github.com/mattn/goveralls - - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi - -script: - - go test -v -covermode=count -coverprofile=coverage.out - - goveralls -coverprofile=coverage.out -service travis-ci -repotoken $COVERALLS_TOKEN