Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit f18dc00

Browse files
authored
Merge pull request #1910 from OpenBazaar/brian.qarunner
(#1892) QA Runner
2 parents 3a6184d + ec7f549 commit f18dc00

File tree

4 files changed

+109
-38
lines changed

4 files changed

+109
-38
lines changed

Dockerfile.dev

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,4 @@
1-
FROM golang:1.11
2-
VOLUME /var/lib/openbazaar
3-
4-
RUN wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \
5-
tar xvf Python-3.6.0.tgz && \
6-
cd Python-3.6.0 && \
7-
./configure --enable-optimizations && \
8-
make -j8
9-
RUN apt-get update && apt-get install -yq zlib1g-dev libssl-dev unzip
10-
RUN cd Python-3.6.0 && \
11-
make altinstall && \
12-
ln -s /usr/local/bin/python3.6 /usr/local/bin/python3
13-
14-
COPY ./qa/requirements.txt ./requirements.txt
15-
16-
RUN pip3.6 install --upgrade pip && \
17-
pip3.6 install -r requirements.txt && \
18-
wget https://bitcoin.org/bin/bitcoin-core-0.16.3/bitcoin-0.16.3-x86_64-linux-gnu.tar.gz && \
19-
tar -xvzf bitcoin-0.16.3-x86_64-linux-gnu.tar.gz -C /opt
20-
21-
RUN wget https://github.com/google/protobuf/releases/download/v3.6.0/protoc-3.6.0-linux-x86_64.zip && \
22-
unzip ./protoc-3.6.0-linux-x86_64.zip -x readme.txt && \
23-
mv ./include/* /usr/local/include/ && \
24-
mv ./bin/protoc /usr/local/bin/ && \
25-
rm -rf ./include ./bin
1+
FROM openbazaar/server-qa:0.10
262

273
RUN go get -u github.com/gogo/protobuf/proto \
284
github.com/golang/protobuf/protoc-gen-go \

Dockerfile.qa

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM golang:1.11
2+
3+
ENV BITCOIND_VERSION=0.16.3
4+
ENV BITCOIND_PATH=/opt/bitcoin-${BITCOIND_VERSION}
5+
6+
# software installs, from most stable to most volatile
7+
RUN apt-get update -y
8+
RUN apt-get install -yq software-properties-common \
9+
zlib1g-dev \
10+
libssl-dev \
11+
unzip \
12+
python3 \
13+
python3-pip
14+
15+
RUN wget https://github.com/google/protobuf/releases/download/v3.6.0/protoc-3.6.0-linux-x86_64.zip && \
16+
unzip ./protoc-3.6.0-linux-x86_64.zip -x readme.txt && \
17+
mv ./include/* /usr/local/include/ && \
18+
mv ./bin/protoc /usr/local/bin/ && \
19+
rm -rf ./include ./bin
20+
21+
COPY ./qa/requirements.txt ./requirements.txt
22+
23+
RUN python3 -m pip install --upgrade pip && \
24+
pip install -r ./requirements.txt && \
25+
wget https://bitcoin.org/bin/bitcoin-core-0.16.3/bitcoin-${BITCOIND_VERSION}-x86_64-linux-gnu.tar.gz && \
26+
tar -xvzf bitcoin-${BITCOIND_VERSION}-x86_64-linux-gnu.tar.gz -C /opt
27+
28+
WORKDIR /go/src/github.com/OpenBazaar/openbazaar-go
29+
30+
COPY ./Makefile ./Makefile
31+
32+
VOLUME /go/src/github.com/OpenBazaar/openbazaar-go
33+
34+
CMD make qa_test

Makefile

Lines changed: 69 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1+
.DEFAULT_GOAL := help
2+
3+
##
4+
## Global ENV vars
5+
##
6+
7+
GIT_SHA ?= $(shell git rev-parse --short=8 HEAD)
8+
GIT_TAG ?= $(shell git describe --tags --abbrev=0)
9+
10+
##
11+
## Helpful Help
12+
##
13+
14+
.PHONY: help
15+
help:
16+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
17+
18+
119
##
220
## Building
321
##
422

5-
ios_framework:
23+
.PHONY: ios_framework
24+
ios_framework: ## Build iOS Framework for mobile
625
gomobile bind -target=ios github.com/OpenBazaar/openbazaar-go/mobile
726

8-
android_framework:
27+
.PHONY: android_framework
28+
android_framework: ## Build Android Framework for mobile
929
gomobile bind -target=android github.com/OpenBazaar/openbazaar-go/mobile
1030

1131
##
@@ -17,20 +37,57 @@ P_ANY = Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any
1737
PKGMAP = $(P_TIMESTAMP),$(P_ANY)
1838

1939
.PHONY: protos
20-
protos:
40+
protos: ## Build go files for proto definitions
2141
cd pb/protos && PATH=$(PATH):$(GOPATH)/bin protoc --go_out=$(PKGMAP):.. *.proto
2242

43+
44+
##
45+
## Testing
46+
##
47+
OPENBAZAARD_NAME ?= openbazaard-$(GIT_SHA)
48+
BITCOIND_PATH ?= .
49+
50+
.PHONY: openbazaard
51+
openbazaard: ## Build daemon
52+
$(info "Building openbazaar daemon...")
53+
go build -o ./$(OPENBAZAARD_NAME) .
54+
55+
.PHONY: qa_test
56+
qa_test: openbazaard ## Run QA test suite against current working copy
57+
$(info "Running QA... (openbazaard: ../$(OPENBAZAARD_NAME) bitcoind: $(BITCOIND_PATH)/bin/bitcoind)")
58+
(cd qa && ./runtests.sh ../$(OPENBAZAARD_NAME) $(BITCOIND_PATH)/bin/bitcoind)
59+
2360
##
2461
## Docker
2562
##
26-
DOCKER_PROFILE ?= openbazaar
27-
DOCKER_VERSION ?= $(shell git describe --tags --abbrev=0)
28-
DOCKER_IMAGE_NAME ?= $(DOCKER_PROFILE)/server:$(DOCKER_VERSION)
63+
PUBLIC_DOCKER_REGISTRY ?= openbazaar
64+
QA_DEV_TAG ?= 0.10
65+
66+
DOCKER_SERVER_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server:$(GIT_TAG)
67+
DOCKER_QA_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server-qa:$(QA_DEV_TAG)
68+
DOCKER_DEV_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server-dev:$(QA_DEV_TAG)
69+
70+
71+
.PHONY: docker_build
72+
docker_build: ## Build container for daemon
73+
docker build -t $(DOCKER_SERVER_IMAGE_NAME) .
74+
75+
.PHONY: docker_push
76+
docker_push: docker ## Push container for daemon
77+
docker push $(DOCKER_SERVER_IMAGE_NAME)
78+
79+
.PHONY: qa_docker_build
80+
qa_docker_build: ## Build container with QA test dependencies included
81+
docker build -t $(DOCKER_QA_IMAGE_NAME) -f ./Dockerfile.qa .
82+
83+
.PHONY: qa_docker_push
84+
qa_docker_push: qa_docker_build ## Push container for daemon QA test environment
85+
docker push $(DOCKER_QA_IMAGE_NAME)
2986

30-
.PHONY: docker
31-
docker:
32-
docker build -t $(DOCKER_IMAGE_NAME) .
87+
.PHONY: dev_docker_build
88+
dev_docker: ## Build container with dev dependencies included
89+
docker build -t $(DOCKER_DEV_IMAGE_NAME) -f ./Dockerfile.dev .
3390

34-
.PHONY: push_docker
35-
push_docker:
36-
docker push $(DOCKER_IMAGE_NAME)
91+
.PHONY: dev_docker_push
92+
dev_docker_push: dev_docker_build ## Push container for daemon dev environment
93+
docker push $(DOCKER_DEV_IMAGE_NAME)

qa/runtests.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ do
44
b=$(basename $SCRIPT)
55
extension="${b##*.}"
66
p="py"
7-
if [ $extension = $p ]
7+
if [[ $extension = $p ]]
88
then
99
python3 $SCRIPT -b $1 -d $2 $3
10+
ret=$?
11+
if [[ $ret -ne 0 ]]; then
12+
kill -1 $$
13+
fi
1014
fi
1115
done

0 commit comments

Comments
 (0)