forked from spigell/pulumi-hcloud-kube-hetzner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
75 lines (65 loc) · 3.32 KB
/
Makefile
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
SHELL := bash
TEMPLATE ?= go/library
TAG ?= $(shell git describe --tags --abbrev=0)
GH_EXAMPLE ?= k3s-private-non-ha-simple
# Used in CI
test-go-project: clean
@mkdir -p test-project
@cd test-project && \
pulumi new ../pulumi-templates/$(TEMPLATE) -g -n pkhk --yes && \
go mod edit -replace=github.com/spigell/pulumi-hcloud-kube-hetzner=../
@go work use ./test-project
@echo "Now you can create stack for test project in test-project directory"
@echo 'Please use command `pulumi-config PULUMI_CONFIG_SOURCE=/path/to/file` to set config source for the stack'
@echo -e "If the list of files: \033[0;31m [main.go, go.mod, go.sum] \033[0m changed, please add the changes in pulumi-template directory"
test-ts-project: clean
@mkdir -p test-project
@cd test-project && \
pulumi new ../pulumi-templates/typescript -g -n pkhk --yes && \
yarn link --cwd ../pulumi-component/sdk/nodejs/bin && \
sed -i '/\@spigell\/hcloud-kube-hetzner/d' package.json && \
yarn link "@spigell/hcloud-kube-hetzner" && \
yarn install
@echo "Now you can create stack for test project in test-project directory"
@echo 'Please use command `pulumi-config PULUMI_CONFIG_SOURCE=/path/to/file` to set config source for the stack'
@echo -e "If the list of files: \033[0;31m [index.ts, package.json] \033[0m changed, please add the changes in pulumi-template directory"
clean:
go work edit -dropuse ./test-project || true
yarn unlink --cwd pulumi-component/sdk/nodejs/bin || true
rm -rf test-project
github-run:
gh workflow run --ref $$(git rev-parse --abbrev-ref HEAD) -f example=$(GH_EXAMPLE) main-test-examples.yaml
sleep 10
watch gh run view $$(gh run list --workflow=main-test-examples.yaml -b $$(git rev-parse --abbrev-ref HEAD) -L 1 --json databaseId | jq .[0].databaseId -r) -v
up-template-versions:: up-go-lib-template-versions up-go-component-template-versions clean
up-go-lib-template-versions: TEMPLATE = go/library
up-go-lib-template-versions: clean test-go-project
cd test-project && go mod edit -dropreplace=github.com/spigell/pulumi-hcloud-kube-hetzner
cd test-project && go get github.com/spigell/pulumi-hcloud-kube-hetzner@$(TAG) && go mod tidy
cp ./test-project/go.mod ./pulumi-templates/$(TEMPLATE)/go.mod
sed -i "1s/.*/module \\\$${PROJECT}/" ./pulumi-templates/$(TEMPLATE)/go.mod
cp ./test-project/go.sum ./pulumi-templates/$(TEMPLATE)/go.sum
up-go-component-template-versions: TEMPLATE = go/component
up-go-component-template-versions: clean test-go-project
cd test-project && go mod edit -dropreplace=github.com/spigell/pulumi-hcloud-kube-hetzner
cd test-project && go get github.com/spigell/pulumi-hcloud-kube-hetzner@$(TAG) && go mod tidy
cp ./test-project/go.mod ./pulumi-templates/$(TEMPLATE)/go.mod
sed -i "1s/.*/module \\\$${PROJECT}/" ./pulumi-templates/$(TEMPLATE)/go.mod
cp ./test-project/go.sum ./pulumi-templates/$(TEMPLATE)/go.sum
# This stage syncs templates with the GO library template
sync-templates:
for a in go/component typescript; do \
cd pulumi-templates && \
cp -vr \
go/library/README.md \
go/library/pulumi.Makefile \
go/library/versions \
go/library/Makefile \
go/library/.gitignore \
go/library/image-builder \
./$${a}/ ; \
cd - ; \
done
unit-tests:
cd pulumi-component && make generate_schema
set -o pipefail ; go test $$(go list ./... | grep -v integration | grep -v crds/generated) | grep -v 'no test files'