-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·74 lines (55 loc) · 1.12 KB
/
test.sh
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
#!/bin/bash
cd packer-post-processor-buildkite
# Cleanup
rm -f *_test_out*.tfvars
rm -f crash.log
rm -f packer-post-processor-buildkite
# Install deps
go get
# Testing
go test ./...
if [[ $? != 0 ]]; then
exit 1
fi
# Linting
go vet ./...
if [[ $? != 0 ]]; then
exit 1
fi
golint ./...
if [[ $? != 0 ]]; then
exit 1
fi
gocyclo -over 15 .
if [[ $? != 0 ]]; then
exit 1
fi
# Formatting
gofmt -s -d -l *.go
if [[ $? != 0 ]]; then
exit 1
fi
# Build
go build
if [[ $? != 0 ]]; then
exit 1
fi
# Build for Ubuntu servers
GOARCH=amd64 GOOS=linux go build -o packer-buildkite-linux-amd64/packer-post-processor-buildkite
if [[ $? != 0 ]]; then
exit 1
fi
# Zip up for a release
cd packer-buildkite-linux-amd64
zip ../packer-buildkite-linux-amd64.zip packer-post-processor-buildkite
cd ..
# Run with Buildkite turned off
$GOPATH/bin/packer build -var-file=../multi-test-variables.json ../multi-test.json
if [[ $? != 0 ]]; then
exit 1
fi
# Run with Buildkite turned on
BUILDKITE="true" $GOPATH/bin/packer build -var-file=../multi-test-variables.json ../multi-test.json
if [[ $? != 0 ]]; then
exit 1
fi