2015-05-24 08:13:05 +00:00
|
|
|
DOCKER_CI_IMAGE = go-ceph-ci
|
2019-10-21 23:04:22 +00:00
|
|
|
CONTAINER_CMD := docker
|
2019-12-05 14:13:04 +00:00
|
|
|
CONTAINER_OPTS := --security-opt $(shell grep -q selinux /sys/kernel/security/lsm && echo "label=disabled" || echo "apparmor:unconfined")
|
2019-11-04 14:22:35 +00:00
|
|
|
VOLUME_FLAGS :=
|
|
|
|
|
|
|
|
SELINUX := $(shell getenforce 2>/dev/null)
|
|
|
|
ifeq ($(SELINUX),Enforcing)
|
|
|
|
VOLUME_FLAGS = :z
|
|
|
|
endif
|
2019-10-21 23:04:22 +00:00
|
|
|
|
2015-05-24 08:13:05 +00:00
|
|
|
build:
|
2020-01-08 10:27:46 +00:00
|
|
|
go build -v $(shell go list ./... | grep -v /contrib)
|
2015-05-24 08:13:05 +00:00
|
|
|
fmt:
|
|
|
|
go fmt ./...
|
|
|
|
test:
|
|
|
|
go test -v ./...
|
|
|
|
|
|
|
|
test-docker: .build-docker
|
2019-11-04 14:22:35 +00:00
|
|
|
$(CONTAINER_CMD) run --device /dev/fuse --cap-add SYS_ADMIN $(CONTAINER_OPTS) --rm -it -v $(CURDIR):/go/src/github.com/ceph/go-ceph$(VOLUME_FLAGS) $(DOCKER_CI_IMAGE)
|
2015-05-24 08:13:05 +00:00
|
|
|
|
2019-10-30 18:22:08 +00:00
|
|
|
.build-docker: Dockerfile entrypoint.sh
|
2019-10-21 23:04:22 +00:00
|
|
|
$(CONTAINER_CMD) build -t $(DOCKER_CI_IMAGE) .
|
|
|
|
@$(CONTAINER_CMD) inspect -f '{{.Id}}' $(DOCKER_CI_IMAGE) > .build-docker
|
2018-12-10 22:17:39 +00:00
|
|
|
|
|
|
|
check:
|
2019-12-12 02:04:19 +00:00
|
|
|
# Configure project's revive checks using .revive.toml
|
|
|
|
# See: https://github.com/mgechev/revive
|
|
|
|
@for d in $$(go list ./... | grep -v /vendor/); do revive -config .revive.toml $${d}; done
|