1
0
mirror of https://github.com/openshift/image-registry.git synced 2026-02-05 09:45:55 +01:00
Files
image-registry/Makefile
2018-07-10 18:41:03 -04:00

149 lines
3.6 KiB
Makefile

# Old-skool build tools.
#
# Targets (see each target for more information):
# all: Build code.
# build: Build code.
# check: Run verify, build, unit tests and cmd tests.
# test: Run all tests.
# run: Run all-in-one server
# clean: Clean up.
OUT_DIR = _output
OS_OUTPUT_GOPATH ?= 1
export GOFLAGS
export TESTFLAGS
# If set to 1, create an isolated GOPATH inside _output using symlinks to avoid
# other packages being accidentally included. Defaults to on.
export OS_OUTPUT_GOPATH
# May be used to set additional arguments passed to the image build commands for
# mounting secrets specific to a build environment.
export OS_BUILD_IMAGE_ARGS
# Tests run using `make` are most often run by the CI system, so we are OK to
# assume the user wants jUnit output and will turn it off if they don't.
JUNIT_REPORT ?= true
# Build code.
#
# Args:
# WHAT: Directory names to build. If any of these directories has a 'main'
# package, the build will produce executable files under $(OUT_DIR)/local/bin.
# If not specified, "everything" will be built.
# GOFLAGS: Extra flags to pass to 'go' when building.
# TESTFLAGS: Extra flags that should only be passed to hack/test-go.sh
#
# Example:
# make
# make all
# make all WHAT=cmd/oc GOFLAGS=-v
all build:
hack/build-go.sh $(WHAT) $(GOFLAGS)
.PHONY: all build
# Run core verification and all self contained tests.
#
# Example:
# make check
check: verify test-unit test-integration
.PHONY: check
# Verify code conventions are properly setup.
#
# Example:
# make verify
verify: verify-fmt verify-govet verify-imports verify-gometalinter
.PHONY: verify
verify-fmt:
hack/verify-gofmt.sh
.PHONY: verify-fmt
verify-govet:
hack/verify-govet.sh
.PHONY: verify-govet
verify-imports:
hack/verify-imports.sh
.PHONY: verify-imports
LOGFUNCS=Debug Info Warn Warning Error
null :=
space := $(null) #
comma := ,
verify-gometalinter:
gometalinter \
--deadline=180s \
--linter='vet:go tool vet -printfuncs $(subst $(space),$(comma),$(foreach fn,$(LOGFUNCS),$(fn) $(fn)f $(fn)ln)),Fatalln:PATH:LINE:MESSAGE' \
--disable-all -E errcheck -E ineffassign -E unconvert -E varcheck -E vet \
./cmd/... ./pkg/... ./test/...
.PHONY: verify-gometalinter
# Verify commit comments.
#
# Example:
# make verify-commits
verify-commits:
hack/verify-upstream-commits.sh
.PHONY: verify-commits
# Run unit tests.
#
# Args:
# WHAT: Directory names to test. All *_test.go files under these
# directories will be run. If not specified, "everything" will be tested.
# TESTS: Same as WHAT.
# GOFLAGS: Extra flags to pass to 'go' when building.
# TESTFLAGS: Extra flags that should only be passed to hack/test-go.sh
#
# Example:
# make test-unit
# make test-unit WHAT=pkg/build TESTFLAGS=-v
test-unit:
GOTEST_FLAGS="$(TESTFLAGS)" hack/test-go.sh $(WHAT) $(TESTS)
.PHONY: test-unit
test-integration:
# TODO(dmage): remove DOCKER_API_VERSION when our CI will upgrade Docker
GOTEST_FLAGS="$(TESTFLAGS)" DOCKER_API_VERSION=1.24 hack/test-go.sh test/integration/*
.PHONY: test-integration
# Remove all build artifacts.
#
# Example:
# make clean
clean:
rm -rf $(OUT_DIR)
.PHONY: clean
# Build the cross compiled release binaries
#
# Example:
# make build-cross
build-cross:
hack/build-cross.sh
.PHONY: build-cross
# Build RPMs only for the Linux AMD64 target
#
# Args:
#
# Example:
# make build-rpms
build-rpms:
OS_ONLY_BUILD_PLATFORMS='linux/amd64' hack/build-rpms.sh
.PHONY: build-rpms
# Build images from the official RPMs
#
# Args:
#
# Example:
# make build-images
build-images: build-rpms
hack/build-images.sh
.PHONY: build-images
update-deps:
glide update --skip-test -v
.PHONY: update-deps