mirror of
https://github.com/on4kjm/FLEcli.git
synced 2025-01-18 13:01:09 +01:00
Enable makefile
This commit is contained in:
commit
dd96badddb
6 changed files with 45 additions and 15 deletions
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
|
@ -24,8 +24,10 @@ jobs:
|
|||
|
||||
- name: Lint Go Code
|
||||
run: |
|
||||
go get -u golang.org/x/lint/golint
|
||||
golint -set_exit_status ./...
|
||||
make lint
|
||||
- name: Vet Go Code
|
||||
run: |
|
||||
make vet
|
||||
|
||||
test:
|
||||
name: Test
|
||||
|
@ -41,8 +43,7 @@ jobs:
|
|||
|
||||
- name: Run Unit tests.
|
||||
run: |
|
||||
go test -short -coverprofile cover.out -covermode=atomic ./...
|
||||
cat cover.out >> coverage.txt
|
||||
make test-coverage
|
||||
|
||||
- name: Upload Coverage report to CodeCov
|
||||
uses: codecov/codecov-action@v1.0.0
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,6 +14,7 @@ notes/help.txt
|
|||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
coverage.txt
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
|
|
39
Makefile
Normal file
39
Makefile
Normal file
|
@ -0,0 +1,39 @@
|
|||
# PROJECT_NAME := "github-actions-demo-go"
|
||||
# PKG := "github.com/brpaz/$(PROJECT_NAME)"
|
||||
# PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
|
||||
# GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
|
||||
|
||||
## GITHUB_ACTIONS is set when running as a Github Action
|
||||
|
||||
.PHONY: all lint vet test test-coverage build clean
|
||||
|
||||
all: build
|
||||
|
||||
dep: ## Get the dependencies
|
||||
@go mod download
|
||||
|
||||
lint: ## Lint Golang files
|
||||
@go get -u golang.org/x/lint/golint
|
||||
@golint -set_exit_status ./...
|
||||
|
||||
vet: ## Run go vet
|
||||
@go vet ./...
|
||||
|
||||
test: ## Run unit tests
|
||||
@go test ./...
|
||||
|
||||
test-coverage: ## Run tests with coverage
|
||||
@go test -short -coverprofile cover.out -covermode=atomic ./...
|
||||
@cat cover.out >> coverage.txt
|
||||
|
||||
build: ## Build the binary file
|
||||
@goreleaser --snapshot --skip-publish --rm-dist
|
||||
@cp dist/FLEcli_darwin_amd64/FLEcli .
|
||||
|
||||
clean: ## Remove previous build
|
||||
@rm -f ./FLEcli
|
||||
@rm -f ./cover.out
|
||||
@rm -f ./coverage.txt
|
||||
|
||||
help: ## Display this help screen
|
||||
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
11
build.sh
11
build.sh
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
go test ./...
|
||||
|
||||
commitRef=$(git rev-parse HEAD)
|
||||
tag=$(git describe --tags)
|
||||
version="${tag}_(PrivateBuild)"
|
||||
buildDate=$(date -u +"%FT%TZ")
|
||||
go build -ldflags="-s -w -X=FLEcli/flecmd.version=${version} -X=FLEcli/flecmd.commit=${commitRef} -X=FLEcli/flecmd.date=${buildDate} -X=FLEcli/flecmd.builtBy=${USER}"
|
Loading…
Reference in a new issue