-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (72 loc) · 3.01 KB
/
Copy pathMakefile
File metadata and controls
85 lines (72 loc) · 3.01 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
76
77
78
79
80
81
82
83
84
85
SHELL := sh
PROJECT := github.com/pulumi/pulumi-terraform-bridge
TESTPARALLELISM := 10
export PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION := true
PROJECT_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
build::
go mod tidy
go build ${PROJECT}/v3/pkg/...
go build ${PROJECT}/v3/internal/...
install_plugins::
pulumi plugin install converter terraform 1.0.20
pulumi plugin install resource random 4.16.3
pulumi plugin install resource aws 6.22.2
pulumi plugin install resource archive 0.0.4
pulumi plugin install resource wavefront 3.0.0
pulumi plugin install resource auth0 3.16.0
pulumi plugin install resource http 0.0.11
pulumi plugin install resource gcp 8.22.0
pulumi plugin install resource equinix 0.6.0 --server github://api.github.com/equinix
fmt::
@gofmt -w -s .
lint:
go run scripts/build.go lint
lint_fix:
go run scripts/build.go fix-lint
RUN_TEST_CMD ?= ./...
GO_TEST_CMD ?= go test
test:: install_plugins
@mkdir -p bin
go build -o bin ./internal/testing/pulumi-terraform-bridge-test-provider
PULUMI_TERRAFORM_BRIDGE_TEST_PROVIDER=$(shell pwd)/bin/pulumi-terraform-bridge-test-provider \
$(value GO_TEST_CMD) -count=1 -coverprofile="coverage.txt" -coverpkg=./... -timeout 2h -parallel ${TESTPARALLELISM} $(value RUN_TEST_CMD)
# Run tests while accepting current output as expected output "golden"
# tests. In case where system behavior changes intentionally this can
# be useful to run to review the differences with git diff.
#
# For re-recording golden files, we use a local, test-specific plugin
# cache to ensure parity with CI.
TEST_PULUMI_HOME := $(PROJECT_DIR)/.pulumi-test
test_accept::
rm -rf $(TEST_PULUMI_HOME)
PULUMI_HOME=$(TEST_PULUMI_HOME) $(MAKE) install_plugins
PULUMI_HOME=$(TEST_PULUMI_HOME) PULUMI_ACCEPT=1 go test -v -count=1 -cover -timeout 2h -parallel ${TESTPARALLELISM} $(value RUN_TEST_CMD)
generate_builtins_test::
if [ ! -d ./scripts/venv ]; then python -m venv ./scripts/venv; fi
. ./scripts/venv/*/activate && python -m pip install -r ./scripts/requirements.txt
. ./scripts/venv/*/activate && python ./scripts/generate_builtins.py
tidy::
find . -name go.mod -execdir go mod tidy \;
# Ideally, we would have `tidy: pin_upstream_sdk`, but `find` doesn't have the same format
# on windows.
pin_upstream_sdk: UpstreamPluginSDK=github.com/hashicorp/terraform-plugin-sdk/v2
pin_upstream_sdk: OurPluginSDK=github.com/pulumi/terraform-plugin-sdk/v2
pin_upstream_sdk: PluginSDKVersion=v2.0.0-20250530111747-935112552988
pin_upstream_sdk:
# /x/muxer doesn't depend on the rest of the bridge or any TF libraries, so it
# doesn't need this replace.
#
# All other modules depend on the bridge, so need this replace.
find . -name go.mod -and \
-not -path '*/x/muxer/*' -and \
-execdir go mod edit -replace ${UpstreamPluginSDK}=${OurPluginSDK}@${PluginSDKVersion} \;
.PHONY: go.work
go.work::
@cd $(PROJECT_DIR)
ifeq (,$(wildcard $(PROJECT_DIR)/go.work))
@echo "Initializing go.work..."
@go work init
else
@echo "Updating go.work..."
endif
@go work use -r .