-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (56 loc) · 2.03 KB
/
Makefile
File metadata and controls
75 lines (56 loc) · 2.03 KB
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
.PHONY: vendor
GO_TEST = $(shell command -v gotest || echo "go test")
STACKS = aws cloudformation describe-stacks \
| jq '.Stacks[] | select((.StackName | startswith("stastest-")) or (.Tags[].Key == "STAS_TEST")) | .StackId' -r
build:
go build $(BUILD_ARGS) -o bin/stas cmd/main.go
test:
${GO_TEST} ./...
testrace:
${GO_TEST} -race ./...
run-acctest:
go test $(BUILD_ARGS) -v ./tests $(GODOG_ARGS)
testacc: clean-testcache
testacc: run-acctest
testaccwip: GODOG_ARGS = --godog.tags=wip --godog.concurrency=1 --godog.format=pretty
testaccwip: BUILD_ARGS = -tags acceptance
testaccwip: testacc
testaccwip: cleanup
testaccall: BUILD_ARGS = -tags acceptance
testaccall: testacc
testaccall: cleanup
testaccmock: GODOG_ARGS = --godog.tags=~@nomock
# testaccmock: BUILD_ARGS = -tags awsmock,acceptance -race -timeout 2s -coverpkg $(shell go list ./... | grep -v mock | paste -sd ',' -) -coverprofile=/tmp/cover.out
testaccmock: BUILD_ARGS = -tags awsmock,acceptance -race -timeout 2s
testaccmock: testacc
testaccnomock: GODOG_ARGS = --godog.tags=nomock
testaccnomock: BUILD_ARGS = -tags acceptance
testaccnomock: export STAS_NO_MOCK := yes
testaccnomock: testacc
testaccnomock: cleanup
testaccshort: GODOG_ARGS = --godog.tags=short
testaccshort: BUILD_ARGS = -tags acceptance
testaccshort: testacc
testaccshort: cleanup
clean-testcache:
go clean -testcache ./...
test-nocache: clean-testcache
test-nocache: test
cleanup: purgebuckets
cleanup: purgetmpbuckets
cleanup: rmstacks
rmstacks:
$(STACKS) \
| xargs -r -l aws cloudformation delete-stack --stack-name
purgebuckets:
$(STACKS) \
| xargs -r -l aws cloudformation describe-stack-resources \
--query "StackResources[?ResourceType=='AWS::S3::Bucket'].PhysicalResourceId" \
--output text --stack-name \
| xargs -r -l -I % aws s3 rm s3://% --recursive
purgetmpbuckets:
aws --profile meadmin s3api list-buckets --query 'Buckets' --output json \
| jq -r '.[]|select(.Name | startswith("stack-assembly-tmp")) | .Name' \
| xargs -r -l -I % aws s3 rm s3://% --recursive
lint:
golangci-lint run