-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ashing <[email protected]>
- Loading branch information
Showing
14 changed files
with
420 additions
and
97 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,51 @@ | ||
name: Lint Check | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- release/** | ||
pull_request: | ||
branches: | ||
- main | ||
- release/** | ||
permissions: read-all | ||
jobs: | ||
gofmt: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Go Environment | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.20.3' | ||
- name: Run gofmt Check | ||
working-directory: ./ | ||
run: | | ||
diffs=`gofmt -l .` | ||
if [[ -n $diffs ]]; then | ||
echo "Files are not formatted by gofmt:" | ||
echo $diffs | ||
exit 1 | ||
fi | ||
golint: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Go Environment | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.20.3' | ||
- name: Install jq | ||
run: sudo apt install -y jq | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' | ||
- name: Download golangci-lint | ||
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2 | ||
- name: Run Golang Linters | ||
working-directory: ./ | ||
run: | | ||
PATH=${PATH}:$(go env GOPATH)/bin make lint |
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,16 @@ | ||
export GO111MODULE=on | ||
export GOPROXY=https://goproxy.io | ||
|
||
default: help | ||
help: ## Display this help | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) | ||
.PHONY: help | ||
|
||
lint: ## Apply go lint check | ||
@golangci-lint run --timeout 10m ./... | ||
.PHONY: lint | ||
|
||
build: ## Build CLI for this project | ||
@go mod tidy | ||
@go build -o cli/showstart cli/main.go | ||
.PHONY: build |
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 |
---|---|---|
@@ -1,9 +1,2 @@ | ||
# 构建脚本 | ||
|
||
export GO111MODULE=on | ||
export GOPROXY=https://goproxy.io | ||
|
||
.PHONY: build | ||
build: | ||
go mod tidy | ||
go build -o showstart |
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
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
Oops, something went wrong.