From ea06901e9a22774ea0045acc9f54b4b4fbf6d397 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 20 Jan 2025 11:13:21 +0100 Subject: [PATCH 1/2] Updates makefile --- Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ca5c724..a59d963 100644 --- a/Makefile +++ b/Makefile @@ -7,17 +7,20 @@ test: bench: go test -cover -test.benchmem -bench=. -# Generate pretty coverage report -analyse: - go tool cover -html=".cover.out" -o="cover.html" - gocyclo -avg -top 10 . - # Runs source code linters and catches common errors lint: test -z $$(gofmt -l .) || (echo "Code isn't gofmt'ed!" && exit 1) go vet $$(go list ./... | grep -v /tmp) gosec -quiet -fmt=golint -exclude-dir="tmp" ./... +# Generate pretty coverage report +analyse: + go tool cover -html=".cover.out" -o="cover.html" + @echo -e "\nCOVERAGE\n====================" + go tool cover -func=.cover.out + @echo -e "\nCYCLOMATIC COMPLEXITY\n====================" + gocyclo -avg -top 10 . + # Updates 3rd party packages and tools deps: go get -u $$(go list ./... | grep -v /tmp) From 9f0bbb85b85a2514244d848299da69c13cfd1d1c Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 21 Jan 2025 16:30:41 +0100 Subject: [PATCH 2/2] Creates initial workflow --- .github/workflows/main.yml | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..21448e2 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,40 @@ +name: Tests and Linters + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + Linters: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + with: + ref: master + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version: 1.23 + - name: Install dependencies + run: make deps + - name: Run linters + run: make lint + + Tests: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + with: + ref: master + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version: 1.23 + - name: Run tests + run: make test + - name: Report stats + run: make analyse +