forked from adrianceding/binance-proxy
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added ci worflow, bump go in releaser to 1.17
- Loading branch information
1 parent
536a61b
commit def72ab
Showing
4 changed files
with
143 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "**" | ||
push: | ||
branches: | ||
- "**" | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Lint | ||
run: make lint | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build | ||
run: make build | ||
|
||
- name: Bin | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: binance-proxy | ||
path: ./bin/binance-proxy | ||
|
||
### Tests not yet integrated ... | ||
# test: | ||
# name: Test | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Set up Go | ||
# uses: actions/setup-go@v2 | ||
# with: | ||
# go-version: 1.17 | ||
|
||
# - name: Check out code | ||
# uses: actions/checkout@v2 | ||
|
||
# - name: Test | ||
# run: make cover | ||
|
||
# - name: Cover | ||
# uses: actions/upload-artifact@v2 | ||
# with: | ||
# name: cover | ||
# path: ./cover.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
PROJECT := binance-proxy | ||
VERSION := $(git describe --abbrev=0 --tags) | ||
LD_FLAGS := -X main.version=$(VERSION) -s -w | ||
SOURCE_FILES ?= ./internal/... ./pkg/... ./cmd/... | ||
UNAME := $(uname -s) | ||
|
||
export CGO_ENABLED=0 | ||
export GO111MODULE=on | ||
|
||
.PHONY: all | ||
all: help | ||
|
||
.PHONY: help | ||
help: ### Show targets documentation | ||
ifeq ($(UNAME), Linux) | ||
@grep -P '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \ | ||
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | ||
else | ||
@awk -F ':.*###' '$$0 ~ FS {printf "%15s%s\n", $$1 ":", $$2}' \ | ||
$(MAKEFILE_LIST) | grep -v '@awk' | sort | ||
endif | ||
|
||
.PHONY: clean | ||
clean: ### Clean build files | ||
@rm -rf ./bin | ||
@go clean | ||
|
||
.PHONY: build | ||
build: clean ### Build binary | ||
@go build -tags netgo -a -v -ldflags "${LD_FLAGS}" -o ./bin/binance-proxy ./cmd/binance-proxy/*.go | ||
@chmod +x ./bin/* | ||
|
||
.PHONY: run | ||
run: ### Quick run | ||
@CGO_ENABLED=1 go run -race cmd/binance-proxy/*.go | ||
|
||
.PHONY: deps | ||
deps: ### Optimize dependencies | ||
@go mod tidy | ||
|
||
.PHONY: vendor | ||
vendor: ### Vendor dependencies | ||
@go mod vendor | ||
|
||
.PHONY: install | ||
install: ### Install binary in your system | ||
@go install -v cmd/binance-proxy/*.go | ||
|
||
.PHONY: fmt | ||
fmt: ### Format | ||
@gofmt -s -w . | ||
|
||
.PHONY: vet | ||
vet: ### Vet | ||
@go vet ./... | ||
|
||
### Lint | ||
.PHONY: lint | ||
lint: fmt vet | ||
|
||
### Clean test | ||
.PHONY: test-clean | ||
test-clean: ### Clean test cache | ||
@go clean -testcache ./... | ||
|
||
.PHONY: test | ||
test: lint ### Run tests | ||
@go test -v -coverprofile=cover.out -timeout 10s ./... | ||
|
||
.PHONY: cover | ||
cover: test ### Run tests and generate coverage | ||
@go tool cover -html=cover.out -o=cover.html |