mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 00:13:52 +01:00
build: target for go library dependencies
Didn't notice it because vendor/ was already populated on my dev machine, but did notice it in Docker build. Docker build now consumes devsetup like regular user, so this should catch future problems. Remove remaining curl|shit functionality from lazy.sh (no checkout logic needed anymore). refs #35
This commit is contained in:
parent
e8facfe9fa
commit
2716c75ad5
9
Makefile
9
Makefile
@ -1,4 +1,4 @@
|
||||
.PHONY: generate build test vet cover release docs docs-clean clean release-bins
|
||||
.PHONY: generate build test vet cover release docs docs-clean clean release-bins vendordeps
|
||||
.DEFAULT_GOAL := build
|
||||
|
||||
ROOT := github.com/zrepl/zrepl
|
||||
@ -18,13 +18,17 @@ GO_LDFLAGS := "-X github.com/zrepl/zrepl/cmd.zreplVersion=$(ZREPL_VERSION)"
|
||||
|
||||
GO_BUILD := go build -ldflags $(GO_LDFLAGS)
|
||||
|
||||
vendordeps:
|
||||
dep ensure -v -vendor-only
|
||||
|
||||
generate: #not part of the build, must do that manually
|
||||
@for pkg in $(_TESTPKGS); do\
|
||||
go generate "$$pkg" || exit 1; \
|
||||
done;
|
||||
|
||||
build:
|
||||
$(GO_BUILD) -o "$(ARTIFACTDIR)/zrepl"
|
||||
@echo "INFO: In case of missing dependencies, run 'make vendordeps'"
|
||||
$(GO_BUILD) -o "$(ARTIFACTDIR)/zrepl"
|
||||
|
||||
test:
|
||||
@for pkg in $(_TESTPKGS); do \
|
||||
@ -64,6 +68,7 @@ docs-clean:
|
||||
BUILDDIR=../artifacts/docs
|
||||
|
||||
release-bins: $(ARTIFACTDIR) vet test
|
||||
@echo "INFO: In case of missing dependencies, run 'make vendordeps'"
|
||||
GOOS=linux GOARCH=amd64 $(GO_BUILD) -o "$(ARTIFACTDIR)/zrepl-linux-amd64"
|
||||
GOOS=freebsd GOARCH=amd64 $(GO_BUILD) -o "$(ARTIFACTDIR)/zrepl-freebsd-amd64"
|
||||
|
||||
|
@ -27,12 +27,12 @@ Check out the *Coding Workflow* section below for details.
|
||||
* Ship a default config that adheres to your distro's `hier` and logging system.
|
||||
* Ship a service manager file and _please_ try to upstream it to this repository.
|
||||
* Use `make release ZREPL_VERSION='mydistro-1.2.3_1'`
|
||||
* Your distro's name and any versioning supplemental to zrepl's (e.g. package revesion) should be in this string
|
||||
* Your distro's name and any versioning supplemental to zrepl's (e.g. package revision) should be in this string
|
||||
* Make sure you are informed about new zrepl versions, e.g. by subscribing to GitHub's release RSS feed.
|
||||
|
||||
## Developer Documentation
|
||||
|
||||
First, use `./lazy.sh devesetup` to install build dependencies and read `docs/installation.rst -> Compiling from Source`.
|
||||
First, use `./lazy.sh devsetup` to install build dependencies and read `docs/installation.rst -> Compiling from Source`.
|
||||
|
||||
### Overall Architecture
|
||||
|
||||
|
@ -1,20 +1,16 @@
|
||||
FROM golang:latest
|
||||
|
||||
# Docs deps
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3-pip
|
||||
|
||||
ADD lazy.sh /tmp/lazy.sh
|
||||
|
||||
RUN /tmp/lazy.sh builddep
|
||||
|
||||
ADD docs/requirements.txt /tmp/requirements.txt
|
||||
ENV ZREPL_LAZY_DOCS_REQPATH=/tmp/requirements.txt
|
||||
RUN /tmp/lazy.sh docdep
|
||||
RUN /tmp/lazy.sh devsetup
|
||||
|
||||
# prepare volume mount of git checkout to /zrepl
|
||||
RUN mkdir -p /go/src/github.com/zrepl
|
||||
RUN ln -sf /zrepl /go/src/github.com/zrepl/zrepl
|
||||
|
||||
RUN chmod -R 0777 /go
|
||||
WORKDIR /go/src/github.com/zrepl/zrepl
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ and serves as a reference for build dependencies and procedure:
|
||||
sudo docker run -it --rm \
|
||||
-v "${PWD}:/zrepl" \
|
||||
--user "$(id -u):$(id -g)" \
|
||||
zrepl_build make release
|
||||
zrepl_build make vendordeps release
|
||||
|
||||
Alternatively, you can install build dependencies on your local system and then build in your ``$GOPATH``:
|
||||
|
||||
@ -67,7 +67,7 @@ Alternatively, you can install build dependencies on your local system and then
|
||||
git clone https://github.com/zrepl/zrepl.git "${GOPATH}/src/github.com/zrepl/zrepl"
|
||||
cd "${GOPATH}/src/github.com/zrepl/zrepl"
|
||||
./lazy.sh devsetup
|
||||
make release
|
||||
make vendordeps release
|
||||
|
||||
Build results are located in the ``artifacts/`` directory.
|
||||
|
||||
|
29
lazy.sh
29
lazy.sh
@ -13,7 +13,7 @@ step() {
|
||||
echo "${bold}$1${normal}"
|
||||
}
|
||||
|
||||
if ! type go; then
|
||||
if ! type go >/dev/null; then
|
||||
step "go binary not installed or not in \$PATH" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
@ -25,23 +25,6 @@ fi
|
||||
|
||||
CHECKOUTPATH="${GOPATH}/src/github.com/zrepl/zrepl"
|
||||
|
||||
clone() {
|
||||
step "Checkout sources to \$GOPATH/github.com/zrepl/zrepl"
|
||||
if [ -e "$CHECKOUTPATH" ]; then
|
||||
echo "${CHECKOUTPATH} already exists"
|
||||
if [ ! -d "$CHECKOUTPATH" ]; then
|
||||
echo "${CHECKOUTPATH} is not a directory, aborting" 1>&2
|
||||
else
|
||||
cd "$CHECKOUTPATH"
|
||||
fi
|
||||
else
|
||||
mkdir -p "$GOPATH/src/github.com/zrepl"
|
||||
cd "$GOPATH/src/github.com/zrepl"
|
||||
git clone https://github.com/zrepl/zrepl.git
|
||||
cd zrepl
|
||||
fi
|
||||
}
|
||||
|
||||
builddep() {
|
||||
step "Install build depdencies using 'go get' to \$GOPATH/bin"
|
||||
go get -u golang.org/x/tools/cmd/stringer
|
||||
@ -75,16 +58,15 @@ release() {
|
||||
make release
|
||||
}
|
||||
|
||||
# precheck
|
||||
for cmd in "$@"; do
|
||||
case "$cmd" in
|
||||
clone|builddep|godep|docdep|release_bins|docs)
|
||||
builddep|godep|docdep|release_bins|docs)
|
||||
eval $cmd
|
||||
continue
|
||||
;;
|
||||
devsetup)
|
||||
step "Installing development dependencies"
|
||||
builddep
|
||||
godep
|
||||
docdep
|
||||
step "Development dependencies installed"
|
||||
continue
|
||||
@ -96,8 +78,3 @@ for cmd in "$@"; do
|
||||
esac
|
||||
done
|
||||
|
||||
for cmd in "$@"; do
|
||||
step "Step ${cmd}"
|
||||
eval $cmd
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user