2018-05-31 19:03:40 -07:00
version : 2
2018-03-20 16:55:55 -07:00
2018-12-19 09:02:56 -08:00
defaults : &linux_defaults
2018-03-20 16:55:55 -07:00
working_directory : /go/src/github.com/cosmos/cosmos-sdk
docker :
2019-01-31 17:20:58 -08:00
- image : circleci/golang:1.11.5
2018-03-20 16:55:55 -07:00
environment :
GOBIN : /tmp/workspace/bin
2018-12-19 09:02:56 -08:00
############
#
# 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 :
2019-01-31 17:20:58 -08:00
GO_VERSION : "1.11.5"
2018-12-19 09:02:56 -08:00
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 GOBIN=$GOPATH/bin' >> $BASH_ENV
echo 'export PATH=$PATH:$HOME/go/bin:$GOBIN' >> $BASH_ENV
############
#
# Configure docs deployment
2018-11-14 13:11:34 -08:00
docs_update : &docs_deploy
working_directory : ~/repo
docker :
2019-03-08 09:03:01 -08:00
- image : tendermintdev/jq_curl
2018-11-14 13:11:34 -08:00
environment :
AWS_REGION : us-east-1
2019-01-04 07:40:39 -08:00
deps : &dependencies
run :
name : dependencies
command : |
export PATH="$GOBIN:$PATH"
2019-01-22 12:16:29 -08:00
make vendor-deps
2018-06-30 16:32:52 -07:00
2019-01-04 07:40:39 -08:00
jobs :
2018-03-20 16:55:55 -07:00
setup_dependencies :
2018-12-19 09:02:56 -08:00
<< : *linux_defaults
2018-03-20 16:55:55 -07:00
steps :
- run : mkdir -p /tmp/workspace/bin
- run : mkdir -p /tmp/workspace/profiles
- checkout
- run :
name : tools
command : |
export PATH="$GOBIN:$PATH"
2018-12-20 10:03:59 -08:00
make tools
2019-01-04 07:40:39 -08:00
- *dependencies
2018-03-20 16:55:55 -07:00
- run :
name : binaries
command : |
export PATH="$GOBIN:$PATH"
2018-04-18 10:23:47 -07:00
make install
2018-03-20 16:55:55 -07:00
- persist_to_workspace :
root : /tmp/workspace
paths :
- bin
- profiles
2018-04-19 05:30:14 -07:00
lint :
2018-12-19 09:02:56 -08:00
<< : *linux_defaults
2018-06-22 13:58:48 -07:00
parallelism : 1
2018-04-19 05:30:14 -07:00
steps :
- attach_workspace :
at : /tmp/workspace
2018-08-21 14:01:17 -07:00
- checkout
2019-01-04 07:40:39 -08:00
- *dependencies
2018-06-13 11:02:08 -07:00
- run :
name : Get metalinter
command : |
export PATH="$GOBIN:$PATH"
2019-01-29 16:02:39 -08:00
make devtools-clean
2018-12-20 10:03:59 -08:00
make devtools
2018-04-19 05:30:14 -07:00
- run :
name : Lint source
command : |
export PATH="$GOBIN:$PATH"
2018-06-27 17:32:06 -07:00
make test_lint
2018-06-22 13:08:50 -07:00
2018-08-23 00:47:12 -07:00
integration_tests :
2018-12-19 09:02:56 -08:00
<< : *linux_defaults
2018-05-31 14:45:07 -07:00
parallelism : 1
steps :
- attach_workspace :
at : /tmp/workspace
2018-08-21 14:01:17 -07:00
- checkout
2019-01-04 07:40:39 -08:00
- *dependencies
2018-05-31 14:45:07 -07:00
- run :
name : Test cli
command : |
export PATH="$GOBIN:$PATH"
2018-07-02 21:33:53 -07:00
make test_cli
2018-08-22 10:17:15 -07:00
2018-08-17 07:19:33 -07:00
test_sim_gaia_nondeterminism :
2018-12-19 09:02:56 -08:00
<< : *linux_defaults
2018-08-17 07:19:33 -07:00
parallelism : 1
steps :
- attach_workspace :
at : /tmp/workspace
2018-08-21 14:01:17 -07:00
- checkout
2019-01-04 07:40:39 -08:00
- *dependencies
2018-08-17 07:19:33 -07:00
- run :
name : Test individual module simulations
command : |
export PATH="$GOBIN:$PATH"
make test_sim_gaia_nondeterminism
2018-08-16 08:36:15 -07:00
test_sim_gaia_fast :
2018-12-19 09:02:56 -08:00
<< : *linux_defaults
2018-08-16 08:36:15 -07:00
parallelism : 1
steps :
- attach_workspace :
at : /tmp/workspace
2018-08-21 14:01:17 -07:00
- checkout
2019-01-04 07:40:39 -08:00
- *dependencies
2018-08-16 08:36:15 -07:00
- run :
name : Test full Gaia simulation
command : |
export PATH="$GOBIN:$PATH"
make test_sim_gaia_fast
2018-07-11 13:44:21 -07:00
2018-11-08 16:28:28 -08:00
test_sim_gaia_import_export :
2018-12-19 09:02:56 -08:00
<< : *linux_defaults
2018-11-08 16:28:28 -08:00
parallelism : 1
steps :
- attach_workspace :
at : /tmp/workspace
- checkout
2019-01-04 07:40:39 -08:00
- *dependencies
2018-11-08 16:28:28 -08:00
- run :
name : Test Gaia import/export simulation
command : |
export PATH="$GOBIN:$PATH"
make test_sim_gaia_import_export
2018-11-26 04:21:23 -08:00
test_sim_gaia_simulation_after_import :
2018-12-19 09:02:56 -08:00
<< : *linux_defaults
2018-11-26 04:21:23 -08:00
parallelism : 1
steps :
- attach_workspace :
at : /tmp/workspace
- checkout
2019-01-04 07:40:39 -08:00
- *dependencies
2018-11-26 04:21:23 -08:00
- run :
name : Test Gaia import/export simulation
command : |
export PATH="$GOBIN:$PATH"
make test_sim_gaia_simulation_after_import
2019-01-04 07:40:39 -08:00
test_sim_gaia_multi_seed_long :
2018-12-19 09:02:56 -08:00
<< : *linux_defaults
2018-10-05 05:33:46 -07:00
parallelism : 1
steps :
- attach_workspace :
at : /tmp/workspace
- checkout
2019-01-04 07:40:39 -08:00
- *dependencies
2018-10-05 05:33:46 -07:00
- run :
2019-01-04 07:40:39 -08:00
name : Test multi-seed Gaia simulation long
2018-10-05 05:33:46 -07:00
command : |
export PATH="$GOBIN:$PATH"
2019-01-29 20:59:19 -08:00
scripts/multisim.sh 500 50 TestFullGaiaSimulation
2019-01-04 07:40:39 -08:00
test_sim_gaia_multi_seed :
<< : *linux_defaults
parallelism : 1
steps :
- attach_workspace :
at : /tmp/workspace
- checkout
- *dependencies
2018-10-05 05:33:46 -07:00
- run :
2019-01-04 07:40:39 -08:00
name : Test multi-seed Gaia simulation short
2018-10-05 05:33:46 -07:00
command : |
export PATH="$GOBIN:$PATH"
2019-01-04 07:40:39 -08:00
scripts/multisim.sh 50 10 TestFullGaiaSimulation
2018-10-05 05:33:46 -07:00
2018-03-20 16:55:55 -07:00
test_cover :
2018-12-19 09:02:56 -08:00
<< : *linux_defaults
2018-07-13 13:46:14 -07:00
parallelism : 4
2018-03-20 16:55:55 -07:00
steps :
- attach_workspace :
at : /tmp/workspace
2018-08-21 14:01:17 -07:00
- checkout
2019-01-04 07:40:39 -08:00
- *dependencies
2018-06-30 16:32:52 -07:00
- run : mkdir -p /tmp/logs
2018-03-20 16:55:55 -07:00
- run :
name : Run tests
command : |
2018-04-18 10:23:47 -07:00
export PATH="$GOBIN:$PATH"
2018-09-19 09:03:04 -07:00
export VERSION="$(git describe --tags --long | sed 's/v\(.*\)/\1/')"
2019-02-07 11:30:18 -08:00
for pkg in $(go list ./... | grep -v github.com/cosmos/cosmos-sdk/cmd/gaia/cli_test | grep -v '/simulation' | circleci tests split --split-by=timings); do
id=$(echo "$pkg" | sed 's|[/.]|_|g')
2019-02-08 12:45:23 -08:00
GOCACHE=off go test -timeout 8m -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic -tags='ledger test_ledger_mock' "$pkg" | tee "/tmp/logs/$id-$RANDOM.log"
2018-03-20 16:55:55 -07:00
done
- persist_to_workspace :
root : /tmp/workspace
paths :
- "profiles/*"
2018-06-30 16:32:52 -07:00
- store_artifacts :
path : /tmp/logs
2018-03-20 16:55:55 -07:00
upload_coverage :
2018-12-19 09:02:56 -08:00
<< : *linux_defaults
2018-06-29 20:34:55 -07:00
parallelism : 1
2018-03-20 16:55:55 -07:00
steps :
- attach_workspace :
at : /tmp/workspace
2018-08-21 14:01:17 -07:00
- checkout
2019-01-04 07:40:39 -08:00
- *dependencies
2018-03-20 16:55:55 -07:00
- run :
name : gather
command : |
set -ex
2019-02-07 11:30:18 -08:00
echo "--> Concatenating profiles:"
ls /tmp/workspace/profiles/
2018-03-20 16:55:55 -07:00
echo "mode: atomic" > coverage.txt
for prof in $(ls /tmp/workspace/profiles/); do
tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
done
2019-02-08 13:45:41 -08:00
- run :
name : filter out DONTCOVER
command : |
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER' | xargs realpath --relative-to=$GOPATH/src)"
for filename in ${excludelist}; do
echo "Excluding ${filename} ..."
sed -i "\%${filename}:%d" coverage.txt
done
2018-03-20 16:55:55 -07:00
- run :
name : upload
command : bash <(curl -s https://codecov.io/bash) -f coverage.txt
2018-08-16 11:23:57 -07:00
localnet :
working_directory : /home/circleci/.go_workspace/src/github.com/cosmos/cosmos-sdk
machine :
image : circleci/classic:latest
environment :
GOBIN : /home/circleci/.go_workspace/bin
GOPATH : /home/circleci/.go_workspace/
GOOS : linux
GOARCH : amd64
2019-01-31 17:20:58 -08:00
GO_VERSION : "1.11.5"
2018-08-16 11:23:57 -07:00
parallelism : 1
steps :
- checkout
- run :
name : run localnet and exit on failure
command : |
2018-10-04 06:59:04 -07:00
pushd /tmp
2018-12-19 11:41:59 -08:00
wget https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz
sudo tar -xvf go$GO_VERSION.linux-amd64.tar.gz
2018-10-04 06:59:04 -07:00
sudo rm -rf /usr/local/go
sudo mv go /usr/local
popd
2018-08-16 11:23:57 -07:00
set -x
2018-12-20 10:03:59 -08:00
make tools
2019-01-22 12:16:29 -08:00
make vendor-deps
2018-08-16 11:23:57 -07:00
make build-linux
make localnet-start
./scripts/localnet-blocks-test.sh 40 5 10 localhost
2019-01-14 11:04:28 -08:00
2018-11-14 13:11:34 -08:00
deploy_docs :
<< : *docs_deploy
steps :
- checkout
- run :
name : Trigger website build
command : |
2019-03-08 09:03:01 -08:00
curl --silent \
--show-error \
-X POST \
--header "Content-Type: application/json" \
-d "{\"branch\": \"$CIRCLE_BRANCH\"}" \
"https://circleci.com/api/v1.1/project/github/$CIRCLE_PROJECT_USERNAME/$WEBSITE_REPO_NAME/build?circle-token=$TENDERBOT_API_TOKEN" > response.json
RESULT=`jq -r '.status' response.json`
MESSAGE=`jq -r '.message' response.json`
if [[ ${RESULT} == "null" ]] || [[ ${RESULT} -ne "200" ]]; then
echo "CircleCI API call failed: $MESSAGE"
exit 1
else
echo "Website build started"
fi
2018-08-16 11:23:57 -07:00
2018-12-19 09:02:56 -08:00
macos_ci :
<< : *macos_defaults
steps :
- *macos_env
- run :
name : Install go
command : |
source $BASH_ENV
curl -L -O https://dl.google.com/go/go$GO_VERSION.darwin-amd64.tar.gz
tar -C $HOME -xzf go$GO_VERSION.darwin-amd64.tar.gz
rm go$GO_VERSION.darwin-amd64.tar.gz
go version
- checkout
- run :
name : Install SDK
command : |
source $BASH_ENV
2018-12-20 11:46:37 -08:00
make tools
2019-01-22 12:16:29 -08:00
make vendor-deps
2018-12-19 09:02:56 -08:00
make install
- run :
name : Integration tests
command :
source $BASH_ENV
make test_cli
- run :
name : Test full gaia simulation
command : |
source $BASH_ENV
make test_sim_gaia_fast
2019-01-14 11:04:28 -08:00
docker_image :
<< : *linux_defaults
steps :
- attach_workspace :
at : /tmp/workspace
- checkout
- setup_remote_docker :
docker_layer_caching : true
- run : |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
GAIAD_VERSION="stable"
elif [ "${CIRCLE_BRANCH}" == "develop" ]; then
GAIAD_VERSION="develop"
fi
docker build -t tendermint/gaia:$GAIAD_VERSION .
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push tendermint/gaia:$GAIAD_VERSION
2019-02-25 07:53:26 -08:00
docker_tagged :
<< : *linux_defaults
steps :
- attach_workspace :
at : /tmp/workspace
- checkout
- setup_remote_docker :
docker_layer_caching : true
- run : |
docker build -t tendermint/gaia:$CIRCLE_TAG .
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push tendermint/gaia:$CIRCLE_TAG
2019-02-19 10:19:32 -08:00
2018-03-20 16:55:55 -07:00
workflows :
version : 2
test-suite :
jobs :
2019-01-14 11:04:28 -08:00
- docker_image :
filters :
branches :
only :
- master
- develop
requires :
- setup_dependencies
2019-02-25 07:53:26 -08:00
- docker_tagged :
filters :
tags :
only :
- /^v.*/
branches :
ignore :
- /.*/
requires :
- setup_dependencies
2018-12-19 09:02:56 -08:00
- macos_ci :
filters :
branches :
only :
- master
- develop
2018-11-30 07:15:04 -08:00
- deploy_docs :
filters :
branches :
only :
- master
- develop
2019-03-11 10:23:09 -07:00
- setup_dependencies :
# filters here are needed to enable this job also for tags
filters :
tags :
only :
- /^v.*/
2018-04-19 05:30:14 -07:00
- lint :
requires :
- setup_dependencies
2018-08-23 00:47:12 -07:00
- integration_tests :
2018-05-02 20:07:05 -07:00
requires :
- setup_dependencies
2018-08-17 07:19:33 -07:00
- test_sim_gaia_nondeterminism :
requires :
- setup_dependencies
2018-08-16 08:36:15 -07:00
- test_sim_gaia_fast :
2018-07-11 13:44:21 -07:00
requires :
- setup_dependencies
2018-11-08 16:28:28 -08:00
- test_sim_gaia_import_export :
requires :
- setup_dependencies
2018-11-26 04:21:23 -08:00
- test_sim_gaia_simulation_after_import :
requires :
- setup_dependencies
2018-10-05 05:41:12 -07:00
- test_sim_gaia_multi_seed :
requires :
- setup_dependencies
2019-01-04 07:40:39 -08:00
- test_sim_gaia_multi_seed_long :
requires :
- setup_dependencies
filters :
branches :
only :
- master
- develop
2018-03-20 16:55:55 -07:00
- test_cover :
requires :
- setup_dependencies
2019-02-06 15:25:47 -08:00
- localnet
2018-03-20 16:55:55 -07:00
- upload_coverage :
requires :
- test_cover