-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(testing): automate local testing workflow (#8304)
* add root makefile * add makefile in t * small updates * small fix * get gopath * Update Makefile
- Loading branch information
1 parent
3ab3ebf
commit 4fd7c96
Showing
2 changed files
with
49 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,20 +20,20 @@ BUILD_DATE ?= $(shell git log -1 --format=%ci) | |
BUILD_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) | ||
BUILD_VERSION ?= $(shell git describe --always --tags) | ||
|
||
MODIFIED = $(shell git diff-index --quiet HEAD || echo "-mod") | ||
MODIFIED = $(shell git diff-index --quiet HEAD || echo "-mod") | ||
|
||
SUBDIRS = dgraph | ||
GOPATH ?= $(shell go env GOPATH) | ||
|
||
############### | ||
|
||
.PHONY: $(SUBDIRS) all oss version install install_oss oss_install uninstall test help image | ||
.PHONY: dgraph all oss version install install_oss oss_install uninstall test help image image-local local-image | ||
all: $(SUBDIRS) | ||
|
||
$(SUBDIRS): | ||
$(MAKE) -w -C $@ all | ||
dgraph: | ||
GOOS=linux GOARCH=amd64 $(MAKE) -w -C $@ all | ||
|
||
oss: | ||
$(MAKE) BUILD_TAGS=oss | ||
GOOS=linux GOARCH=amd64 $(MAKE) BUILD_TAGS=oss | ||
|
||
version: | ||
@echo Dgraph ${BUILD_VERSION} | ||
|
@@ -46,33 +46,34 @@ version: | |
install: | ||
@(set -e;for i in $(SUBDIRS); do \ | ||
echo Installing $$i ...; \ | ||
$(MAKE) -C $$i install; \ | ||
GOOS=linux GOARCH=amd64 $(MAKE) -C $$i install; \ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
joshua-goldstein
Author
Contributor
|
||
done) | ||
|
||
install_oss oss_install: | ||
$(MAKE) BUILD_TAGS=oss install | ||
GOOS=linux GOARCH=amd64 $(MAKE) BUILD_TAGS=oss install | ||
|
||
uninstall: | ||
@(set -e;for i in $(SUBDIRS); do \ | ||
echo Uninstalling $$i ...; \ | ||
$(MAKE) -C $$i uninstall; \ | ||
done) | ||
|
||
test: | ||
@echo Running ./test.sh | ||
./test.sh | ||
test: image-local | ||
@cp dgraph/dgraph ${GOPATH}/bin | ||
@rm dgraph/dgraph | ||
@$(MAKE) -C t test | ||
|
||
image: | ||
@GOOS=linux $(MAKE) dgraph | ||
@GOOS=linux GOARCH=amd64 $(MAKE) dgraph | ||
@mkdir -p linux | ||
@mv ./dgraph/dgraph ./linux/dgraph | ||
@docker build -f contrib/Dockerfile -t dgraph/dgraph:$(subst /,-,${BUILD_BRANCH}) . | ||
@rm -r linux | ||
|
||
image-local: | ||
image-local local-image: | ||
@GOOS=linux GOARCH=amd64 $(MAKE) dgraph | ||
@mkdir -p linux | ||
@mv ./dgraph/dgraph ./linux/dgraph | ||
@cp ./dgraph/dgraph ./linux/dgraph | ||
@docker build -f contrib/Dockerfile -t dgraph/dgraph:local . | ||
@rm -r linux | ||
|
||
|
@@ -86,4 +87,5 @@ help: | |
@echo " make uninstall - Uninstall known targets" | ||
@echo " make version - Show current build info" | ||
@echo " make help - This help" | ||
@echo " make test - Make local image and run t.go" | ||
@echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# | ||
# Copyright 2018 Dgraph Labs, Inc. and Contributors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# linux || darwin | ||
GOOS ?= $(shell go env GOOS) | ||
GOPATH ?= $(shell go env GOPATH) | ||
|
||
.PHONY: test | ||
|
||
all: test | ||
|
||
test: | ||
# build the t.go binary | ||
@go build . | ||
# clean go testcache | ||
go clean -testcache | ||
# run the tests | ||
@./t --skip systest/backup,systest/online-restore,systest/loader,tlstest | ||
# clean up docker containers after test execution | ||
./t -r |
@joshua-goldstein I'm going thru the README checking that instructions there are correct. The README states you can
make install
to get a dgraph binary. Setting the GOOS and GOARCH here makes an unusable image if you're not running on Linux/amd64. Was there some reason theinstall
target needed to be linux/amd64?