cosmos-sdk/.circleci/config.yml

300 lines
8.3 KiB
YAML
Raw Normal View History

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-05-15 08:17:20 -07:00
- image: circleci/golang:1.12.5
2018-03-20 16:55:55 -07:00
2018-12-19 09:02:56 -08:00
############
#
# Configure docs deployment
docs_update: &docs_deploy
working_directory: ~/repo
docker:
- image: tendermintdev/jq_curl
environment:
AWS_REGION: us-east-1
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
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
2018-03-20 16:55:55 -07:00
- run:
name: tools
command: |
make runsim tools TOOLS_DESTDIR=/tmp/workspace/bin
cp $GOPATH/bin/runsim /tmp/workspace/bin
2019-05-28 06:46:26 -07:00
cp $GOPATH/bin/statik /tmp/workspace/bin
2018-03-20 16:55:55 -07:00
- run:
name: cache go modules
2018-03-20 16:55:55 -07:00
command: |
make go-mod-cache
- save_cache:
key: go-mod-v1-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod"
- run:
name: build
command: |
make build
2018-03-20 16:55:55 -07:00
- persist_to_workspace:
root: /tmp/workspace
paths:
- bin
- profiles
test_sim_app_nondeterminism:
2018-12-19 09:02:56 -08:00
<<: *linux_defaults
parallelism: 1
steps:
- attach_workspace:
at: /tmp/workspace
2018-08-21 14:01:17 -07:00
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: Test individual module simulations
command: |
make test_sim_app_nondeterminism
test_sim_app_fast:
2018-12-19 09:02:56 -08:00
<<: *linux_defaults
parallelism: 1
steps:
- attach_workspace:
at: /tmp/workspace
2018-08-21 14:01:17 -07:00
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: Test full application simulation
command: |
make test_sim_app_fast
2018-07-11 13:44:21 -07:00
test_sim_app_import_export:
2018-12-19 09:02:56 -08:00
<<: *linux_defaults
parallelism: 1
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: Test application import/export simulation
command: |
export GO111MODULE=on
/tmp/workspace/bin/runsim -j 4 github.com/cosmos/cosmos-sdk/simapp 50 5 TestAppImportExport
test_sim_app_simulation_after_import:
2018-12-19 09:02:56 -08:00
<<: *linux_defaults
parallelism: 1
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: Test application import/export simulation
command: |
export GO111MODULE=on
/tmp/workspace/bin/runsim -j 4 github.com/cosmos/cosmos-sdk/simapp 50 5 TestAppSimulationAfterImport
test_sim_app_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
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
2018-10-05 05:33:46 -07:00
- run:
name: Test multi-seed application simulation long
2018-10-05 05:33:46 -07:00
command: |
export GO111MODULE=on
/tmp/workspace/bin/runsim -j 4 github.com/cosmos/cosmos-sdk/simapp 500 50 TestFullAppSimulation
test_sim_app_multi_seed:
<<: *linux_defaults
parallelism: 1
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
2018-10-05 05:33:46 -07:00
- run:
name: Test multi-seed application simulation short
2018-10-05 05:33:46 -07:00
command: |
export GO111MODULE=on
/tmp/workspace/bin/runsim -j 4 github.com/cosmos/cosmos-sdk/simapp 50 10 TestFullAppSimulation
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
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
- run: mkdir -p /tmp/logs
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
2018-03-20 16:55:55 -07:00
- run:
name: Run tests
command: |
export VERSION="$(git describe --tags --long | sed 's/v\(.*\)/\1/')"
export GO111MODULE=on
for pkg in $(go list ./... | 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"
2018-03-20 16:55:55 -07:00
done
- persist_to_workspace:
root: /tmp/workspace
paths:
- "profiles/*"
- 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
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
2018-03-20 16:55:55 -07:00
- run:
name: gather
command: |
set -ex
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
- 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
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
2019-05-28 06:46:26 -07:00
check_statik:
<<: *linux_defaults
parallelism: 1
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: check if statik.go is up-to-date
command: |
set -ex
export PATH=/tmp/workspace/bin:$PATH
make update-swagger-docs
if [ -n "$(git status --porcelain)" ]; then
echo "swagger docs out of sync";
exit 1
else
echo "swagger docs are in sync";
fi
2018-03-20 16:55:55 -07:00
workflows:
version: 2
test-suite:
jobs:
2019-05-28 06:46:26 -07:00
- check_statik:
requires:
- setup_dependencies
- deploy_docs:
filters:
branches:
only:
- master
- develop
- setup_dependencies:
# filters here are needed to enable this job also for tags
filters:
tags:
only:
- /^v.*/
- test_sim_app_nondeterminism:
requires:
- setup_dependencies
- test_sim_app_fast:
2018-07-11 13:44:21 -07:00
requires:
- setup_dependencies
- test_sim_app_import_export:
requires:
- setup_dependencies
- test_sim_app_simulation_after_import:
requires:
- setup_dependencies
- test_sim_app_multi_seed:
2018-10-05 05:41:12 -07:00
requires:
- setup_dependencies
- test_sim_app_multi_seed_long:
requires:
- setup_dependencies
filters:
branches:
only:
- master
- develop
2018-03-20 16:55:55 -07:00
- test_cover:
requires:
- setup_dependencies
- upload_coverage:
requires:
- test_cover