diff --git a/.circleci/config.yml b/.circleci/config.yml index 41e3fc3781e024317dfc006e2839c5b29424a1c5..41554074416f5332957b66d22b43eef4a2885256 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,6 +31,12 @@ jobs: - run: sudo apt-get install libgmp3-dev - run: make test_integration + test_integration_bosmarmot: + <<: *defaults + steps: + - checkout + - run: make test_integration_bosmarmot + ensure_vendor: <<: *defaults steps: @@ -90,6 +96,10 @@ workflows: filters: <<: *tags_filters + - test_integration_bosmarmot: + filters: + <<: *tags_filters + - ensure_vendor: filters: <<: *tags_filters @@ -108,6 +118,7 @@ workflows: requires: - test - test_integration + - test_integration_bosmarmot - test_docker_smoke filters: # tags filters and branch filters are applied disjunctively, so we diff --git a/.gitignore b/.gitignore index 1c2ed57405385ad2aa2a0115ec96f019440a8d90..8dc689c1a6c46aa74e5cb936cf58d99f8b8dc689 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ test_scratch/ debug .idea .vscode + +.gopath_bos \ No newline at end of file diff --git a/Makefile b/Makefile index b6670e8be2eb884ef5f5eb56394fa3f6b16719d8..eb07a164ecd101f16cee9cfe40003552ab7b4cb8 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,10 @@ SHELL := /bin/bash REPO := $(shell pwd) GOFILES_NOVENDOR := $(shell find ${REPO} -type f -name '*.go' -not -path "${REPO}/vendor/*") PACKAGES_NOVENDOR := $(shell go list ./... | grep -vF /vendor/) -COMMIT_SHA := $(shell echo `git rev-parse --short --verify HEAD`) +# Bosmarmot integration testing +BOSMARMOT_PROJECT := github.com/monax/bosmarmot +BOSMARMOT_GOPATH := ${REPO}/.gopath_bos +BOSMARMOT_CHECKOUT := ${BOSMARMOT_GOPATH}/src/${BOSMARMOT_PROJECT} DOCKER_NAMESPACE := quay.io/monax @@ -91,27 +94,36 @@ build: check build_db build_client # build all targets in github.com/hyperledger/burrow with checks for race conditions .PHONY: build_race -build_race: check build_race_db build_race_client build_race_keys +build_race: check build_race_db build_race_clien # build burrow .PHONY: build_db build_db: - go build -o ${REPO}/target/burrow-${COMMIT_SHA} ./cmd/burrow + go build -o ${REPO}/bin/burrow ./cmd/burrow # build burrow-client .PHONY: build_client build_client: - go build -o ${REPO}/target/burrow-client-${COMMIT_SHA} ./client/cmd/burrow-client + go build -o ${REPO}/bin/burrow-client ./client/cmd/burrow-client # build burrow with checks for race conditions .PHONY: build_race_db build_race_db: - go build -race -o ${REPO}/target/burrow-${COMMIT_SHA} ./cmd/burrow + go build -race -o ${REPO}/bin/burrow ./cmd/burrow # build burrow-client with checks for race conditions .PHONY: build_race_client build_race_client: - go build -race -o ${REPO}/target/burrow-client-${COMMIT_SHA} ./client/cmd/burrow-client + go build -race -o ${REPO}/bin/burrow-client ./client/cmd/burrow-client + + +# Get the Bosmarmot code +.PHONY: bos +bos: ./scripts/deps/bos.sh + scripts/git_get_revision.sh \ + https://${BOSMARMOT_PROJECT}.git \ + ${BOSMARMOT_CHECKOUT} \ + $(shell ./scripts/deps/bos.sh) ### Build docker images for github.com/hyperledger/burrow @@ -133,6 +145,16 @@ test_integration: @go test ./keys/integration -tags integration @go test ./rpc/tm/integration -tags integration +# Run integration test from bosmarmot (separated from other integration tests so we can +# make exception when this test fails when we make a breaking change in Burrow) +.PHONY: test_integration_bosmarmot +test_integration_bosmarmot: bos build_db + cd "${BOSMARMOT_CHECKOUT}" &&\ + GOPATH="${BOSMARMOT_GOPATH}" \ + burrow_bin="${REPO}/bin/burrow" \ + make test_integration_no_burrow + + # test burrow with checks for race conditions .PHONY: test_race test_race: build_race @@ -143,7 +165,7 @@ test_race: build_race # clean removes the target folder containing build artefacts .PHONY: clean clean: - -rm -r ./target + -rm -r ./bin ### Release and versioning diff --git a/scripts/deps/README.md b/scripts/deps/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e76da3f3fa9a38656a99b91b2de9cf8993f9a42d --- /dev/null +++ b/scripts/deps/README.md @@ -0,0 +1,4 @@ +## deps +This directory contains reference objects for various non-go dependencies of Bosmarmot + (typically for integration tests). Files can return a pointer to the object or fetch the dependency + themselves based on arguments. diff --git a/scripts/deps/bos.sh b/scripts/deps/bos.sh new file mode 100755 index 0000000000000000000000000000000000000000..71546865e0eebea444736af83e2ed337430d4a6b --- /dev/null +++ b/scripts/deps/bos.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# The git revision of Bosmarmot/bos we will build and install into ./bin/ for integration tests +echo "37de30c0d29ddc6960a3aa285607fe5939071a78" diff --git a/scripts/git_get_revision.sh b/scripts/git_get_revision.sh new file mode 100755 index 0000000000000000000000000000000000000000..5cb7b64dd5b04942026bbaa7a618cb19202bc2f2 --- /dev/null +++ b/scripts/git_get_revision.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Gives us a non-zero exit code if there are tracked or untracked changes in the working +# directory +REPO="$1" +PROJECT_PATH="$2" +REVISION="$3" + +# Do initial checkout if it doesn't exist +$(cd "$PROJECT_PATH" 2> /dev/null) || git clone ${REPO} ${PROJECT_PATH} +pushd "$PROJECT_PATH" +# Attempt to checkout the specified revision +git fetch --all +git checkout ${REVISION} +popd