forked from emirpasic/gods
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
75 lines (73 loc) · 2.26 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
version: 2.1
jobs:
test:
parameters:
version:
type: string
default: "1.21"
docker:
- image: cimg/go:<<parameters.version>>
environment:
TEST_RESULTS: /tmp/test-results
working_directory: ~/gods
steps:
- run:
name: Print Go version (go version)
command: |
go version
- checkout
- run:
name: Run tests
command: |
mkdir -p $TEST_RESULTS
go install gotest.tools/gotestsum@latest
go test -v ./... | go tool test2json > $TEST_RESULTS/test2json-output.json
gotestsum --junitfile $TEST_RESULTS/gotestsum-report.xml
- run:
name: Calculate test coverage
command: |
mkdir -p $TEST_RESULTS
go test -coverprofile=coverage.out ./... > /dev/null
go test -race -coverprofile=coverage.txt -covermode=atomic ./... > /dev/null
go tool cover -html=coverage.out -o coverage.html
mv coverage.html $TEST_RESULTS
- run:
name: Upload test coverage
command: |
bash <(curl -s https://codecov.io/bash)
- run:
name: Lint (golint)
command: |
go install golang.org/x/lint/golint@latest
golint -set_exit_status ./...
- run:
name: Enforce formatted code (go fmt)
command: |
! go fmt ./... 2>&1 | read
- run:
name: Examine and report suspicious constructs (go vet)
command: |
go vet -v ./...
- run:
name: Calculate cyclomatic complexity (gocyclo)
command: |
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
gocyclo -avg -over 15 ../gods
- run:
name: Check for unchecked errors (errcheck)
command: |
go install github.com/kisielk/errcheck@latest
errcheck ./...
- store_artifacts:
path: /tmp/test-results
destination: raw-test-output
- store_test_results:
path: /tmp/test-results
workflows:
test:
jobs:
- test:
matrix:
parameters:
# To test with and without generics (versions prior to 1.18)
version: [ "1.21" ]