Skip to content

Commit 1675c03

Browse files
authored
Merge pull request #51 from arun0009/master
updating go version, issue template and build pipeline
2 parents 9d2f96a + 0015ab3 commit 1675c03

File tree

9 files changed

+542
-81
lines changed

9 files changed

+542
-81
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
### Issue Description
2+
3+
### Checklist
4+
5+
- [ ] Dependencies installed
6+
- [ ] No typos
7+
- [ ] Searched existing issues and docs
8+
9+
### Expected behaviour
10+
11+
### Actual behaviour
12+
13+
### Steps to reproduce
14+
15+
### Working code to debug
16+
17+
```go
18+
package main
19+
20+
func main() {
21+
}
22+
```
23+
24+
### Version/commit

.github/stale.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Number of days of inactivity before an issue becomes stale
2+
daysUntilStale: 60
3+
# Number of days of inactivity before a stale issue is closed
4+
daysUntilClose: 30
5+
# Issues with these labels will never be considered stale
6+
exemptLabels:
7+
- pinned
8+
- security
9+
- bug
10+
- enhancement
11+
# Label to use when marking an issue as stale
12+
staleLabel: stale
13+
# Comment to post when marking an issue as stale. Set to `false` to disable
14+
markComment: >
15+
This issue has been automatically marked as stale because it has not had
16+
recent activity. It will be closed within a month if no further activity occurs.
17+
Thank you for your contributions.
18+
# Comment to post when closing a stale issue. Set to `false` to disable
19+
closeComment: false

.github/workflows/echo-contrib.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- '**.go'
9+
- 'go.*'
10+
- '_fixture/**'
11+
- '.github/**'
12+
- 'codecov.yml'
13+
pull_request:
14+
branches:
15+
- master
16+
paths:
17+
- '**.go'
18+
- 'go.*'
19+
- '_fixture/**'
20+
- '.github/**'
21+
- 'codecov.yml'
22+
23+
jobs:
24+
test:
25+
strategy:
26+
matrix:
27+
os: [ubuntu-latest, macos-latest, windows-latest]
28+
go: [1.15, 1.16]
29+
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
30+
runs-on: ${{ matrix.os }}
31+
steps:
32+
- name: Set up Go ${{ matrix.go }}
33+
uses: actions/setup-go@v1
34+
with:
35+
go-version: ${{ matrix.go }}
36+
37+
- name: Set GOPATH and PATH
38+
run: |
39+
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
40+
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH
41+
shell: bash
42+
43+
- name: Set build variables
44+
run: |
45+
echo "GOPROXY=https://proxy.golang.org" >> $GITHUB_ENV
46+
echo "GO111MODULE=on" >> $GITHUB_ENV
47+
48+
- name: Checkout Code
49+
uses: actions/checkout@v1
50+
with:
51+
ref: ${{ github.ref }}
52+
53+
- name: Install Dependencies
54+
run: go get -v golang.org/x/lint/golint
55+
56+
- name: Run Tests
57+
run: |
58+
golint -set_exit_status ./...
59+
go test -race --coverprofile=coverage.coverprofile --covermode=atomic ./...
60+
61+
- name: Upload coverage to Codecov
62+
if: success() && matrix.go == 1.16 && matrix.os == 'ubuntu-latest'
63+
uses: codecov/codecov-action@v1
64+
with:
65+
token:
66+
fail_ci_if_error: false
67+
benchmark:
68+
needs: test
69+
strategy:
70+
matrix:
71+
os: [ubuntu-latest]
72+
go: [1.16]
73+
name: Benchmark comparison ${{ matrix.os }} @ Go ${{ matrix.go }}
74+
runs-on: ${{ matrix.os }}
75+
steps:
76+
- name: Set up Go ${{ matrix.go }}
77+
uses: actions/setup-go@v1
78+
with:
79+
go-version: ${{ matrix.go }}
80+
81+
- name: Set GOPATH and PATH
82+
run: |
83+
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
84+
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH
85+
shell: bash
86+
87+
- name: Set build variables
88+
run: |
89+
echo "GOPROXY=https://proxy.golang.org" >> $GITHUB_ENV
90+
echo "GO111MODULE=on" >> $GITHUB_ENV
91+
92+
- name: Checkout Code (Previous)
93+
uses: actions/checkout@v2
94+
with:
95+
ref: ${{ github.base_ref }}
96+
path: previous
97+
98+
- name: Checkout Code (New)
99+
uses: actions/checkout@v2
100+
with:
101+
path: new
102+
103+
- name: Install Dependencies
104+
run: go get -v golang.org/x/perf/cmd/benchstat
105+
106+
- name: Run Benchmark (Previous)
107+
run: |
108+
cd previous
109+
go test -run="-" -bench=".*" -count=8 ./... > benchmark.txt
110+
111+
- name: Run Benchmark (New)
112+
run: |
113+
cd new
114+
go test -run="-" -bench=".*" -count=8 ./... > benchmark.txt
115+
116+
- name: Run Benchstat
117+
run: |
118+
benchstat previous/benchmark.txt new/benchmark.txt

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
vendor
22
_test
33
coverage.txt
4+
.idea

.travis.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1+
arch:
2+
- amd64
3+
- ppc64le
4+
15
language: go
26
go:
3-
- 1.13.x
4-
- 1.12.x
7+
- 1.15.x
8+
- 1.16.x
59
- tip
610
env:
711
- GO111MODULE=on
812
install:
9-
- make dependency
13+
- go get -v golang.org/x/lint/golint
1014
script:
11-
- make test
15+
- golint -set_exit_status ./...
16+
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
1217
after_success:
1318
- bash <(curl -s https://codecov.io/bash)
1419
matrix:
1520
allow_failures:
16-
- go: tip
21+
- go: tip

Makefile

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,37 @@
1-
dependency:
2-
go mod download
3-
4-
test:
5-
echo "" > coverage.txt
6-
for d in $(shell go list ./... | grep -v vendor); do \
7-
go test -race -coverprofile=profile.out -covermode=atomic $$d || exit 1; \
8-
[ -f profile.out ] && cat profile.out >> coverage.txt && rm profile.out; \
9-
done
1+
PKG := "github.com/labstack/echo-contrib"
2+
PKG_LIST := $(shell go list ${PKG}/...)
3+
4+
tag:
5+
@git tag `grep -P '^\tversion = ' echo.go|cut -f2 -d'"'`
6+
@git tag|grep -v ^v
7+
8+
.DEFAULT_GOAL := check
9+
check: lint vet race ## Check project
10+
11+
init:
12+
@go get -u golang.org/x/lint/golint
13+
14+
format: ## Format the source code
15+
@find ./ -type f -name "*.go" -exec gofmt -w {} \;
16+
17+
lint: ## Lint the files
18+
@golint -set_exit_status ${PKG_LIST}
19+
20+
vet: ## Vet the files
21+
@go vet ${PKG_LIST}
22+
23+
test: ## Run tests
24+
@go test -short ${PKG_LIST}
25+
26+
race: ## Run tests with data race detector
27+
@go test -race ${PKG_LIST}
28+
29+
benchmark: ## Run benchmarks
30+
@go test -run="-" -bench=".*" ${PKG_LIST}
31+
32+
help: ## Display this help screen
33+
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
34+
35+
goversion ?= "1.16"
36+
test_version: ## Run tests inside Docker with given version (defaults to 1.15 oldest supported). Example: make test_version goversion=1.15
37+
@docker run --rm -it -v $(shell pwd):/project golang:$(goversion) /bin/sh -c "cd /project && make init check"

codecov.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
threshold: 1%
6+
patch:
7+
default:
8+
threshold: 1%
9+
10+
comment:
11+
require_changes: true

go.mod

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
module github.com/labstack/echo-contrib
22

3+
go 1.16
4+
35
require (
6+
github.com/HdrHistogram/hdrhistogram-go v1.1.0 // indirect
47
github.com/appleboy/gofight/v2 v2.1.2
5-
github.com/casbin/casbin/v2 v2.1.2
6-
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect
7-
github.com/golang/protobuf v1.4.3 // indirect
8+
github.com/casbin/casbin/v2 v2.25.5
89
github.com/gorilla/context v1.1.1
9-
github.com/gorilla/sessions v1.1.3
10-
github.com/labstack/echo/v4 v4.1.6
11-
github.com/labstack/gommon v0.2.9
12-
github.com/opentracing/opentracing-go v1.1.0
10+
github.com/gorilla/sessions v1.2.1
11+
github.com/labstack/echo/v4 v4.2.1
12+
github.com/labstack/gommon v0.3.0
13+
github.com/opentracing/opentracing-go v1.2.0
1314
github.com/openzipkin/zipkin-go v0.2.5
14-
github.com/pkg/errors v0.9.1 // indirect
15-
github.com/prometheus/client_golang v1.5.1
16-
github.com/prometheus/common v0.10.0
17-
github.com/prometheus/procfs v0.2.0 // indirect
18-
github.com/stretchr/testify v1.4.0
19-
github.com/uber-go/atomic v1.4.0 // indirect
20-
github.com/uber/jaeger-client-go v2.19.1-0.20191002155754-0be28c34dabf+incompatible
21-
github.com/uber/jaeger-lib v2.2.0+incompatible // indirect
22-
go.uber.org/atomic v1.5.0 // indirect
23-
golang.org/x/net v0.0.0-20200625001655-4c5254603344 // indirect
24-
golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 // indirect
25-
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114 // indirect
26-
gopkg.in/yaml.v2 v2.3.0 // indirect
15+
github.com/prometheus/client_golang v1.10.0
16+
github.com/prometheus/common v0.20.0
17+
github.com/stretchr/testify v1.7.0
18+
github.com/uber/jaeger-client-go v2.25.0+incompatible
19+
github.com/uber/jaeger-lib v2.4.0+incompatible // indirect
2720
)
28-
29-
go 1.12

0 commit comments

Comments
 (0)