Skip to content
This repository was archived by the owner on Mar 22, 2025. It is now read-only.

Commit 0980bae

Browse files
authored
Merge pull request #43 from lmas/workflow
Workflow
2 parents d3017b6 + 9f0bbb8 commit 0980bae

File tree

2 files changed

+48
-5
lines changed

2 files changed

+48
-5
lines changed

.github/workflows/main.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Tests and Linters
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
Linters:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 10
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
ref: master
16+
- name: Setup go
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version: 1.23
20+
- name: Install dependencies
21+
run: make deps
22+
- name: Run linters
23+
run: make lint
24+
25+
Tests:
26+
runs-on: ubuntu-latest
27+
timeout-minutes: 10
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
ref: master
32+
- name: Setup go
33+
uses: actions/setup-go@v5
34+
with:
35+
go-version: 1.23
36+
- name: Run tests
37+
run: make test
38+
- name: Report stats
39+
run: make analyse
40+

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@ test:
77
bench:
88
go test -cover -test.benchmem -bench=.
99

10-
# Generate pretty coverage report
11-
analyse:
12-
go tool cover -html=".cover.out" -o="cover.html"
13-
gocyclo -avg -top 10 .
14-
1510
# Runs source code linters and catches common errors
1611
lint:
1712
test -z $$(gofmt -l .) || (echo "Code isn't gofmt'ed!" && exit 1)
1813
go vet $$(go list ./... | grep -v /tmp)
1914
gosec -quiet -fmt=golint -exclude-dir="tmp" ./...
2015

16+
# Generate pretty coverage report
17+
analyse:
18+
go tool cover -html=".cover.out" -o="cover.html"
19+
@echo -e "\nCOVERAGE\n===================="
20+
go tool cover -func=.cover.out
21+
@echo -e "\nCYCLOMATIC COMPLEXITY\n===================="
22+
gocyclo -avg -top 10 .
23+
2124
# Updates 3rd party packages and tools
2225
deps:
2326
go get -u $$(go list ./... | grep -v /tmp)

0 commit comments

Comments
 (0)