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

(#1892) QA Runner improvements for use in CI #1910

Merged
merged 8 commits into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
FROM golang:1.11
VOLUME /var/lib/openbazaar

RUN wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \
tar xvf Python-3.6.0.tgz && \
cd Python-3.6.0 && \
./configure --enable-optimizations && \
make -j8
RUN apt-get update && apt-get install -yq zlib1g-dev libssl-dev unzip
RUN cd Python-3.6.0 && \
make altinstall && \
ln -s /usr/local/bin/python3.6 /usr/local/bin/python3

COPY ./qa/requirements.txt ./requirements.txt

RUN pip3.6 install --upgrade pip && \
pip3.6 install -r requirements.txt && \
wget https://bitcoin.org/bin/bitcoin-core-0.16.3/bitcoin-0.16.3-x86_64-linux-gnu.tar.gz && \
tar -xvzf bitcoin-0.16.3-x86_64-linux-gnu.tar.gz -C /opt

RUN wget https://github.com/google/protobuf/releases/download/v3.6.0/protoc-3.6.0-linux-x86_64.zip && \
unzip ./protoc-3.6.0-linux-x86_64.zip -x readme.txt && \
mv ./include/* /usr/local/include/ && \
mv ./bin/protoc /usr/local/bin/ && \
rm -rf ./include ./bin
FROM docker.dev.ob1.io/openbazaar-qa:0.10
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 very nice
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if anyone not authenticated against our registry will be able to pull this image.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. @tyler-smith ?


RUN go get -u github.com/gogo/protobuf/proto \
github.com/golang/protobuf/protoc-gen-go \
Expand Down
34 changes: 34 additions & 0 deletions Dockerfile.qa
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM golang:1.11

ENV BITCOIND_VERSION=0.16.3
ENV BITCOIND_PATH=/opt/bitcoin-${BITCOIND_VERSION}

# software installs, from most stable to most volatile
RUN apt-get update -y
RUN apt-get install -yq software-properties-common \
zlib1g-dev \
libssl-dev \
unzip \
python3 \
python3-pip

RUN wget https://github.com/google/protobuf/releases/download/v3.6.0/protoc-3.6.0-linux-x86_64.zip && \
unzip ./protoc-3.6.0-linux-x86_64.zip -x readme.txt && \
mv ./include/* /usr/local/include/ && \
mv ./bin/protoc /usr/local/bin/ && \
rm -rf ./include ./bin

COPY ./qa/requirements.txt ./requirements.txt

RUN python3 -m pip install --upgrade pip && \
pip install -r ./requirements.txt && \
wget https://bitcoin.org/bin/bitcoin-core-0.16.3/bitcoin-${BITCOIND_VERSION}-x86_64-linux-gnu.tar.gz && \
tar -xvzf bitcoin-${BITCOIND_VERSION}-x86_64-linux-gnu.tar.gz -C /opt

WORKDIR /go/src/github.com/OpenBazaar/openbazaar-go

COPY ./Makefile ./Makefile

VOLUME /go/src/github.com/OpenBazaar/openbazaar-go

CMD make qa
47 changes: 43 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
GIT_SHA ?= $(shell git rev-parse --short=8 HEAD)
GIT_TAG ?= $(shell git describe --tags --abbrev=0)

##
## Building
##

.PHONY: ios_framework
ios_framework:
gomobile bind -target=ios github.com/OpenBazaar/openbazaar-go/mobile

.PHONY: android_framework
android_framework:
gomobile bind -target=android github.com/OpenBazaar/openbazaar-go/mobile

Expand All @@ -20,17 +25,51 @@ PKGMAP = $(P_TIMESTAMP),$(P_ANY)
protos:
cd pb/protos && PATH=$(PATH):$(GOPATH)/bin protoc --go_out=$(PKGMAP):.. *.proto


##
## Testing
##

OPENBAZAARD_NAME ?= openbazaard-$(GIT_TAG)-$(GIT_SHA)
BITCOIND_PATH ?= .

.PHONY: openbazaard
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a phony make target.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was concerned that the build output makes an openbazaard-<GITTAG>-<GITSHA> file... not openbazaard. Does that matter? (Not a makefile expert.)

openbazaard:
$(info "Building openbazaar daemon...")
go build -o ./$(OPENBAZAARD_NAME) .

.PHONY: qa
qa: openbazaard
$(info "Running QA... (openbazaard: ../$(OPENBAZAARD_NAME) bitcoind: $(BITCOIND_PATH)/bin/bitcoind)")
(cd qa && ./runtests.sh ../$(OPENBAZAARD_NAME) $(BITCOIND_PATH)/bin/bitcoind)

##
## Docker
##
DOCKER_PROFILE ?= openbazaar
DOCKER_VERSION ?= $(shell git describe --tags --abbrev=0)
DOCKER_IMAGE_NAME ?= $(DOCKER_PROFILE)/server:$(DOCKER_VERSION)
PUBLIC_DOCKER_REGISTRY ?= openbazaar
OB_DOCKER_REGISTRY ?= docker.dev.ob1.io

DOCKER_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY_PROFILE)/server:$(GIT_TAG)
DOCKER_QA_IMAGE_NAME ?= $(OB_DOCKER_REGISTRY)/openbazaar-qa:$(GIT_SHA)
DOCKER_DEV_IMAGE_NAME ?= openbazaar-dev:$(GIT_SHA)


.PHONY: docker
docker:
docker build -t $(DOCKER_IMAGE_NAME) .

.PHONY: push_docker
push_docker:
push_docker: docker
docker push $(DOCKER_IMAGE_NAME)

.PHONY: qa_docker
qa_docker:
docker build -t $(DOCKER_QA_IMAGE_NAME) -f ./Dockerfile.qa .

.PHONY: push_qa_docker
push_qa_docker: qa_docker
docker push $(DOCKER_QA_IMAGE_NAME)

.PHONY: dev_docker
dev_docker:
docker build -t $(DOCKER_DEV_IMAGE_NAME) -f ./Dockerfile.dev .
6 changes: 5 additions & 1 deletion qa/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ do
b=$(basename $SCRIPT)
extension="${b##*.}"
p="py"
if [ $extension = $p ]
if [[ $extension = $p ]]
then
python3 $SCRIPT -b $1 -d $2 $3
ret=$?
if [[ $ret -ne 0 ]]; then
kill -1 $$
fi
fi
done