470 lines
12 KiB
YAML
470 lines
12 KiB
YAML
version: 2
|
|
|
|
defaults: &linux_defaults
|
|
working_directory: /go/src/github.com/cosmos/cosmos-sdk
|
|
docker:
|
|
- image: circleci/golang:1.12.4
|
|
environment:
|
|
GOBIN: /tmp/workspace/bin
|
|
|
|
|
|
############
|
|
#
|
|
# 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.4"
|
|
|
|
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
|
|
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
|
|
|
|
deps: &dependencies
|
|
run:
|
|
name: dependencies
|
|
command: |
|
|
export PATH="$GOBIN:$PATH"
|
|
|
|
jobs:
|
|
setup_dependencies:
|
|
<<: *linux_defaults
|
|
steps:
|
|
- run: mkdir -p /tmp/workspace/bin
|
|
- run: mkdir -p /tmp/workspace/profiles
|
|
- checkout
|
|
- restore_cache:
|
|
keys:
|
|
- go-mod-v1-{{ checksum "go.sum" }}
|
|
- run:
|
|
name: tools
|
|
command: |
|
|
export PATH="$GOBIN:$PATH"
|
|
make tools
|
|
- *dependencies
|
|
- run:
|
|
name: binaries
|
|
command: |
|
|
export PATH="$GOBIN:$PATH"
|
|
make go-mod-cache
|
|
make install
|
|
- save_cache:
|
|
key: go-mod-v1-{{ checksum "go.sum" }}
|
|
paths:
|
|
- "/go/pkg/mod"
|
|
- persist_to_workspace:
|
|
root: /tmp/workspace
|
|
paths:
|
|
- bin
|
|
- profiles
|
|
|
|
lint:
|
|
<<: *linux_defaults
|
|
parallelism: 1
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/workspace
|
|
- checkout
|
|
- *dependencies
|
|
- restore_cache:
|
|
keys:
|
|
- go-mod-v1-{{ checksum "go.sum" }}
|
|
- run:
|
|
name: Lint source
|
|
command: |
|
|
export PATH="$GOBIN:$PATH"
|
|
make ci-lint
|
|
|
|
integration_tests:
|
|
<<: *linux_defaults
|
|
parallelism: 1
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/workspace
|
|
- checkout
|
|
- *dependencies
|
|
- restore_cache:
|
|
keys:
|
|
- go-mod-v1-{{ checksum "go.sum" }}
|
|
- run:
|
|
name: Test cli
|
|
command: |
|
|
export PATH="$GOBIN:$PATH"
|
|
make test_cli
|
|
|
|
test_sim_gaia_nondeterminism:
|
|
<<: *linux_defaults
|
|
parallelism: 1
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/workspace
|
|
- checkout
|
|
- *dependencies
|
|
- restore_cache:
|
|
keys:
|
|
- go-mod-v1-{{ checksum "go.sum" }}
|
|
- run:
|
|
name: Test individual module simulations
|
|
command: |
|
|
export PATH="$GOBIN:$PATH"
|
|
make test_sim_gaia_nondeterminism
|
|
|
|
test_sim_gaia_fast:
|
|
<<: *linux_defaults
|
|
parallelism: 1
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/workspace
|
|
- checkout
|
|
- *dependencies
|
|
- restore_cache:
|
|
keys:
|
|
- go-mod-v1-{{ checksum "go.sum" }}
|
|
- run:
|
|
name: Test full Gaia simulation
|
|
command: |
|
|
export PATH="$GOBIN:$PATH"
|
|
make test_sim_gaia_fast
|
|
|
|
test_sim_gaia_import_export:
|
|
<<: *linux_defaults
|
|
parallelism: 1
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/workspace
|
|
- checkout
|
|
- *dependencies
|
|
- restore_cache:
|
|
keys:
|
|
- go-mod-v1-{{ checksum "go.sum" }}
|
|
- run:
|
|
name: Test Gaia import/export simulation
|
|
command: |
|
|
export PATH="$GOBIN:$PATH"
|
|
make test_sim_gaia_import_export
|
|
|
|
test_sim_gaia_simulation_after_import:
|
|
<<: *linux_defaults
|
|
parallelism: 1
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/workspace
|
|
- checkout
|
|
- *dependencies
|
|
- restore_cache:
|
|
keys:
|
|
- go-mod-v1-{{ checksum "go.sum" }}
|
|
- run:
|
|
name: Test Gaia import/export simulation
|
|
command: |
|
|
export PATH="$GOBIN:$PATH"
|
|
make test_sim_gaia_simulation_after_import
|
|
|
|
test_sim_gaia_multi_seed_long:
|
|
<<: *linux_defaults
|
|
parallelism: 1
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/workspace
|
|
- checkout
|
|
- *dependencies
|
|
- restore_cache:
|
|
keys:
|
|
- go-mod-v1-{{ checksum "go.sum" }}
|
|
- run:
|
|
name: Test multi-seed Gaia simulation long
|
|
command: |
|
|
export PATH="$GOBIN:$PATH"
|
|
export GO111MODULE=on
|
|
make runsim
|
|
runsim 500 50 TestFullGaiaSimulation
|
|
|
|
test_sim_gaia_multi_seed:
|
|
<<: *linux_defaults
|
|
parallelism: 1
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/workspace
|
|
- checkout
|
|
- *dependencies
|
|
- restore_cache:
|
|
keys:
|
|
- go-mod-v1-{{ checksum "go.sum" }}
|
|
- run:
|
|
name: Test multi-seed Gaia simulation short
|
|
command: |
|
|
export PATH="$GOBIN:$PATH"
|
|
export GO111MODULE=on
|
|
make runsim
|
|
runsim 50 10 TestFullGaiaSimulation
|
|
|
|
test_cover:
|
|
<<: *linux_defaults
|
|
parallelism: 4
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/workspace
|
|
- checkout
|
|
- *dependencies
|
|
- run: mkdir -p /tmp/logs
|
|
- restore_cache:
|
|
keys:
|
|
- go-mod-v1-{{ checksum "go.sum" }}
|
|
- run:
|
|
name: Run tests
|
|
command: |
|
|
export PATH="$GOBIN:$PATH"
|
|
export VERSION="$(git describe --tags --long | sed 's/v\(.*\)/\1/')"
|
|
export GO111MODULE=on
|
|
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')
|
|
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
|
|
- persist_to_workspace:
|
|
root: /tmp/workspace
|
|
paths:
|
|
- "profiles/*"
|
|
- store_artifacts:
|
|
path: /tmp/logs
|
|
|
|
upload_coverage:
|
|
<<: *linux_defaults
|
|
parallelism: 1
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/workspace
|
|
- checkout
|
|
- *dependencies
|
|
- run:
|
|
name: gather
|
|
command: |
|
|
set -ex
|
|
|
|
echo "--> Concatenating profiles:"
|
|
ls /tmp/workspace/profiles/
|
|
echo "mode: atomic" > coverage.txt
|
|
for prof in $(ls /tmp/workspace/profiles/); do
|
|
tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
|
|
done
|
|
- 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
|
|
- 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:
|
|
GOBIN: /home/circleci/.go_workspace/bin
|
|
GOPATH: /home/circleci/.go_workspace/
|
|
GOOS: linux
|
|
GOARCH: amd64
|
|
GO_VERSION: "1.12.4"
|
|
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
|
|
./scripts/localnet-blocks-test.sh 40 5 10 localhost
|
|
|
|
deploy_docs:
|
|
<<: *docs_deploy
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Trigger website build
|
|
command: |
|
|
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
|
|
|
|
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
|
|
make tools
|
|
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
|
|
|
|
docker_image:
|
|
<<: *linux_defaults
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/workspace
|
|
- checkout
|
|
- setup_remote_docker:
|
|
docker_layer_caching: true
|
|
- run: |
|
|
GAIAD_VERSION=''
|
|
if [ "${CIRCLE_BRANCH}" = "master" ]; then
|
|
GAIAD_VERSION="stable"
|
|
elif [ "${CIRCLE_BRANCH}" = "develop" ]; then
|
|
GAIAD_VERSION="develop"
|
|
fi
|
|
if [ -z "${GAIAD_VERSION}" ]; then
|
|
docker build .
|
|
else
|
|
docker build -t tendermint/gaia:$GAIAD_VERSION .
|
|
docker login --password-stdin -u $DOCKER_USER <<<$DOCKER_PASS
|
|
docker push tendermint/gaia:$GAIAD_VERSION
|
|
fi
|
|
|
|
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 --password-stdin -u $DOCKER_USER <<<$DOCKER_PASS
|
|
docker push tendermint/gaia:$CIRCLE_TAG
|
|
|
|
workflows:
|
|
version: 2
|
|
test-suite:
|
|
jobs:
|
|
- docker_image:
|
|
requires:
|
|
- setup_dependencies
|
|
- docker_tagged:
|
|
filters:
|
|
tags:
|
|
only:
|
|
- /^v.*/
|
|
branches:
|
|
ignore:
|
|
- /.*/
|
|
requires:
|
|
- setup_dependencies
|
|
- macos_ci:
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
- develop
|
|
- deploy_docs:
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
- develop
|
|
- setup_dependencies:
|
|
# filters here are needed to enable this job also for tags
|
|
filters:
|
|
tags:
|
|
only:
|
|
- /^v.*/
|
|
- lint:
|
|
requires:
|
|
- setup_dependencies
|
|
- integration_tests:
|
|
requires:
|
|
- setup_dependencies
|
|
- test_sim_gaia_nondeterminism:
|
|
requires:
|
|
- setup_dependencies
|
|
- test_sim_gaia_fast:
|
|
requires:
|
|
- setup_dependencies
|
|
- test_sim_gaia_import_export:
|
|
requires:
|
|
- setup_dependencies
|
|
- test_sim_gaia_simulation_after_import:
|
|
requires:
|
|
- setup_dependencies
|
|
- test_sim_gaia_multi_seed:
|
|
requires:
|
|
- setup_dependencies
|
|
- test_sim_gaia_multi_seed_long:
|
|
requires:
|
|
- setup_dependencies
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
- develop
|
|
- test_cover:
|
|
requires:
|
|
- setup_dependencies
|
|
- localnet
|
|
- upload_coverage:
|
|
requires:
|
|
- test_cover
|