Skip to content

Commit

Permalink
added ci worflow, bump go in releaser to 1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
nightshift2k committed Oct 14, 2021
1 parent 536a61b commit def72ab
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 2 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/ci.yml
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
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

cover.*
# Dependency directories (remove the comment below to include it)
vendor/
dist/
bin/

# IDE's
/.idea/*
Expand Down
72 changes: 72 additions & 0 deletions Makefile
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

0 comments on commit def72ab

Please sign in to comment.