version: 2.1 executors: golang: docker: - image: circleci/golang:1.12.7 docs: docker: - image: tendermintdev/docker-website-deployment environment: AWS_REGION: us-east-1 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: name: "Restore go modules cache" keys: - go-mod-v2-{{ checksum "go.sum" }} - run: name: << parameters.description >> command: | make << parameters.target >> jobs: build_docs: executor: docs steps: - checkout - run: Name : "Build docs" command: make build-docs - run: name: "Upload docs to S3" command: make sync-docs setup_dependencies: executor: golang steps: - checkout - restore_cache: name: "Restore go modules cache" keys: - go-mod-v2-{{ checksum "go.sum" }} - run: name: Cache go modules command: make go-mod-cache - run: name: Build command: make build - run: name: Git garbage collection command: git gc - save_cache: name: "Save go modules cache" key: go-mod-v2-{{ checksum "go.sum" }} paths: - "/go/pkg/mod" - save_cache: name: "Save source code cache" key: go-src-v1-{{ .Revision }} paths: - ".git" test_sim_nondeterminism: executor: golang steps: - make: target: test_sim_nondeterminism description: "Test individual module simulations" test_sim_import_export: executor: golang steps: - make: target: test_sim_import_export description: "Test application import/export simulation" test_sim_after_import: executor: golang steps: - make: target: test_sim_after_import description: "Test simulation after import" test_sim_multi_seed_long: executor: golang steps: - make: target: test_sim_multi_seed_long description: "Test multi-seed simulation (long)" test_sim_multi_seed_short: executor: golang steps: - make: target: test_sim_multi_seed_short description: "Test multi-seed simulation (short)" test_cover: executor: golang parallelism: 4 steps: - checkout - restore_cache: keys: - go-mod-v2-{{ checksum "go.sum" }} - run: name: Run tests command: | export VERSION="$(git describe --tags --long | sed 's/v\(.*\)/\1/')" export GO111MODULE=on mkdir -p /tmp/logs /tmp/workspace/profiles for pkg in $(go list ./... | grep -v '/simulation' | circleci tests split); 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: executor: golang steps: - attach_workspace: at: /tmp/workspace - checkout - run: name: gather command: | 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')" for filename in ${excludelist}; do 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 done - run: name: upload command: bash <(curl -s https://codecov.io/bash) -f coverage.txt check_statik: executor: golang steps: - make: target: update-swagger-docs description: "Check if statik.go is up-to-date" workflows: version: 2 test-suite: jobs: - check_statik: requires: - setup_dependencies - setup_dependencies: # This filter enables the job for tags filters: tags: only: - /^v.*/ - test_sim_nondeterminism: requires: - setup_dependencies - test_sim_import_export: requires: - setup_dependencies - test_sim_after_import: requires: - setup_dependencies - test_sim_multi_seed_short: requires: - setup_dependencies - test_sim_multi_seed_long: requires: - setup_dependencies # These filters ensure that the long sim only runs during release filters: branches: ignore: /.*/ tags: only: - /^v.*/ - test_cover: requires: - setup_dependencies - upload_coverage: requires: - test_cover - build_docs: context: docs-deployment-master filters: branches: only: - /.*/ tags: ignore: - /^v.*/ - build_docs: context: docs-deployment-release filters: branches: ignore: - /.*/ tags: only: - /v.*/