Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Adding 'make check'
Browse files Browse the repository at this point in the history
We will use 'shellcheck' to help us to assert code quality. I does
throws some false positive due to how we do inclusion (sourcing) and by
treating our "header" scripts as if they were meant to be executed by
itself, but we can handle this cases by either adding an exclude to the
makefile or adding an exclude directive to the file itself.

Signed-off-by: Murilo Belluzzo <[email protected]>
  • Loading branch information
mbelluzzo-intel committed Nov 16, 2018
1 parent 21c51c7 commit 7b4cbac
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
STEPS := $(patsubst %.sh,%,$(notdir $(wildcard $(CURDIR)/release/*.sh)))

HOSTNAME := $(shell hostname -f)

BUILD_DIR ?= $(CURDIR)/tmp/build
STAGING_DIR ?= $(CURDIR)/tmp/release
DSTREAM_DL_URL ?= http://${HOSTNAME}:8000/update

pipelines := common koji release watcher

common_SRC := $(wildcard *.sh)

koji_SRC := $(wildcard $(CURDIR)/koji/*.sh)

release_SRC := $(wildcard $(CURDIR)/release/*.sh)

watcher_SRC := $(wildcard $(CURDIR)/watcher/*.sh)

SRC := $(common_SRC) $(koji_SRC) $(release_SRC) $(watcher_SRC)

release_STEPS := $(patsubst %.sh,%,$(release_SRC))

all:
@echo "use 'make release' to run all steps'"
@echo "use 'make STEP' to run individual steps: ${STEPS}"
Expand All @@ -17,8 +28,8 @@ ${BUILD_DIR}:
${STAGING_DIR}:
mkdir -p $@

.PHONY: $(STEPS)
$(STEPS): ${BUILD_DIR} ${STAGING_DIR}
.PHONY: $(release_STEPS)
$(release_STEPS): ${BUILD_DIR} ${STAGING_DIR}
BUILD_DIR=${BUILD_DIR} \
STAGING_DIR=${STAGING_DIR} \
DSTREAM_DL_URL=${DSTREAM_DL_URL} \
Expand All @@ -30,3 +41,10 @@ release: prologue koji content mixer images stage
.PHONY: serve
serve: ${STAGING_DIR}
cd ${STAGING_DIR}; python -mSimpleHTTPServer

check_PIPELINES = $(addprefix check-,$(pipelines))
$(check_PIPELINES): pipe = $(patsubst check-%,%,$@)
$(check_PIPELINES):
shellcheck $($(pipe)_CHECKOPTS) $($(pipe)_SRC)

check: $(check_PIPELINES)

0 comments on commit 7b4cbac

Please sign in to comment.