version: 2 defaults: &defaults working_directory: /go/src/github.com/cosmos/cosmos-sdk docker: - image: circleci/golang:1.10.3 environment: GOBIN: /tmp/workspace/bin jobs: setup_dependencies: <<: *defaults steps: - run: mkdir -p /tmp/workspace/bin - run: mkdir -p /tmp/workspace/profiles - checkout - restore_cache: keys: - v1-pkg-cache - run: name: tools command: | export PATH="$GOBIN:$PATH" make get_tools - run: name: dependencies command: | export PATH="$GOBIN:$PATH" make get_vendor_deps - run: name: binaries command: | export PATH="$GOBIN:$PATH" make install make install_examples - persist_to_workspace: root: /tmp/workspace paths: - bin - profiles - save_cache: key: v1-pkg-cache paths: - /go/pkg - save_cache: key: v1-tree-{{ .Environment.CIRCLE_SHA1 }} paths: - /go/src/github.com/cosmos/cosmos-sdk lint: <<: *defaults parallelism: 1 steps: - attach_workspace: at: /tmp/workspace - restore_cache: key: v1-pkg-cache - restore_cache: key: v1-tree-{{ .Environment.CIRCLE_SHA1 }} - run: name: Get metalinter command: | export PATH="$GOBIN:$PATH" make get_dev_tools - run: name: Lint source command: | export PATH="$GOBIN:$PATH" make test_lint test_cli: <<: *defaults parallelism: 1 steps: - attach_workspace: at: /tmp/workspace - restore_cache: key: v1-pkg-cache - restore_cache: key: v1-tree-{{ .Environment.CIRCLE_SHA1 }} - run: name: Test cli command: | export PATH="$GOBIN:$PATH" make test_cli test_sim: <<: *defaults parallelism: 1 steps: - attach_workspace: at: /tmp/workspace - restore_cache: key: v1-pkg-cache - restore_cache: key: v1-tree-{{ .Environment.CIRCLE_SHA1 }} - run: name: Test simulation command: | export PATH="$GOBIN:$PATH" export GAIA_SIMULATION_SEED=1531897442166404087 make test_sim test_cover: <<: *defaults parallelism: 4 steps: - attach_workspace: at: /tmp/workspace - restore_cache: key: v1-pkg-cache - restore_cache: key: v1-tree-{{ .Environment.CIRCLE_SHA1 }} - run: mkdir -p /tmp/logs - run: name: Run tests command: | export PATH="$GOBIN:$PATH" make install for pkg in $(go list github.com/cosmos/cosmos-sdk/... | grep -v /vendor/ | grep -v github.com/cosmos/cosmos-sdk/cmd/gaia/cli_test | circleci tests split --split-by=timings); do id=$(basename "$pkg") GOCACHE=off go test -v -timeout 8m -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic "$pkg" | tee "/tmp/logs/$id-$RANDOM.log" done - persist_to_workspace: root: /tmp/workspace paths: - "profiles/*" - store_artifacts: path: /tmp/logs upload_coverage: <<: *defaults parallelism: 1 steps: - attach_workspace: at: /tmp/workspace - restore_cache: key: v1-tree-{{ .Environment.CIRCLE_SHA1 }} - run: name: gather command: | set -ex 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: upload command: bash <(curl -s https://codecov.io/bash) -f coverage.txt workflows: version: 2 test-suite: jobs: - setup_dependencies - lint: requires: - setup_dependencies - test_cli: requires: - setup_dependencies - test_sim: requires: - setup_dependencies - test_cover: requires: - setup_dependencies - upload_coverage: requires: - test_cover