Skip to content

Commit

Permalink
Rework CI: Removed travis + gometalinter, added GitHub Actions + stat…
Browse files Browse the repository at this point in the history
…iccheck (#82)
  • Loading branch information
andygrunwald authored Dec 31, 2020
1 parent 590067b commit e56a0c4
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 65 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Testing

on:
push:
schedule:
- cron: "5 1 * * *"

jobs:
gofmt:
name: go fmt (Go ${{ matrix.go }})
runs-on: ubuntu-20.04
strategy:
matrix:
go: [ '1.15', '1.14', '1.13' ]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

# Caching go modules to speed up the run
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run go fmt
if: runner.os != 'Windows'
run: diff -u <(echo -n) <(gofmt -d -s .)

govet:
name: go vet (Go ${{ matrix.go }})
runs-on: ubuntu-20.04
strategy:
matrix:
go: [ '1.15', '1.14', '1.13' ]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

# Caching go modules to speed up the run
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run go vet
run: make vet

staticcheck:
name: staticcheck (Go ${{ matrix.go }})
runs-on: ubuntu-20.04
strategy:
matrix:
go: [ '1.15', '1.14', '1.13' ]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

# Caching go modules to speed up the run
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run staticcheck
run: make staticcheck

unittesting:
name: unit testing (Go ${{ matrix.go }})
runs-on: ubuntu-20.04
strategy:
matrix:
go: [ '1.15', '1.14', '1.13' ]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

# Caching go modules to speed up the run
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run Unit tests.
run: make test
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

36 changes: 14 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
.PHONY: fmt vet lint check test
PACKAGES = $(shell go list ./...)
PACKAGE_DIRS = $(shell go list -f '{{ .Dir }}' ./...)
.DEFAULT_GOAL := help

check: test vet lint
.PHONY: help
help: ## Outputs the help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

test:
go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
.PHONY: test
test: ## Runs all unit tests
go test -v -race ./...

vet:
go vet $(PACKAGES) || (go clean $(PACKAGES); go vet $(PACKAGES))
.PHONY: vet
vet: ## Runs go vet
go vet ./...

lint:
gometalinter --config gometalinter.json ./...

fmt:
go fmt $(PACKAGES)
goimports -w $(PACKAGE_DIRS)

deps:
go get -t -v ./...
go get github.com/axw/gocov/gocov
go get golang.org/x/tools/cmd/cover
[ -f $(GOPATH)/bin/gometalinter ] || go get -u github.com/alecthomas/gometalinter
[ -f $(GOPATH)/bin/goimports ] || go get golang.org/x/tools/cmd/goimports
gometalinter --install
.PHONY: staticcheck
staticcheck: ## Runs static code analyzer staticcheck
go get -u honnef.co/go/tools/cmd/staticcheck
staticcheck ./...
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# go-gerrit

[![GoDoc](https://godoc.org/github.com/andygrunwald/go-gerrit?status.svg)](https://godoc.org/github.com/andygrunwald/go-gerrit)
[![Build Status](https://travis-ci.org/andygrunwald/go-gerrit.svg?branch=master)](https://travis-ci.org/andygrunwald/go-gerrit)
[![Go Report Card](https://goreportcard.com/badge/github.com/andygrunwald/go-gerrit)](https://goreportcard.com/report/github.com/andygrunwald/go-gerrit)
[![codecov](https://codecov.io/gh/andygrunwald/go-gerrit/branch/master/graph/badge.svg)](https://codecov.io/gh/andygrunwald/go-gerrit)

go-gerrit is a [Go(lang)](https://golang.org/) client library for accessing the [Gerrit Code Review](https://www.gerritcodereview.com/) API.

Expand All @@ -23,7 +21,6 @@ go-gerrit is a [Go(lang)](https://golang.org/) client library for accessing the
* Supports optional plugin APIs such as
* events-log - [About](https://gerrit.googlesource.com/plugins/events-log/+/master/src/main/resources/Documentation/about.md), [REST API](https://gerrit.googlesource.com/plugins/events-log/+/master/src/main/resources/Documentation/rest-api-events.md)


## Installation

go-gerrit requires Go version 1.10 or greater.
Expand Down
23 changes: 0 additions & 23 deletions gometalinter.json

This file was deleted.

0 comments on commit e56a0c4

Please sign in to comment.