From 997034422050f0a5adaa4ae858e3b41b2aa71d62 Mon Sep 17 00:00:00 2001 From: Jean du Plessis Date: Wed, 30 Oct 2024 15:49:32 +0200 Subject: [PATCH] Add build submodule Signed-off-by: Jean du Plessis --- .gitmodules | 3 +++ Makefile | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ build | 1 + 3 files changed, 73 insertions(+) create mode 100644 .gitmodules create mode 100644 Makefile create mode 160000 build diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8f84209 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "build"] + path = build + url = https://github.com/crossplane/build diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7f38ae9 --- /dev/null +++ b/Makefile @@ -0,0 +1,69 @@ +# Project Setup +PROJECT_NAME := provider-workflows +PROJECT_REPO := github.com/crossplane-contrib/$(PROJECT_NAME) + +PLATFORMS ?= linux_amd64 linux_arm64 darwin_amd64 darwin_arm64 + +# -include will silently skip missing files, which allows us +# to load those files with a target in the Makefile. If only +# "include" was used, the make command would fail and refuse +# to run a target until the include commands succeeded. +-include build/makelib/common.mk + +# ==================================================================================== +# Setup Output +S3_BUCKET ?= $(PROJECT_NAME).releases +-include build/makelib/output.mk + +# ==================================================================================== +# Setup Go +GO_REQUIRED_VERSION = 1.23 +# GOLANGCILINT_VERSION is inherited from build submodule by default. +# Uncomment below if you need to override the version. +# GOLANGCILINT_VERSION ?= 1.61.0 + +GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/crddiff $(GO_PROJECT)/cmd/buildtagger $(GO_PROJECT)/cmd/updoc $(GO_PROJECT)/cmd/ttr $(GO_PROJECT)/cmd/perf $(GO_PROJECT)/cmd/linter/lint-provider-family +GO_LDFLAGS += -X $(GO_PROJECT)/internal/version.Version=$(VERSION) +GO_SUBDIRS += cmd internal +GO111MODULE = on +-include build/makelib/golang.mk + +# ==================================================================================== +# Targets + +# run `make help` to see the targets and options + +# We want submodules to be set up the first time `make` is run. +# We manage the build/ folder and its Makefiles as a submodule. +# The first time `make` is run, the includes of build/*.mk files will +# all fail, and this target will be run. The next time, the default as defined +# by the includes will be run instead. +fallthrough: submodules + @echo Initial setup complete. Running make again . . . + @make + +# Update the submodules, such as the common build scripts. +submodules: + @git submodule sync + @git submodule update --init --recursive + +.PHONY: submodules fallthrough + +-include build/makelib/k8s_tools.mk +-include build/makelib/controlplane.mk + +uptest: + @echo "Running Uptest" + @printenv + +# NOTE(hasheddan): the build submodule currently overrides XDG_CACHE_HOME in +# order to force the Helm 3 to use the .work/helm directory. This causes Go on +# Linux machines to use that directory as the build cache as well. We should +# adjust this behavior in the build submodule because it is also causing Linux +# users to duplicate their build cache, but for now we just make it easier to +# identify its location in CI so that we cache between builds. +go.cachedir: + @go env GOCACHE + +go.mod.cachedir: + @go env GOMODCACHE diff --git a/build b/build new file mode 160000 index 0000000..420d07d --- /dev/null +++ b/build @@ -0,0 +1 @@ +Subproject commit 420d07dfa6022dc38812e3140a41666644b533ec