Skip to content
This repository was archived by the owner on Mar 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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

13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading