-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathTaskfile.yml
81 lines (68 loc) · 1.84 KB
/
Taskfile.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
version: '2'
env:
AWS_DEFAULT_REGION: eu-west-1
GO111MODULE: on
TRAVIS_TAG:
sh: git describe --tags --candidates=1 --dirty 2>/dev/null || echo "dev"
tasks:
default:
cmds:
- task: test
test:
desc: Run all tests.
cmds:
- task: test-go
- task: test-terraform
build:
cmds:
- go build -o build/main{{exeExt}} -ldflags="-s -w" -v cmd/main.go
- zip -mj build/${TRAVIS_TAG}.zip build/main{{exeExt}}
- cp build/${TRAVIS_TAG}.zip build/concourse-github-lambda.zip
env: { CGO_ENABLED: '0', GOOS: '{{OS}}', GOARCH: '{{ARCH}}' }
generate:
desc: Generate test fakes.
cmds:
- go generate ./...
sources:
- '*.go'
generates:
- mocks/*.go
method: checksum
test-go:
desc: Run golang test suite.
deps: [generate]
cmds:
- gofmt -s -l -w .
- go vet -v ./...
- go test -race -v ./...
test-terraform:
desc: Run tests for all terraform directories.
silent: true
env:
DIRECTORIES:
sh: find . -type f -name '*.tf' -not -path "**/.terraform/*" -exec dirname {} \; | sort -u
cmds:
- |
BOLD=$(tput bold)
NORM=$(tput sgr0)
CWD=$PWD
for d in $DIRECTORIES; do
cd $d
echo "${BOLD} $PWD:${NORM}"
if ! terraform fmt -check=true -write=true -list=false -recursive=false; then
echo " ✗ terraform fmt" && exit $?
else
echo " √ terraform fmt"
fi
if ! terraform init -backend=false -input=false -get=true -get-plugins=true -no-color > /dev/null; then
echo " ✗ terraform init" && exit $?
else
echo " √ terraform init"
fi
if ! terraform validate > /dev/null; then
echo " ✗ terraform validate" && exit $?
else
echo " √ terraform validate"
fi
cd $CWD
done