mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 20:00:23 +00:00
ci: add commitlint target to the Makefile
When passing `GIT_SINCE` as an argument, the commits from then on (defaults to origin/master) are used. A CI job can pass the base branch or ID so a range of patches gets checked. To test the last four commits, one can run: $ make containerized-test TARGET=commitlint GIT_SINCE=HEAD~4 Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
aeb5c75da7
commit
eff4f4ba50
11
Makefile
11
Makefile
@ -53,6 +53,10 @@ endif
|
||||
# single tests.
|
||||
TARGET ?= test
|
||||
|
||||
# Pass GIT_SINCE for the range of commits to test. Used with the commitlint
|
||||
# target.
|
||||
GIT_SINCE := origin/master
|
||||
|
||||
SELINUX := $(shell getenforce 2>/dev/null)
|
||||
ifeq ($(SELINUX),Enforcing)
|
||||
SELINUX_VOL_FLAG = :z
|
||||
@ -60,7 +64,7 @@ endif
|
||||
|
||||
all: cephcsi
|
||||
|
||||
.PHONY: go-test static-check mod-check go-lint lint-extras gosec
|
||||
.PHONY: go-test static-check mod-check go-lint lint-extras gosec commitlint
|
||||
test: go-test static-check mod-check
|
||||
static-check: check-env go-lint lint-extras gosec
|
||||
|
||||
@ -98,6 +102,9 @@ func-test:
|
||||
check-env:
|
||||
@./scripts/check-env.sh
|
||||
|
||||
commitlint:
|
||||
commitlint --from $(GIT_SINCE)
|
||||
|
||||
.PHONY: cephcsi
|
||||
cephcsi: check-env
|
||||
if [ ! -d ./vendor ]; then (go mod tidy && go mod vendor); fi
|
||||
@ -108,7 +115,7 @@ containerized-build: .devel-container-id
|
||||
$(CONTAINER_CMD) run --rm -v $(PWD):/go/src/github.com/ceph/ceph-csi$(SELINUX_VOL_FLAG) $(CSI_IMAGE_NAME):devel make cephcsi
|
||||
|
||||
containerized-test: .test-container-id
|
||||
$(CONTAINER_CMD) run --rm -v $(PWD):/go/src/github.com/ceph/ceph-csi$(SELINUX_VOL_FLAG) $(CSI_IMAGE_NAME):test make $(TARGET)
|
||||
$(CONTAINER_CMD) run --rm -v $(PWD):/go/src/github.com/ceph/ceph-csi$(SELINUX_VOL_FLAG) $(CSI_IMAGE_NAME):test make $(TARGET) GIT_SINCE=$(GIT_SINCE)
|
||||
|
||||
# create a (cached) container image with dependencied for building cephcsi
|
||||
.devel-container-id: scripts/Dockerfile.devel
|
||||
|
Loading…
Reference in New Issue
Block a user