mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-02 04:50:49 +00:00
9a30a11786
- new phony target build: same as install but creating aptly-$version and putting it into a build/ subdir - env TRAVIS_TAG in the makefile now overrides the TAG lookup, this ensures that the tag travis is working with is actually the one being used to construct the version number - subdir is gitignored - travis runs new target - lists artifacts - deploys artifacts to github all of the above only happens on builds that are a tag and DEPLOY_BINARIES is set to yes (which is only the case for latest stable go version)
85 lines
2.3 KiB
Makefile
85 lines
2.3 KiB
Makefile
GOVERSION=$(shell go version | awk '{print $$3;}')
|
|
ifdef TRAVIS_TAG
|
|
TAG=$(TRAVIS_TAG)
|
|
else
|
|
TAG="$(shell git describe --tags)"
|
|
endif
|
|
VERSION=$(shell echo $(TAG) | sed 's@^v@@' | sed 's@-@+@g')
|
|
PACKAGES=context database deb files gpg http query swift s3 utils
|
|
PYTHON?=python
|
|
TESTS?=
|
|
BINPATH?=$(GOPATH)/bin
|
|
RUN_LONG_TESTS?=yes
|
|
|
|
GO_1_10_AND_HIGHER=$(shell (printf '%s\n' go1.10 $(GOVERSION) | sort -cV >/dev/null 2>&1) && echo "yes")
|
|
|
|
all: test check system-test
|
|
|
|
prepare:
|
|
go get -u github.com/alecthomas/gometalinter
|
|
gometalinter --install
|
|
|
|
dev:
|
|
go get -u github.com/golang/dep/...
|
|
go get -u github.com/laher/goxc
|
|
|
|
check: system/env
|
|
ifeq ($(RUN_LONG_TESTS), yes)
|
|
if [ -x travis_wait ]; then \
|
|
travis_wait gometalinter --config=linter.json ./...; \
|
|
else \
|
|
gometalinter --config=linter.json ./...; \
|
|
fi
|
|
. system/env/bin/activate && flake8 --max-line-length=200 --exclude=system/env/ system/
|
|
endif
|
|
|
|
install:
|
|
go install -v -ldflags "-X main.Version=$(VERSION)"
|
|
|
|
build:
|
|
rm -rf build
|
|
mkdir -p build
|
|
go build -v -ldflags "-X main.Version=$(VERSION)" -o "build/aptly-$(VERSION)"
|
|
|
|
system/env: system/requirements.txt
|
|
ifeq ($(RUN_LONG_TESTS), yes)
|
|
rm -rf system/env
|
|
virtualenv system/env
|
|
system/env/bin/pip install -r system/requirements.txt
|
|
endif
|
|
|
|
system-test: install system/env
|
|
ifeq ($(RUN_LONG_TESTS), yes)
|
|
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) && . system/env/bin/activate && APTLY_VERSION=$(VERSION) $(PYTHON) system/run.py --long $(TESTS)
|
|
endif
|
|
|
|
test:
|
|
ifeq ($(GO_1_10_AND_HIGHER), yes)
|
|
go test -v ./... -gocheck.v=true -race -coverprofile=coverage.txt -covermode=atomic
|
|
else
|
|
go test -v `go list ./... | grep -v vendor/` -gocheck.v=true
|
|
endif
|
|
|
|
mem.png: mem.dat mem.gp
|
|
gnuplot mem.gp
|
|
open mem.png
|
|
|
|
goxc:
|
|
rm -rf root/
|
|
mkdir -p root/usr/share/man/man1/ root/etc/bash_completion.d/ root/usr/share/zsh/vendor-completions/
|
|
cp man/aptly.1 root/usr/share/man/man1
|
|
cp completion.d/aptly root/etc/bash_completion.d/
|
|
cp completion.d/_aptly root/usr/share/zsh/vendor-completions/
|
|
gzip root/usr/share/man/man1/aptly.1
|
|
goxc -pv=$(VERSION) -max-processors=4 $(GOXC_OPTS)
|
|
|
|
man:
|
|
make -C man
|
|
|
|
version:
|
|
@echo $(VERSION)
|
|
|
|
.PHONY: man version build
|