Merge PR #119: Upgrade go to 1.13 & Latest SDK Master

This commit is contained in:
Alexander Bezobchuk
2019-09-10 14:56:58 -04:00
committed by GitHub
parent d624ca1980
commit 6fa5988730
15 changed files with 460 additions and 608 deletions

View File

@@ -1,198 +1,161 @@
version: 2
version: 2.1
defaults: &linux_defaults
working_directory: /go/src/github.com/cosmos/gaia
docker:
- image: circleci/golang:1.12
environment:
GO111MODULE: 'on'
executors:
golang:
docker:
- image: circleci/golang:1.13
working_directory: /go/src/github.com/cosmos/cosmos-sdk
mac:
macos:
xcode: "10.3.0"
working_directory: /Users/distiller/project/src/github.com/cosmos/cosmos-sdk
environment:
GO_VERSION: "1.13"
docs:
docker:
- image: tendermintdev/jq_curl
environment:
AWS_REGION: us-east-1
############
#
# Configure macos integration tests
macos_config: &macos_defaults
macos:
xcode: "10.1.0"
working_directory: /Users/distiller/project/src/github.com/cosmos/cosmos-sdk
environment:
GO_VERSION: "1.12.5"
set_macos_env: &macos_env
run:
name: Set environment
command: |
echo 'export PATH=$PATH:$HOME/go/bin' >> $BASH_ENV
echo 'export GOPATH=$HOME/project' >> $BASH_ENV
echo 'export PATH=$PATH:$HOME/go/bin:$GOPATH/bin' >> $BASH_ENV
echo 'export GO111MODULE=on'
############
#
# Configure docs deployment
docs_update: &docs_deploy
working_directory: ~/repo
docker:
- image: tendermintdev/jq_curl
environment:
AWS_REGION: us-east-1
commands:
make:
parameters:
description:
type: string
target:
type: string
steps:
- attach_workspace:
at: /tmp/bin
- restore_cache:
name: "Restore source code cache"
keys:
- go-src-v1-{{ .Revision }}
- checkout
- restore_cache:
name: "Restore go modules cache"
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: << parameters.description >>
command: |
export BINDIR=/tmp/bin
make << parameters.target >>
mac_set_env:
steps:
- run:
name: "Set environment"
command: |
echo 'export PATH=$PATH:$HOME/go/bin' >> $BASH_ENV
echo 'export GOPATH=$HOME/project' >> $BASH_ENV
echo 'export PATH=$PATH:$HOME/go/bin:$GOPATH/bin' >> $BASH_ENV
echo 'export GO111MODULE=on'
jobs:
setup_dependencies:
<<: *linux_defaults
executor: golang
steps:
- run: mkdir -p /tmp/workspace/bin
- run: mkdir -p /tmp/workspace/profiles
- checkout
- restore_cache:
name: "Restore go modules cache"
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: binaries
name: Cache go modules
command: make go-mod-cache
- run:
name: Build
command: make build
- run:
name: "Git garbage collection"
command: git gc
- run:
name: "Build tools binaries"
command: |
export PATH=/tmp/workspace/bin:$PATH
make go-mod-cache
make install
make tools
- save_cache:
name: "Save go modules cache"
key: go-mod-v1-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod"
- run:
name: tools
command: |
make tools TOOLS_DESTDIR=/tmp/workspace/bin
cp $GOPATH/bin/runsim /tmp/workspace/bin/
- persist_to_workspace:
root: /tmp/workspace
- save_cache:
name: "Save source code cache"
key: go-src-v1-{{ .Revision }}
paths:
- bin
- profiles
- ".git"
- run:
command: |
mkdir -p /tmp/bin
cp -r /go/bin/* /tmp/bin
- persist_to_workspace:
root: "/tmp/bin"
paths:
- "."
test_sim_nondeterminism:
executor: golang
steps:
- make:
target: test_sim_nondeterminism
description: "Test Gaia non-determinism simulations"
test_sim_import_export:
executor: golang
steps:
- make:
target: test_sim_import_export
description: "Test Gaia import/export simulation"
test_sim_after_import:
executor: golang
steps:
- make:
target: test_sim_after_import
description: "Test Gaia simulation after importing state"
test_sim_multi_seed_short:
executor: golang
steps:
- make:
target: test_sim_multi_seed_short
description: "Test Gaia multi-seed simulation (short-lived)"
test_sim_multi_seed_long:
executor: golang
steps:
- make:
target: test_sim_multi_seed_long
description: "Test Gaia multi-seed simulation (long-lived)"
integration_tests:
<<: *linux_defaults
parallelism: 1
executor: golang
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: Test cli
name: Test CLI integration
command: |
export BUILDDIR=`pwd`/build
make check-build
test_sim_gaia_nondeterminism:
<<: *linux_defaults
parallelism: 1
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: Test individual module simulations
command: |
make sim-gaia-nondeterminism
test_sim_gaia_fast:
<<: *linux_defaults
parallelism: 1
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: Test full Gaia simulation
command: |
make sim-gaia-fast
test_sim_gaia_import_export:
<<: *linux_defaults
parallelism: 1
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: Test Gaia import/export simulation
command: |
/tmp/workspace/bin/runsim -j 4 github.com/cosmos/gaia/app 50 5 TestGaiaImportExport
test_sim_gaia_simulation_after_import:
<<: *linux_defaults
parallelism: 1
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: Test Gaia import/export simulation
command: |
/tmp/workspace/bin/runsim -j 4 github.com/cosmos/gaia/app 50 5 TestGaiaSimulationAfterImport
test_sim_gaia_multi_seed_long:
<<: *linux_defaults
parallelism: 1
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: Test multi-seed Gaia simulation long
command: |
/tmp/workspace/bin/runsim -j 4 github.com/cosmos/gaia/app 500 50 TestFullGaiaSimulation
test_sim_gaia_multi_seed:
<<: *linux_defaults
parallelism: 1
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: Test multi-seed Gaia simulation short
command: |
/tmp/workspace/bin/runsim -j 4 github.com/cosmos/gaia/app 50 10 TestFullGaiaSimulation
test_cover:
<<: *linux_defaults
executor: golang
parallelism: 4
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run: mkdir -p /tmp/logs
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: Run tests
name: Run tests with coverage
command: |
export VERSION="$(git describe --tags --long | sed 's/v\(.*\)/\1/')"
export GO111MODULE=on
for pkg in $(go list ./... | grep -v github.com/cosmos/gaia/cli_test | grep -v '/simulation' | circleci tests split --split-by=timings); do
mkdir -p /tmp/logs /tmp/workspace/profiles
for pkg in $(go list ./... | grep -v '/simulation' | circleci tests split); do
id=$(echo "$pkg" | sed 's|[/.]|_|g')
go test -mod=readonly -timeout 8m -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic -tags='ledger test_ledger_mock' "$pkg" | tee "/tmp/logs/$id-$RANDOM.log"
done
@@ -204,8 +167,7 @@ jobs:
path: /tmp/logs
upload_coverage:
<<: *linux_defaults
parallelism: 1
executor: golang
steps:
- attach_workspace:
at: /tmp/workspace
@@ -224,44 +186,45 @@ jobs:
- run:
name: filter out DONTCOVER
command: |
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER' | xargs realpath --relative-to=$GOPATH/src)"
excludelist="$(find . -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
for filename in ${excludelist}; do
echo "Excluding ${filename} ..."
sed -i "\%${filename}:%d" coverage.txt
filename=$(echo $filename | sed 's/^./github.com\/cosmos\/gaia/g')
echo "Excluding ${filename} from coverage report..."
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
done
- run:
name: upload
command: bash <(curl -s https://codecov.io/bash) -f coverage.txt
localnet:
working_directory: /home/circleci/.go_workspace/src/github.com/cosmos/cosmos-sdk
machine:
image: circleci/classic:latest
environment:
GOPATH: /home/circleci/.go_workspace/
GOOS: linux
GOARCH: amd64
GO_VERSION: "1.12.5"
parallelism: 1
steps:
- checkout
- run:
name: run localnet and exit on failure
command: |
pushd /tmp
wget https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz
sudo tar -xvf go$GO_VERSION.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo mv go /usr/local
popd
set -x
make tools
make build-linux
make localnet-start
./contrib/localnet-blocks-test.sh 40 5 10 localhost
working_directory: /home/circleci/.go_workspace/src/github.com/cosmos/gaia
machine:
image: circleci/classic:latest
environment:
GOPATH: /home/circleci/.go_workspace/
GOOS: linux
GOARCH: amd64
GO_VERSION: "1.13"
parallelism: 1
steps:
- checkout
- run:
name: run localnet and exit on failure
command: |
pushd /tmp
wget https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz
sudo tar -xvf go$GO_VERSION.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo mv go /usr/local
popd
set -x
make tools
make build-linux
make localnet-start
./contrib/localnet-blocks-test.sh 40 5 10 localhost
deploy_docs:
<<: *docs_deploy
executor: docs
steps:
- checkout
- run:
@@ -285,9 +248,9 @@ jobs:
fi
macos_ci:
<<: *macos_defaults
executor: mac
steps:
- *macos_env
- mac_set_env
- run:
name: Install go
command: |
@@ -305,8 +268,7 @@ jobs:
make install
- run:
name: Integration tests
command:
source $BASH_ENV
command: source $BASH_ENV
make check-build
- run:
name: Test full gaia simulation
@@ -315,7 +277,7 @@ jobs:
make sim-gaia-fast
docker_image:
<<: *linux_defaults
executor: golang
steps:
- attach_workspace:
at: /tmp/workspace
@@ -333,12 +295,12 @@ jobs:
docker build .
else
docker build -t tendermint/gaia:$GAIAD_VERSION .
docker login --password-stdin -u $DOCKER_USER <<<$DOCKER_PASS
docker login --password-stdin -u $DOCKER_USER \<<<$DOCKER_PASS
docker push tendermint/gaia:$GAIAD_VERSION
fi
docker_tagged:
<<: *linux_defaults
executor: golang
steps:
- attach_workspace:
at: /tmp/workspace
@@ -347,11 +309,11 @@ jobs:
docker_layer_caching: true
- run: |
docker build -t tendermint/gaia:$CIRCLE_TAG .
docker login --password-stdin -u $DOCKER_USER <<<$DOCKER_PASS
docker login --password-stdin -u $DOCKER_USER \<<$DOCKER_PASS
docker push tendermint/gaia:$CIRCLE_TAG
reproducible_builds:
<<: *linux_defaults
executor: golang
steps:
- attach_workspace:
at: /tmp/workspace
@@ -379,7 +341,7 @@ jobs:
# overrides the .gaiad directory.
#
# contract_tests:
# <<: *linux_defaults
# executor: golang
# steps:
# - attach_workspace:
# at: /tmp/workspace
@@ -434,29 +396,28 @@ workflows:
- integration_tests:
requires:
- setup_dependencies
- test_sim_gaia_nondeterminism:
- test_sim_nondeterminism:
requires:
- setup_dependencies
- test_sim_gaia_fast:
- test_sim_import_export:
requires:
- setup_dependencies
- test_sim_gaia_import_export:
- test_sim_after_import:
requires:
- setup_dependencies
- test_sim_gaia_simulation_after_import:
- test_sim_multi_seed_short:
requires:
- setup_dependencies
- test_sim_gaia_multi_seed:
requires:
- setup_dependencies
- test_sim_gaia_multi_seed_long:
- test_sim_multi_seed_long:
requires:
- setup_dependencies
# These filters ensure that the long sim only runs during release
filters:
branches:
ignore: /.*/
tags:
only:
- master
- develop
- /^v.*/
- test_cover:
requires:
- setup_dependencies