Skip to content

Commit

Permalink
4: #4
Browse files Browse the repository at this point in the history
  • Loading branch information
miroswan committed Oct 24, 2019
1 parent 7106b10 commit b11aebe
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@

SHELL = /bin/bash

build_and_test: docker clean build test package smoke
# Origin does not point to https://github.com/digitalocean/prometheus-client-c.git in TravisCI so we must add a new
# remote for fetching. Fetch master, diff on the filenames and look for C files. If no changes to C files are made, skip
# the build.
CHANGED_FILES = $(shell git remote add ci https://github.com/digitalocean/prometheus-client-c.git > /dev/null 2>&1; git fetch ci master > /dev/null 2>&1; git diff --name-only ci/master | egrep '.*[c|h]$$')

ifneq ($(shell echo "x${CHANGED_FILES}x" | sed 's/\n\t //'), xx)
build_and_test: changed_files docker clean build test package smoke
.PHONY: build_and_test

all: build_and_test docs
Expand Down Expand Up @@ -33,3 +39,11 @@ smoke: package
docs: smoke
./auto dev -e auto -a docs
.PHONY: package
else
default: changed_files
@echo -e "\033[1;32mNothing to build\033[0m"
endif

changed_files:
@echo "Changed C files: ${CHANGED_FILES}"
.PHONY: changed_files

0 comments on commit b11aebe

Please sign in to comment.