Skip to content

Commit

Permalink
chore: add check-go workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fioncat committed Jul 13, 2023
1 parent 25576a3 commit 3379ebf
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/build-go.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Go binary
name: Build Go Binary

on:
push:
Expand All @@ -18,13 +18,7 @@ jobs:
- name: Set up go
uses: actions/setup-go@v3
with:
go-version: 1.20.4

- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest

- name: Check go format
run: bash scripts/check-fmt.sh
go-version: 1.20.5

- name: Build
run: go build ./...
33 changes: 33 additions & 0 deletions .github/workflows/check-go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Check Go Code

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up go
uses: actions/setup-go@v3
with:
go-version: 1.20.5

- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest

- name: Check go format
run: bash scripts/check-fmt.sh

- name: Install check tools
run: make install-check

- name: Check go code
run: make check
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: release
name: Create a Release

on:
push:
Expand Down
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ check-fmt:

.PHONY: install-check
install-check:
@go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
@go install github.com/client9/misspell/cmd/misspell@latest
@go install github.com/gordonklaus/ineffassign@latest
@go install golang.org/x/tools/cmd/goimports@latest
Expand All @@ -83,8 +82,6 @@ check:
@ineffassign ./...
@echo "==> check spell"
@find . -type f -name '*.go' | xargs misspell -error
@echo "==> check gocyclo"
@gocyclo -over 70 .
@echo "==> go vet"
@go vet ./...

Expand Down

0 comments on commit 3379ebf

Please sign in to comment.