Skip to content

Commit def72ab

Browse files
committed
added ci worflow, bump go in releaser to 1.17
1 parent 536a61b commit def72ab

File tree

4 files changed

+143
-2
lines changed

4 files changed

+143
-2
lines changed

.github/workflows/ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "**"
7+
push:
8+
branches:
9+
- "**"
10+
11+
jobs:
12+
lint:
13+
name: Lint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Set up Go
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: 1.17
20+
21+
- name: Check out code
22+
uses: actions/checkout@v2
23+
24+
- name: Lint
25+
run: make lint
26+
27+
build:
28+
name: Build
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Set up Go
32+
uses: actions/setup-go@v2
33+
with:
34+
go-version: 1.17
35+
36+
- name: Check out code
37+
uses: actions/checkout@v2
38+
39+
- name: Build
40+
run: make build
41+
42+
- name: Bin
43+
uses: actions/upload-artifact@v2
44+
with:
45+
name: binance-proxy
46+
path: ./bin/binance-proxy
47+
48+
### Tests not yet integrated ...
49+
# test:
50+
# name: Test
51+
# runs-on: ubuntu-latest
52+
# steps:
53+
# - name: Set up Go
54+
# uses: actions/setup-go@v2
55+
# with:
56+
# go-version: 1.17
57+
58+
# - name: Check out code
59+
# uses: actions/checkout@v2
60+
61+
# - name: Test
62+
# run: make cover
63+
64+
# - name: Cover
65+
# uses: actions/upload-artifact@v2
66+
# with:
67+
# name: cover
68+
# path: ./cover.html

.github/workflows/goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Set up Go
3232
uses: actions/setup-go@v2
3333
with:
34-
go-version: 1.16
34+
go-version: 1.17
3535

3636
- name: Run GoReleaser
3737
uses: goreleaser/goreleaser-action@v2

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010

1111
# Output of the go coverage tool, specifically when used with LiteIDE
1212
*.out
13-
13+
cover.*
1414
# Dependency directories (remove the comment below to include it)
1515
vendor/
1616
dist/
17+
bin/
1718

1819
# IDE's
1920
/.idea/*

Makefile

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
PROJECT := binance-proxy
2+
VERSION := $(git describe --abbrev=0 --tags)
3+
LD_FLAGS := -X main.version=$(VERSION) -s -w
4+
SOURCE_FILES ?= ./internal/... ./pkg/... ./cmd/...
5+
UNAME := $(uname -s)
6+
7+
export CGO_ENABLED=0
8+
export GO111MODULE=on
9+
10+
.PHONY: all
11+
all: help
12+
13+
.PHONY: help
14+
help: ### Show targets documentation
15+
ifeq ($(UNAME), Linux)
16+
@grep -P '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
17+
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
18+
else
19+
@awk -F ':.*###' '$$0 ~ FS {printf "%15s%s\n", $$1 ":", $$2}' \
20+
$(MAKEFILE_LIST) | grep -v '@awk' | sort
21+
endif
22+
23+
.PHONY: clean
24+
clean: ### Clean build files
25+
@rm -rf ./bin
26+
@go clean
27+
28+
.PHONY: build
29+
build: clean ### Build binary
30+
@go build -tags netgo -a -v -ldflags "${LD_FLAGS}" -o ./bin/binance-proxy ./cmd/binance-proxy/*.go
31+
@chmod +x ./bin/*
32+
33+
.PHONY: run
34+
run: ### Quick run
35+
@CGO_ENABLED=1 go run -race cmd/binance-proxy/*.go
36+
37+
.PHONY: deps
38+
deps: ### Optimize dependencies
39+
@go mod tidy
40+
41+
.PHONY: vendor
42+
vendor: ### Vendor dependencies
43+
@go mod vendor
44+
45+
.PHONY: install
46+
install: ### Install binary in your system
47+
@go install -v cmd/binance-proxy/*.go
48+
49+
.PHONY: fmt
50+
fmt: ### Format
51+
@gofmt -s -w .
52+
53+
.PHONY: vet
54+
vet: ### Vet
55+
@go vet ./...
56+
57+
### Lint
58+
.PHONY: lint
59+
lint: fmt vet
60+
61+
### Clean test
62+
.PHONY: test-clean
63+
test-clean: ### Clean test cache
64+
@go clean -testcache ./...
65+
66+
.PHONY: test
67+
test: lint ### Run tests
68+
@go test -v -coverprofile=cover.out -timeout 10s ./...
69+
70+
.PHONY: cover
71+
cover: test ### Run tests and generate coverage
72+
@go tool cover -html=cover.out -o=cover.html

0 commit comments

Comments
 (0)