-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.cirrus.yml
324 lines (309 loc) · 11 KB
/
.cirrus.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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# Attention: if you submit an improvement for a Namecoin Cirrus config, please
# file a GitHub issue about it at the namecoin/meta repo, so that we can make
# sure it propagates to all the other Namecoin repos. Thanks!
task:
name: ShellCheck
container:
image: fedora:latest
cpu: 1
memory: 1G
install_script: dnf install -y ShellCheck
lint_script: bash testdata/shellcheck.bash
task:
name: "Compile Go $GO_VERSION $GOOS $GOARCH$MODULES_NAME"
alias: Compile
container:
image: golang:$GO_VERSION
cpu: 1
memory: 1G
path_script:
- source testdata/move_to_gopath.bash
matrix:
- env:
GOOS: "linux"
GOARCH: "amd64"
- env:
GOOS: "linux"
GOARCH: "386"
CFLAGS: "-m32"
install_script:
- dpkg --add-architecture i386
- apt-get update
- apt-get install -y gcc-multilib libc6-dev:i386
- env:
GOOS: "linux"
GOARCH: "arm"
CC: "arm-linux-gnueabihf-gcc"
install_script:
- dpkg --add-architecture armhf
- apt-get update
- apt-get install -y gcc-arm-linux-gnueabihf libc6-dev:armhf
- env:
GOOS: "linux"
GOARCH: "arm64"
CC: "aarch64-linux-gnu-gcc"
install_script:
- dpkg --add-architecture arm64
- apt-get update
- apt-get install -y gcc-aarch64-linux-gnu libc6-dev:arm64
- env:
GOOS: "linux"
GOARCH: "ppc64le"
CC: "powerpc64le-linux-gnu-gcc"
install_script:
- dpkg --add-architecture ppc64el
- apt-get update
- apt-get install -y gcc-powerpc64le-linux-gnu libc6-dev:ppc64el
- env:
GOOS: "windows"
GOARCH: "amd64"
CC: "x86_64-w64-mingw32-gcc-win32"
install_script:
- apt-get update
- apt-get install -y gcc-mingw-w64-x86-64
- env:
GOOS: "windows"
GOARCH: "386"
CC: "i686-w64-mingw32-gcc-win32"
install_script:
- apt-get update
- apt-get install -y gcc-mingw-w64-i686
matrix:
- env:
GO111MODULE: "off"
MODULES_NAME: " Modules Off"
allow_failures: true
fetch_script:
- cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"
- go get -tags "$GOX_TAGS" -d -v -t github.com/$CIRRUS_REPO_FULL_NAME/...
- go generate github.com/$CIRRUS_REPO_FULL_NAME/...
- go get -tags "$GOX_TAGS" -d -v -t github.com/$CIRRUS_REPO_FULL_NAME/...
- env:
MODULES_NAME: ""
pkcs11mod_script:
- cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"
- cd ../
- git clone https://github.com/namecoin/pkcs11mod.git
- cd pkcs11mod
- git checkout api-fork-1.1.1.5
- go mod init
- go mod tidy
- go generate ./...
- go mod tidy
fetch_script:
- cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"
- go mod init github.com/"$CIRRUS_REPO_FULL_NAME"
- go mod edit -replace github.com/miekg/pkcs11=github.com/namecoin/[email protected] -replace github.com/namecoin/pkcs11mod=../pkcs11mod
- go mod tidy
- go generate ./...
- go mod tidy
build_script:
- SO_PREFIX=lib
- SO_EXT=so
- if [[ "$GOOS" == "windows" ]]
- then
- SO_PREFIX=""
- SO_EXT=dll
- fi
- cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"
- mkdir -p dist
- CGO_ENABLED=1 go build -buildmode c-shared -o dist/${SO_PREFIX}ncp11.$SO_EXT
dist_script:
- SO_PREFIX=lib
- SO_EXT=so
- if [[ "$GOOS" == "windows" ]]
- then
- SO_PREFIX=""
- SO_EXT=dll
- fi
- mv $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"/dist/*.$SO_EXT ./
- mkdir -p ./dist
- tar -caf ./dist/ncp11.tar.gz ./*.$SO_EXT
binaries_artifacts:
path: "dist/*"
env:
GO_VERSION: latest
task:
name: "Compile Go $GO_VERSION $GOOS $GOARCH$MODULES_NAME"
alias: Compile
macos_instance:
image: big-sur-xcode-12.3
brew_script:
- brew update
bash_script:
# macOS default bash is missing globstar support.
- brew install bash
go_script:
- brew install go
path_script:
- source testdata/move_to_gopath.bash
env:
GOOS: "darwin"
GOARCH: "amd64"
matrix:
- env:
GO111MODULE: "off"
MODULES_NAME: " Modules Off"
allow_failures: true
fetch_script:
- cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"
- go get -tags "$GOX_TAGS" -d -v -t github.com/$CIRRUS_REPO_FULL_NAME/...
- go generate github.com/$CIRRUS_REPO_FULL_NAME/...
- go get -tags "$GOX_TAGS" -d -v -t github.com/$CIRRUS_REPO_FULL_NAME/...
- env:
MODULES_NAME: ""
pkcs11mod_script:
- cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"
- cd ../
- git clone https://github.com/namecoin/pkcs11mod.git
- cd pkcs11mod
- git checkout api-fork-1.1.1.5
- go mod init
- go mod tidy
- go generate ./...
- go mod tidy
fetch_script:
- cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"
- go mod init github.com/"$CIRRUS_REPO_FULL_NAME"
- go mod edit -replace github.com/miekg/pkcs11=github.com/namecoin/[email protected] -replace github.com/namecoin/pkcs11mod=../pkcs11mod
- go mod tidy
- go generate ./...
- go mod tidy
build_script:
- SO_PREFIX=lib
- SO_EXT=dylib
- cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"
- mkdir -p dist
- CGO_ENABLED=1 go build -buildmode c-shared -o dist/${SO_PREFIX}ncp11.$SO_EXT
dist_script:
- SO_PREFIX=lib
- SO_EXT=dylib
- mv $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"/dist/*.$SO_EXT ./
- mkdir -p ./dist
- tar -caf ./dist/ncp11.tar.gz ./*.$SO_EXT
binaries_artifacts:
path: "dist/*"
env:
GO_VERSION: latest
task:
alias: Go Lint
container:
image: golangci/golangci-lint:latest
path_script:
- source testdata/move_to_gopath.bash
pkcs11mod_script:
- cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"
- cd ../
- git clone https://github.com/namecoin/pkcs11mod.git
- cd pkcs11mod
- git checkout api-fork-1.1.1.5
- go mod init
- go mod tidy
- go generate ./...
- go mod tidy
fetch_script:
- cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"
- go mod init github.com/"$CIRRUS_REPO_FULL_NAME"
- go mod edit -replace github.com/miekg/pkcs11=github.com/namecoin/[email protected] -replace github.com/namecoin/pkcs11mod=../pkcs11mod
- go mod tidy
- go generate ./...
- go mod tidy
# gomoddirectives is temporarily disabled until miekg/pkcs11 merges our changes.
# interfacebloat complains about miekg/pkcs11 API's that we can't change.
# ireturn doesn't make sense for us, since our functions can return arbitrary types provided by the user, so we need to return interfaces.
# nosnakecase complains about miekg/pkcs11 API's that we can't change.
lint_script:
- cd $(go env GOPATH)/src/github.com/$CIRRUS_REPO_FULL_NAME/
- golangci-lint run --enable-all --disable exhaustivestruct,exhaustruct,gochecknoglobals,gochecknoinits,gomoddirectives,interfacebloat,ireturn,nosnakecase $GOLANGCI_ARGS -v --out-format json > $CIRRUS_WORKING_DIR/lint-report.json
matrix:
- name: Go Lint New
env:
GOLANGCI_ARGS: "--new-from-rev=HEAD~"
- name: Go Lint Mandatory
env:
GOLANGCI_ARGS: "--disable=cyclop,deadcode,dupl,funlen,gci,godot,godox,goerr113,gofmt,gofumpt,goimports,gomnd,gosimple,govet,ifshort,lll,nlreturn,noctx,nosnakecase,revive,unparam,unused,varcheck,varnamelen,wrapcheck,wsl --skip-dirs=ckbiproxy"
- name: Go Lint
env:
GOLANGCI_ARGS: ""
allow_failures: true
always:
golangci_artifacts:
path: lint-report.json
type: text/json
format: golangci
task:
name: "Functional Tests $CI_DISTRO Go $GO_VERSION"
alias: "Functional Tests"
matrix:
- compute_engine_instance:
image_project: debian-cloud
image: family/debian-11
platform: linux
cpu: 1
memory: 1G
env:
CI_DISTRO: debian
bitcoind_cache:
folder: /tmp/bitcoind
populate_script: mkdir -p /tmp/bitcoind
install_script:
- apt-get update
# bind9-dnsutils contains dig
- apt-get install -y dnssec-trigger bind9-dnsutils firefox-esr
# Namecoin Core
- BITCOIND_URL=$(curl https://www.namecoin.org/download/ | grep x86_64-linux-gnu.tar.gz | grep -v 0.13.99 | grep --only-matching https://.*.tar.gz)
- BITCOIND_FILENAME=$(echo $BITCOIND_URL | grep -E --only-matching 'namecoin-nc.*.tar.gz')
- BITCOIND_PATH=/tmp/bitcoind/$BITCOIND_FILENAME
- tar -xaf $BITCOIND_PATH || (rm -f /tmp/bitcoind/* && curl --output $BITCOIND_PATH $BITCOIND_URL && tar -xaf $BITCOIND_PATH)
- cp -a namecoin-*/* /usr/
# ncdns
- NCDNS_URL=https://api.cirrus-ci.com/v1/artifact/github/namecoin/ncdns/Cross-Compile%20Go%20latest/binaries/dist/ncdns--linux_amd64.tar.gz
- curl -o ncdns.tar.gz $NCDNS_URL
- tar -xaf ncdns.tar.gz
- cp -a ncdns--*/* /usr/
# Encaya
- ENCAYA_URL=https://api.cirrus-ci.com/v1/artifact/github/namecoin/encaya/Cross-Compile%20Go%20latest/binaries/dist/encaya--linux_amd64.tar.gz
- curl -o encaya.tar.gz $ENCAYA_URL
- tar -xaf encaya.tar.gz
- cp -a encaya--*/* /usr/
# ncp11
- NCP11_URL=https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Compile%20Go%20$GO_VERSION%20linux%20amd64/binaries/dist/ncp11.tar.gz
- curl -o ncp11.tar.gz $NCP11_URL
- tar -xaf ncp11.tar.gz
# Configure DNSSEC-Trigger
- cp ncdns--*/doc/unbound.conf.d/ncdns.conf ncdns--*/doc/unbound.conf.d/ncdns-insecure.conf /etc/unbound/unbound.conf.d
- systemctl restart unbound
bitcoind_service_background_script:
- testdata/run_bitcoind.sh
ncdns_service_background_script:
# ncdns refuses to run as root
- adduser ncdns --disabled-password
- ncdns -conf testdata/ncdns.conf
encaya_service_background_script:
# Avoid race condition in "adduser" between ncdns and encaya
- sleep 5s
# encaya refuses to run as root
- adduser encaya --disabled-password
- encayagen -conf "$(pwd)/testdata/encaya.conf"
- chown encaya:encaya testdata/*.pem
# Curiously, relative paths don't work here, they cause the .pem files to
# not be detected. Maybe file a bug with Hugo?
- encaya -conf "$(pwd)/testdata/encaya.conf"
regtest_script:
- sleep 15s
- testdata/regtest.sh
depends_on:
- "Compile Go $GO_VERSION linux amd64"
env:
GO_VERSION: latest
MODULES_NAME: ""
# TODO: Add Windows unit tests
# TODO: "Testing config parsing" from travis.bash
# TODO: Add multiple Go versions to Gox builds and unit tests
# TODO: Add debug stripping and path stripping to Gox for repro builds
# TODO: Re-add darwin/386 for old Go versions where it was supported
# TODO: Fix upload repo for tagged commits (don't use Nightly repo for this)
# TODO: Skip Signify and Release if it's not applicable
# TODO: Signify Nightlies
# TODO: IRC notifications on failure
# TODO: Cron