2019-07-25 11:21:42 -07:00
version : 2.1
executors :
golang :
docker :
2019-09-04 07:58:29 -07:00
- image : circleci/golang:1.13
2019-07-25 11:21:42 -07:00
docs :
docker :
- image : tendermintdev/docker-website-deployment
environment :
AWS_REGION : us-east-1
2020-01-24 07:32:00 -08:00
protoc :
docker :
- image : tendermintdev/docker-protoc
2019-07-25 11:21:42 -07:00
commands :
make :
parameters :
description :
type : string
target :
type : string
steps :
- attach_workspace :
at : /tmp/workspace
- restore_cache :
name : "Restore source code cache"
keys :
- go-src-v1-{{ .Revision }}
- checkout
- restore_cache :
2019-08-28 07:58:25 -07:00
name : "Restore go modules cache"
keys :
- go-mod-v2-{{ checksum "go.sum" }}
2019-07-25 11:21:42 -07:00
- run :
name : << parameters.description >>
command : |
make << parameters.target >>
2018-11-14 13:11:34 -08:00
2019-01-04 07:40:39 -08:00
jobs :
2019-09-11 08:13:11 -07:00
build-docs :
2019-08-26 06:09:18 -07:00
executor : docs
steps :
- checkout
- run :
2019-08-28 07:58:25 -07:00
name : "Build docs"
2019-08-26 06:09:18 -07:00
command : make build-docs
- run :
name : "Upload docs to S3"
command : make sync-docs
2019-09-11 08:13:11 -07:00
setup-dependencies :
2019-07-25 11:21:42 -07:00
executor : golang
2018-03-20 16:55:55 -07:00
steps :
- checkout
2019-03-19 09:52:43 -07:00
- restore_cache :
2019-07-25 11:21:42 -07:00
name : "Restore go modules cache"
2019-03-19 09:52:43 -07:00
keys :
2019-07-30 08:17:16 -07:00
- go-mod-v2-{{ checksum "go.sum" }}
2018-03-20 16:55:55 -07:00
- run :
2019-07-25 11:21:42 -07:00
name : Cache go modules
command : make go-mod-cache
2018-03-20 16:55:55 -07:00
- run :
2019-07-25 11:21:42 -07:00
name : Build
command : make build
- run :
name : Git garbage collection
command : git gc
2019-03-19 09:52:43 -07:00
- save_cache :
2019-07-25 11:21:42 -07:00
name : "Save go modules cache"
2019-07-30 08:17:16 -07:00
key : go-mod-v2-{{ checksum "go.sum" }}
2019-03-19 09:52:43 -07:00
paths :
- "/go/pkg/mod"
2019-07-25 11:21:42 -07:00
- save_cache :
name : "Save source code cache"
key : go-src-v1-{{ .Revision }}
2018-03-20 16:55:55 -07:00
paths :
2019-07-25 11:21:42 -07:00
- ".git"
2020-01-24 07:32:00 -08:00
proto :
executor : protoc
steps :
- make :
target : protoc-gen-gocosmos
description : "Generate go plugin for protoc"
- make :
target : proto-gen proto-lint proto-check-breaking
description : "Lint and verify Protocol Buffer definitions"
2018-08-17 07:19:33 -07:00
2019-09-11 08:13:11 -07:00
test-sim-nondeterminism :
2019-07-25 11:21:42 -07:00
executor : golang
2018-08-16 08:36:15 -07:00
steps :
2019-07-25 11:21:42 -07:00
- make :
2019-09-11 08:13:11 -07:00
target : test-sim-nondeterminism
2019-07-25 11:21:42 -07:00
description : "Test individual module simulations"
2018-07-11 13:44:21 -07:00
2019-09-11 08:13:11 -07:00
test-sim-import-export :
2019-07-25 11:21:42 -07:00
executor : golang
2018-11-08 16:28:28 -08:00
steps :
2019-07-25 11:21:42 -07:00
- make :
2019-09-11 08:13:11 -07:00
target : test-sim-import-export
2019-07-25 11:21:42 -07:00
description : "Test application import/export simulation"
2018-11-08 16:28:28 -08:00
2019-09-11 08:13:11 -07:00
test-sim-after-import :
2019-07-25 11:21:42 -07:00
executor : golang
2018-11-26 04:21:23 -08:00
steps :
2019-07-25 11:21:42 -07:00
- make :
2019-09-11 08:13:11 -07:00
target : test-sim-after-import
2019-07-25 11:21:42 -07:00
description : "Test simulation after import"
2018-11-26 04:21:23 -08:00
2019-09-11 08:13:11 -07:00
test-sim-multi-seed-long :
2019-07-25 11:21:42 -07:00
executor : golang
2018-10-05 05:33:46 -07:00
steps :
2019-07-25 11:21:42 -07:00
- make :
2019-09-11 08:13:11 -07:00
target : test-sim-multi-seed-long
2019-07-25 11:21:42 -07:00
description : "Test multi-seed simulation (long)"
2019-01-04 07:40:39 -08:00
2019-09-11 08:13:11 -07:00
test-sim-multi-seed-short :
2019-07-25 11:21:42 -07:00
executor : golang
2019-01-04 07:40:39 -08:00
steps :
2019-07-25 11:21:42 -07:00
- make :
2019-09-11 08:13:11 -07:00
target : test-sim-multi-seed-short
2019-07-25 11:21:42 -07:00
description : "Test multi-seed simulation (short)"
2018-10-05 05:33:46 -07:00
2019-09-11 08:13:11 -07:00
test-cover :
2019-07-25 11:21:42 -07:00
executor : golang
2018-07-13 13:46:14 -07:00
parallelism : 4
2018-03-20 16:55:55 -07:00
steps :
2018-08-21 14:01:17 -07:00
- checkout
2019-03-19 09:52:43 -07:00
- restore_cache :
keys :
2019-07-30 08:17:16 -07:00
- go-mod-v2-{{ checksum "go.sum" }}
2018-03-20 16:55:55 -07:00
- run :
name : Run tests
command : |
2018-09-19 09:03:04 -07:00
export VERSION="$(git describe --tags --long | sed 's/v\(.*\)/\1/')"
2019-03-18 05:45:25 -07:00
export GO111MODULE=on
2019-07-25 11:21:42 -07:00
mkdir -p /tmp/logs /tmp/workspace/profiles
for pkg in $(go list ./... | grep -v '/simulation' | circleci tests split); do
2019-02-07 11:30:18 -08:00
id=$(echo "$pkg" | sed 's|[/.]|_|g')
2019-03-19 09:52:43 -07:00
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"
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
2019-09-11 08:13:11 -07:00
upload-coverage :
2019-07-25 11:21:42 -07:00
executor : golang
2018-03-20 16:55:55 -07:00
steps :
- attach_workspace :
at : /tmp/workspace
2018-08-21 14:01:17 -07:00
- checkout
2018-03-20 16:55:55 -07:00
- run :
name : gather
command : |
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 : |
2019-07-31 12:21:23 -07:00
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
2019-02-08 13:45:41 -08:00
for filename in ${excludelist}; do
2019-07-31 12:21:23 -07:00
filename=$(echo $filename | sed 's/^./github.com\/cosmos\/cosmos-sdk/g')
echo "Excluding ${filename} from coverage report..."
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
2019-02-08 13:45:41 -08:00
done
2018-03-20 16:55:55 -07:00
- run :
name : upload
command : bash <(curl -s https://codecov.io/bash) -f coverage.txt
2019-09-11 08:13:11 -07:00
update-swagger-docs :
2019-07-25 11:21:42 -07:00
executor : golang
2019-05-28 06:46:26 -07:00
steps :
2019-07-25 11:21:42 -07:00
- make :
target : update-swagger-docs
description : "Check if statik.go is up-to-date"
2019-05-28 06:46:26 -07:00
2018-03-20 16:55:55 -07:00
workflows :
version : 2
test-suite :
jobs :
2019-09-11 08:13:11 -07:00
- update-swagger-docs :
2019-05-28 06:46:26 -07:00
requires :
2019-09-11 08:13:11 -07:00
- setup-dependencies
- setup-dependencies :
2019-07-25 11:21:42 -07:00
# This filter enables the job for tags
2019-03-11 10:23:09 -07:00
filters :
tags :
only :
- /^v.*/
2020-01-24 07:32:00 -08:00
- proto :
requires :
- setup-dependencies
2019-09-11 08:13:11 -07:00
- test-sim-nondeterminism :
2018-07-11 13:44:21 -07:00
requires :
2019-09-11 08:13:11 -07:00
- setup-dependencies
- test-sim-import-export :
2018-11-08 16:28:28 -08:00
requires :
2019-09-11 08:13:11 -07:00
- setup-dependencies
- test-sim-after-import :
2018-11-26 04:21:23 -08:00
requires :
2019-09-11 08:13:11 -07:00
- setup-dependencies
- test-sim-multi-seed-short :
2018-10-05 05:41:12 -07:00
requires :
2019-09-11 08:13:11 -07:00
- setup-dependencies
- test-sim-multi-seed-long :
2019-01-04 07:40:39 -08:00
requires :
2019-09-11 08:13:11 -07:00
- setup-dependencies
2019-07-25 11:21:42 -07:00
# These filters ensure that the long sim only runs during release
2019-01-04 07:40:39 -08:00
filters :
branches :
2019-07-25 11:21:42 -07:00
ignore : /.*/
tags :
2019-01-04 07:40:39 -08:00
only :
2019-07-25 11:21:42 -07:00
- /^v.*/
2019-09-11 08:13:11 -07:00
- test-cover :
2018-03-20 16:55:55 -07:00
requires :
2019-09-11 08:13:11 -07:00
- setup-dependencies
- upload-coverage :
2018-03-20 16:55:55 -07:00
requires :
2019-09-11 08:13:11 -07:00
- test-cover
- build-docs :
2019-08-26 06:09:18 -07:00
context : docs-deployment-master
filters :
branches :
only :
2019-11-13 03:06:05 -08:00
- docs-theme-latest
2019-09-11 08:13:11 -07:00
- build-docs :
2019-08-26 06:09:18 -07:00
context : docs-deployment-release
filters :
branches :
2019-11-13 03:06:05 -08:00
only :
- master
2019-08-26 06:09:18 -07:00
tags :
only :
- /v.*/