Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify version during build #631

Merged
merged 6 commits into from
Oct 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sudo: false
# in the vendor directory. We don't need to test all dependent packages.
# Only testing this project.
script:
- GO15VENDOREXPERIMENT=1 make test integration-test
- GO15VENDOREXPERIMENT=1 make test integration-test verify-version

notifications:
webhooks:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Release 0.13.0 (unreleased)

- Nothing yet

# Release 0.12.3 (2016-10-03)

## Fixed
Expand Down
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
GLIDE_GO_EXECUTABLE ?= go
VERSION := $(shell git describe --tags)
DIST_DIRS := find * -type d -exec
VERSION := $(shell git describe --tags)
VERSION_INCODE = $(shell perl -ne '/^var version.*"([^"]+)".*$$/ && print "v$$1\n"' glide.go)
VERSION_INCHANGELOG = $(shell perl -ne '/^\# Release (\d+(\.\d+)+) / && print "$$1\n"' CHANGELOG.md | head -n1)

build:
${GLIDE_GO_EXECUTABLE} build -o glide -ldflags "-X main.version=${VERSION}" glide.go
Expand All @@ -27,7 +29,6 @@ bootstrap-dist:
cd ${GOPATH}/src/github.com/franciscocpg/gox && git checkout dc50315fc7992f4fa34a4ee4bb3d60052eeb038e
cd ${GOPATH}/src/github.com/franciscocpg/gox && ${GLIDE_GO_EXECUTABLE} install


build-all:
gox -verbose \
-ldflags "-X main.version=${VERSION}" \
Expand All @@ -44,5 +45,16 @@ dist: build-all
$(DIST_DIRS) zip -r glide-${VERSION}-{}.zip {} \; && \
cd ..


.PHONY: build test install clean bootstrap-dist build-all dist integration-test
verify-version:
@if [ "$(VERSION_INCODE)" = "v$(VERSION_INCHANGELOG)" ]; then \
echo "glide: $(VERSION_INCHANGELOG)"; \
elif [ "$(VERSION_INCODE)" = "v$(VERSION_INCHANGELOG)-dev" ]; then \
echo "glide (development): $(VERSION_INCHANGELOG)"; \
else \
echo "Version number in glide.go does not match CHANGELOG.md"; \
echo "glide.go: $(VERSION_INCODE)"; \
echo "CHANGELOG : $(VERSION_INCHANGELOG)"; \
exit 1; \
fi

.PHONY: build test install clean bootstrap-dist build-all dist integration-test verify-version