From 186016bf8d5a907c27aa69e97924490625d69e22 Mon Sep 17 00:00:00 2001 From: jmnote Date: Fri, 29 Dec 2023 08:50:26 +0000 Subject: [PATCH] workflow --- .github/workflows/pull-request.yml | 3 ++- .gitignore | 1 + Makefile | 8 ++++++++ hack/gocyclo.sh | 11 +++++++++++ hack/misspell.sh | 11 +++++++++++ 5 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 hack/gocyclo.sh create mode 100644 hack/misspell.sh diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 42b4a43..2f1e451 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -41,6 +41,8 @@ jobs: steps: - uses: actions/setup-go@v4 - uses: actions/checkout@v3 + with: + go-version: '^1.21.5' - run: go vet ./... staticcheck: @@ -73,7 +75,6 @@ jobs: - uses: actions/setup-go@v4 - uses: actions/checkout@v3 - run: go test ./... -race -covermode=atomic -coverprofile=coverprofile - - run: cat coverprofile | grep -v yaccpar > coverage.out - uses: codecov/codecov-action@v3 - run: go install github.com/mattn/goveralls@latest - run: goveralls -coverprofile=coverage.out -service=github diff --git a/.gitignore b/.gitignore index 2e1a01d..321cfc9 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ go.work # custom +bin/ tmp/ diff --git a/Makefile b/Makefile index a532aed..73a678a 100644 --- a/Makefile +++ b/Makefile @@ -3,3 +3,11 @@ init: run: air + +checks: misspell gocyclo + +misspell: + sh hack/misspell.sh + +gocyclo: + sh hack/gocyclo.sh diff --git a/hack/gocyclo.sh b/hack/gocyclo.sh new file mode 100644 index 0000000..64fb191 --- /dev/null +++ b/hack/gocyclo.sh @@ -0,0 +1,11 @@ +#!/bin/bash +cd $(dirname $0)/../ + +which gocyclo || go install github.com/fzipp/gocyclo/cmd/gocyclo@latest + +gocyclo -over 15 -ignore letheql/parser . +if [[ $? != 0 ]]; then + echo "❌ FAIL" + exit 1 +fi +echo "✔️ OK" diff --git a/hack/misspell.sh b/hack/misspell.sh new file mode 100644 index 0000000..a506f4f --- /dev/null +++ b/hack/misspell.sh @@ -0,0 +1,11 @@ +#!/bin/bash +cd $(dirname $0)/.. + +[ -f ./bin/misspell ] || curl -L https://git.io/misspell | bash + +find . -type f -name '*.*' | xargs ./bin/misspell -error +if [[ $? != 0 ]]; then + echo "❌ FAIL - misspell found" + exit 1 +fi +echo "✔️ OK - misspell not found"