Automatic versioning for aptly

New version format:

* for releases, `x.y.z` (follows tag without leading `v`)
* for nightly builds, `x.y.z+N+hash` (previous version, not the upcoming one)

This means that each nightly build `aptly` would report
correct version now.

Version is now complied into the aptly binary, system tests
automatically check for current version, no need to update them
anymore.
This commit is contained in:
Andrey Smirnov
2017-03-25 00:18:45 +03:00
parent 91219e3a0a
commit 2943422d5d
13 changed files with 43 additions and 13 deletions
+7 -4
View File
@@ -1,6 +1,6 @@
GOVERSION=$(shell go version | awk '{print $$3;}')
VERSION=$(shell git describe --tags | sed 's@^v@@' | sed 's@-@+@g')
PACKAGES=context database deb files http query swift s3 utils
ALL_PACKAGES=api aptly context cmd console database deb files http query swift s3 utils
PYTHON?=python
TESTS?=
BINPATH?=$(GOPATH)/bin
@@ -39,12 +39,12 @@ check:
gometalinter --vendor --vendored-linters --config=linter.json ./...
install:
go install -v
go install -x -v -ldflags "-X main.Version=$(VERSION)"
system-test: install
if [ ! -e ~/aptly-fixture-db ]; then git clone https://github.com/aptly-dev/aptly-fixture-db.git ~/aptly-fixture-db/; fi
if [ ! -e ~/aptly-fixture-pool ]; then git clone https://github.com/aptly-dev/aptly-fixture-pool.git ~/aptly-fixture-pool/; fi
PATH=$(BINPATH)/:$(PATH) $(PYTHON) system/run.py --long $(TESTS)
APTLY_VERSION=$(VERSION) PATH=$(BINPATH)/:$(PATH) $(PYTHON) system/run.py --long $(TESTS)
travis: $(TRAVIS_TARGET) check system-test
@@ -79,4 +79,7 @@ goxc:
man:
make -C man
.PHONY: coverage.out man
version:
@echo $(VERSION)
.PHONY: coverage.out man version