mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-05-23 16:40:08 -03:00
modified Makefile to include src-d/ci/Makefile.main
This commit is contained in:
parent
29f7bc77b7
commit
1d1e090149
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
|||||||
.linguist
|
.linguist
|
||||||
benchmarks/output
|
benchmarks/output
|
||||||
|
.ci
|
||||||
|
Makefile.main
|
||||||
|
49
Makefile
49
Makefile
@ -1,32 +1,36 @@
|
|||||||
COVERAGE_REPORT := coverage.txt
|
# Package configuration
|
||||||
COVERAGE_PROFILE := profile.out
|
PROJECT = enry
|
||||||
COVERAGE_MODE := atomic
|
COMMANDS = cli/enry
|
||||||
|
|
||||||
|
# Including ci Makefile
|
||||||
|
MAKEFILE = Makefile.main
|
||||||
|
CI_REPOSITORY = https://github.com/src-d/ci.git
|
||||||
|
CI_FOLDER = .ci
|
||||||
|
|
||||||
|
# If you need to build more than one dockerfile, you can do so like this:
|
||||||
|
# DOCKERFILES = Dockerfile_filename1:repositoryname1 Dockerfile_filename2:repositoryname2 ...
|
||||||
|
|
||||||
|
$(MAKEFILE):
|
||||||
|
@git clone --quiet $(CI_REPOSITORY) $(CI_FOLDER); \
|
||||||
|
cp $(CI_FOLDER)/$(MAKEFILE) .;
|
||||||
|
|
||||||
|
-include $(MAKEFILE)
|
||||||
|
|
||||||
LINGUIST_PATH = .linguist
|
LINGUIST_PATH = .linguist
|
||||||
|
|
||||||
# build CLI
|
# build CLI
|
||||||
VERSION := $(shell git describe --tags --abbrev=0)
|
LOCAL_TAG := $(shell git describe --tags --abbrev=0)
|
||||||
COMMIT := $(shell git rev-parse --short HEAD)
|
LOCAL_COMMIT := $(shell git rev-parse --short HEAD)
|
||||||
LDFLAGS = -s -X main.Version=$(VERSION) -X main.GitHash=$(COMMIT)
|
LOCAL_BUILD := $(shell date +"%m-%d-%Y_%H_%M_%S")
|
||||||
|
LOCAL_LDFLAGS = -s -X main.version=$(LOCAL_TAG) -X main.build=$(LOCAL_BUILD) -X main.commit=$(LOCAL_COMMIT)
|
||||||
|
|
||||||
$(LINGUIST_PATH):
|
$(LINGUIST_PATH):
|
||||||
git clone https://github.com/github/linguist.git $@
|
git clone https://github.com/github/linguist.git $@
|
||||||
|
|
||||||
test: $(LINGUIST_PATH)
|
clean-linguist:
|
||||||
go test -v ./...
|
rm -rf $(LINGUIST_PATH)
|
||||||
|
|
||||||
test-coverage: $(LINGUIST_PATH)
|
clean: clean-linguist
|
||||||
@echo "mode: $(COVERAGE_MODE)" > $(COVERAGE_REPORT); \
|
|
||||||
for dir in `find . -name "*.go" | grep -o '.*/' | sort -u | grep -v './fixtures/' | grep -v './.linguist/'`; do \
|
|
||||||
go test $$dir -coverprofile=$(COVERAGE_PROFILE) -covermode=$(COVERAGE_MODE); \
|
|
||||||
if [ $$? != 0 ]; then \
|
|
||||||
exit 2; \
|
|
||||||
fi; \
|
|
||||||
if [ -f $(COVERAGE_PROFILE) ]; then \
|
|
||||||
tail -n +2 $(COVERAGE_PROFILE) >> $(COVERAGE_REPORT); \
|
|
||||||
rm $(COVERAGE_PROFILE); \
|
|
||||||
fi; \
|
|
||||||
done;
|
|
||||||
|
|
||||||
code-generate: $(LINGUIST_PATH)
|
code-generate: $(LINGUIST_PATH)
|
||||||
mkdir -p data
|
mkdir -p data
|
||||||
@ -42,8 +46,5 @@ benchmarks-slow: $(LINGUST_PATH)
|
|||||||
mkdir -p benchmarks/output && go test -run=NONE -bench=. -slow -benchtime=100ms -timeout=100h >benchmarks/output/enry_samples.bench && \
|
mkdir -p benchmarks/output && go test -run=NONE -bench=. -slow -benchtime=100ms -timeout=100h >benchmarks/output/enry_samples.bench && \
|
||||||
benchmarks/linguist-samples.rb 5 >benchmarks/output/linguist_samples.bench
|
benchmarks/linguist-samples.rb 5 >benchmarks/output/linguist_samples.bench
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf $(LINGUIST_PATH)
|
|
||||||
|
|
||||||
build-cli:
|
build-cli:
|
||||||
go build -o enry -ldflags "$(LDFLAGS)" cli/enry/main.go
|
go build -o enry -ldflags "$(LOCAL_LDFLAGS)" cli/enry/main.go
|
||||||
|
@ -14,8 +14,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Version = "undefined"
|
version = "undefined"
|
||||||
GitHash = "undefined"
|
build = "undefined"
|
||||||
|
commit = "undefined"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -111,13 +112,13 @@ func main() {
|
|||||||
func usage() {
|
func usage() {
|
||||||
fmt.Fprintf(
|
fmt.Fprintf(
|
||||||
os.Stderr,
|
os.Stderr,
|
||||||
` %[1]s %[2]s commit: %[3]s
|
` %[1]s %[2]s build: %[3]s commit: %[4]s
|
||||||
enry, A simple (and faster) implementation of github/linguist
|
%[1]s, A simple (and faster) implementation of github/linguist
|
||||||
usage: %[1]s <path>
|
usage: %[1]s <path>
|
||||||
%[1]s [-json] [-breakdown] <path>
|
%[1]s [-json] [-breakdown] <path>
|
||||||
%[1]s [-json] [-breakdown]
|
%[1]s [-json] [-breakdown]
|
||||||
`,
|
`,
|
||||||
os.Args[0], Version, GitHash,
|
os.Args[0], version, build, commit,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user