mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +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.
|
# single tests.
|
||||||
TARGET ?= test
|
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)
|
SELINUX := $(shell getenforce 2>/dev/null)
|
||||||
ifeq ($(SELINUX),Enforcing)
|
ifeq ($(SELINUX),Enforcing)
|
||||||
SELINUX_VOL_FLAG = :z
|
SELINUX_VOL_FLAG = :z
|
||||||
@ -60,7 +64,7 @@ endif
|
|||||||
|
|
||||||
all: cephcsi
|
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
|
test: go-test static-check mod-check
|
||||||
static-check: check-env go-lint lint-extras gosec
|
static-check: check-env go-lint lint-extras gosec
|
||||||
|
|
||||||
@ -98,6 +102,9 @@ func-test:
|
|||||||
check-env:
|
check-env:
|
||||||
@./scripts/check-env.sh
|
@./scripts/check-env.sh
|
||||||
|
|
||||||
|
commitlint:
|
||||||
|
commitlint --from $(GIT_SINCE)
|
||||||
|
|
||||||
.PHONY: cephcsi
|
.PHONY: cephcsi
|
||||||
cephcsi: check-env
|
cephcsi: check-env
|
||||||
if [ ! -d ./vendor ]; then (go mod tidy && go mod vendor); fi
|
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
|
$(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
|
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
|
# create a (cached) container image with dependencied for building cephcsi
|
||||||
.devel-container-id: scripts/Dockerfile.devel
|
.devel-container-id: scripts/Dockerfile.devel
|
||||||
|
Loading…
Reference in New Issue
Block a user