forked from u-root/u-root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
213 lines (207 loc) · 6.65 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
version: 2
templates:
golang-template: &golang-template
docker:
- image: uroottest/test-image-amd64:v3.2.13
working_directory: /go/src/github.com/u-root/u-root
environment:
- CGO_ENABLED: 0
# Triple all timeouts for QEMU VM tests since they run without KVM.
- UROOT_QEMU_TIMEOUT_X: 3
- GO111MODULE: "off"
integration-template: &integration-template
working_directory: /go/src/github.com/u-root/u-root
environment:
- CGO_ENABLED: 0
# Triple all timeouts for QEMU VM tests since they run without KVM.
- UROOT_QEMU_TIMEOUT_X: 3
- GO111MODULE: "off"
steps:
- checkout
- run:
name: Test integration
command: go test -a -v -timeout 15m -ldflags '-s' ./integration/...
no_output_timeout: 15m
beefy-template: &beefy-template
<<: *golang-template
resource_class: large
workflows:
version: 2
build_and_test:
jobs:
- clean-code
- test:
requires:
- clean-code
- test-build:
requires:
- clean-code
- test-integration-amd64:
requires:
- clean-code
- test-integration-arm:
requires:
- clean-code
- test-integration-arm64:
requires:
- clean-code
- race:
requires:
- clean-code
- compile_cmds:
requires:
- clean-code
- check_templates:
requires:
- clean-code
- check_licenses:
requires:
- clean-code
jobs:
clean-code:
<<: *golang-template
steps:
- checkout
- run:
name: Install golangci-lint
command: |
cd ..
go get golang.org/x/lint/golint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.30.0
- run:
name: Install ineffassign
command: (cd .. && go get github.com/gordonklaus/ineffassign)
- run:
name: Check vendored dependencies
environment:
- GO111MODULE: "auto"
command: |
go mod tidy
go mod verify
go mod vendor -v
git status
if [[ -n "$(git status --porcelain vendor)" ]]; then
echo 'vendor/ is out-of-date: run `go mod tidy && go mod vendor` and then check in the changes'
echo 'If `go mod tidy && go mod vendor` results in no changes, make sure you are using the latest relase of Go'
git status --porcelain vendor
exit 1
fi
- run:
name: vet
command: |
go vet -composites=false ./cmds/... ./pkg/... ./
- run:
name: gofmt
command: |
test -z "$(gofmt -s -l $(find -name '*.go' | grep -v /vendor/))"
- run:
name: golangci-lint
command: |
golangci-lint run ./... --disable-all --enable=golint \
--skip-dirs=pkg/uroot/test \
--skip-dirs=cmds/core/elvish \
--exclude="exported (function|type|const|method|var) (\w|_|\.)+ should have comment" \
--exclude="don't use underscores" \
--exclude="don't use ALL_CAPS" \
--exclude="comment on exported (function|type|const|method|var) (\w|_|\.)+ should be of the form" \
--exclude="package comment should be of the form" \
--exclude="(function|type|const|method|var|type field|struct field) (\w|_|\.)+ should be (\w|_|\.)+" \
--exclude="stutter" \
--exclude="which can be annoying to use"
- run:
name: ineffassign
command: ineffassign .
test:
<<: *golang-template
steps:
- checkout
- run:
name: Test all
command: go test -a -timeout 15m -ldflags '-s' ./cmds/... ./pkg/...
no_output_timeout: 15m
- run:
name: Test coverage
command: go test -coverprofile=coverage.txt -covermode=atomic -cover ./cmds/... ./pkg/...
- run:
name: Upload coverage
command: bash <(curl -s https://codecov.io/bash)
test-build:
<<: *beefy-template
steps:
- checkout
- run:
name: Test u-root build
command: go test -a -timeout 15m .
no_output_timeout: 15m
race:
<<: *golang-template
environment:
- CGO_ENABLED: 1
- GO111MODULE: "off"
steps:
- checkout
- run:
name: Race detector
command: go test -race ./cmds/... ./pkg/...
compile_cmds:
<<: *golang-template
steps:
- checkout
- run:
name: build all tools
command: |
cd cmds
go install -a ./...
cd ../tools
go install -a ./...
check_licenses:
<<: *golang-template
steps:
- checkout
- run:
name: Check licenses
command: go run tools/checklicenses/checklicenses.go -c tools/checklicenses/config.json
check_symlinks:
<<: *golang-template
steps:
- checkout
- run:
name: Symbol tests to ensure we do not break symlink handling
command: mkdir /tmp/usr && ln -s /tmp/usr/x /tmp/usr/y && go run u-root.go -build=bb -files /tmp/usr minimal
check_templates:
<<: *golang-template
steps:
- checkout
- run:
name: Ensure that every template builds for a variety of options.
command: |
go build .
goruncmd="./u-root -stats-output-path=/tmp/stats.json"
$goruncmd -build=bb minimal
$goruncmd -build=bb core
$goruncmd -build=bb coreboot-app
$goruncmd -build=bb all
$goruncmd -build=bb world
# Fails because of dups. Is this supposed to work?
#$goruncmd -build=bb all core
#$goruncmd all core
go run u-root.go templates.go -fourbins minimal
GOOS=plan9 $goruncmd -defaultsh=/bbin/rush plan9
cat /tmp/stats.json
- store_artifacts:
name: Store build stats
path: /tmp/stats.json
destination: stats.json
test-integration-amd64:
<<: *integration-template
docker:
- image: uroottest/test-image-amd64:v3.2.12
test-integration-arm:
<<: *integration-template
docker:
- image: uroottest/test-image-arm:v3.0.4
test-integration-arm64:
<<: *integration-template
docker:
- image: uroottest/test-image-arm64:v0.0.2
working_directory: /home/circleci/go/src/github.com/u-root/u-root