Skip to content

Commit

Permalink
Add build submodule
Browse files Browse the repository at this point in the history
Signed-off-by: Jean du Plessis <[email protected]>
  • Loading branch information
jeanduplessis committed Oct 30, 2024
1 parent 76f83fa commit 9970344
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "build"]
path = build
url = https://github.com/crossplane/build
69 changes: 69 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions build
Submodule build added at 420d07

0 comments on commit 9970344

Please sign in to comment.