Skip to content

Commit e2612d6

Browse files
authored
chore(ci): adds CI. (hypertrace#1)
1 parent 39220a6 commit e2612d6

File tree

3 files changed

+66
-2
lines changed

3 files changed

+66
-2
lines changed

.circleci/config.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: 2.1
2+
3+
orbs:
4+
codecov: codecov/codecov@1
5+
6+
jobs:
7+
build-and-test:
8+
parameters:
9+
go-version:
10+
type: string
11+
docker:
12+
- image: cimg/go:<< parameters.go-version >>
13+
steps:
14+
- checkout
15+
- run: make lint
16+
- run: CGO_ENABLED=1 go test -coverprofile=coverage.txt -v ./...
17+
- codecov/upload:
18+
file: ./coverage.txt
19+
- run: make build package
20+
21+
workflows:
22+
version: 2
23+
build-and-test:
24+
jobs:
25+
- build-and-test:
26+
matrix:
27+
parameters:
28+
go-version: ["1.15"] # we should add tip here too

.golangci.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
run:
2+
deadline: 5m
3+
4+
linters:
5+
disable-all: true
6+
enable:
7+
- dupl
8+
- goconst
9+
#- gocyclo response wrapper for server handler is too complex
10+
- gofmt
11+
- golint
12+
- govet
13+
- ineffassign
14+
#- interfacer
15+
- lll
16+
- misspell
17+
- nakedret
18+
- structcheck
19+
- unparam
20+
- varcheck
21+
22+
linters-settings:
23+
dupl:
24+
threshold: 400
25+
lll:
26+
line-length: 170
27+
gocyclo:
28+
min-complexity: 15
29+
golint:
30+
min-confidence: 0.85

Makefile

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
BIN_NAME=xfiles
2-
31
VERSION ?= dev
42
GIT_HASH ?=$(shell git rev-parse HEAD)
53
IMAGE_NAME := "hypertrace/collector"
64

5+
.PHONY: build
76
build:
87
go build -ldflags "-w -X main.GitHash=${GIT_HASH} -X main.Version=${VERSION}" ./cmd/collector
98

9+
.PHONY: run
1010
run:
1111
go run cmd/collector/main.go --config ./config.yml
1212

13+
.PHONY: package
1314
package:
1415
docker build --build-arg VERSION=${VERSION} --build-arg GIT_COMMIT=$(GIT_COMMIT) -t $(IMAGE_NAME):${VERSION} -t $(IMAGE_NAME):latest .
16+
17+
.PHONY: lint
18+
lint:
19+
@echo "Running linters..."
20+
@golangci-lint run ./... && echo "Done."

0 commit comments

Comments
 (0)