version: 2.1 executors: golang: docker: - image: tendermintdev/docker-tendermint-build working_directory: /go/src/github.com/tendermint/tendermint environment: GOBIN: /tmp/bin release: machine: true docs: docker: - image: tendermintdev/docker-website-deployment environment: AWS_REGION: us-east-1 commands: run_test: parameters: script_path: type: string steps: - attach_workspace: at: /tmp/bin - restore_cache: name: "Restore source code cache" keys: - go-src-v1-{{ .Revision }} - checkout - restore_cache: name: "Restore go modules cache" keys: - go-mod-v1-{{ checksum "go.sum" }} - run: name: "Running test" command: | bash << parameters.script_path >> jobs: setup_dependencies: executor: golang steps: - checkout - restore_cache: name: "Restore go modules cache" keys: - go-mod-v1-{{ checksum "go.sum" }} - run: command: | mkdir -p /tmp/bin - run: name: Cache go modules command: make go-mod-cache - run: name: tools command: make tools - run: name: "Build binaries" command: make install install_abci - save_cache: name: "Save go modules cache" key: go-mod-v1-{{ checksum "go.sum" }} paths: - "/go/pkg/mod" - save_cache: name: "Save source code cache" key: go-src-v1-{{ .Revision }} paths: - ".git" - persist_to_workspace: root: "/tmp/bin" paths: - "." test_persistence: executor: golang steps: - run_test: script_path: test/persist/test_failure_indices.sh test_p2p: environment: GOBIN: /home/circleci/.go_workspace/bin GOPATH: /home/circleci/.go_workspace machine: image: circleci/classic:latest parameters: ipv: type: integer default: 4 steps: - checkout - run: mkdir -p $GOPATH/src/github.com/tendermint - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint - run: bash test/p2p/circleci.sh << parameters.ipv >> - store_artifacts: path: /home/circleci/project/test/p2p/logs deploy_docs: executor: docs steps: - checkout - run: name: "Build docs" command: make build-docs - run: name: "Sync to S3" command: make sync-docs prepare_build: executor: golang steps: - restore_cache: name: "Restore source code cache" keys: - go-src-v1-{{ .Revision }} - checkout - run: name: Get next release number command: | export LAST_TAG="`git describe --tags --abbrev=0 --match "${CIRCLE_BRANCH}.*"`" echo "Last tag: ${LAST_TAG}" if [ -z "${LAST_TAG}" ]; then export LAST_TAG="${CIRCLE_BRANCH}" echo "Last tag not found. Possibly fresh branch or feature branch. Setting ${LAST_TAG} as tag." fi export NEXT_TAG="`python -u scripts/release_management/bump-semver.py --version "${LAST_TAG}"`" echo "Next tag: ${NEXT_TAG}" echo "export CIRCLE_TAG=\"${NEXT_TAG}\"" > release-version.source - run: name: Build dependencies command: make tools - persist_to_workspace: root: . paths: - "release-version.source" - save_cache: key: v2-release-deps-{{ checksum "go.sum" }} paths: - "/go/pkg/mod" build_artifacts: executor: golang parallelism: 4 steps: - restore_cache: name: "Restore source code cache" keys: - go-src-v1-{{ .Revision }} - checkout - restore_cache: name: "Restore release dependencies cache" keys: - v2-release-deps-{{ checksum "go.sum" }} - attach_workspace: at: /tmp/workspace - run: name: Build artifact command: | # Setting CIRCLE_TAG because we do not tag the release ourselves. source /tmp/workspace/release-version.source if test ${CIRCLE_NODE_INDEX:-0} == 0 ;then export GOOS=linux GOARCH=amd64 && export OUTPUT=build/tendermint_${GOOS}_${GOARCH} && make build && python -u scripts/release_management/zip-file.py ;fi if test ${CIRCLE_NODE_INDEX:-0} == 1 ;then export GOOS=darwin GOARCH=amd64 && export OUTPUT=build/tendermint_${GOOS}_${GOARCH} && make build && python -u scripts/release_management/zip-file.py ;fi if test ${CIRCLE_NODE_INDEX:-0} == 2 ;then export GOOS=windows GOARCH=amd64 && export OUTPUT=build/tendermint_${GOOS}_${GOARCH} && make build && python -u scripts/release_management/zip-file.py ;fi if test ${CIRCLE_NODE_INDEX:-0} == 3 ;then export GOOS=linux GOARCH=arm && export OUTPUT=build/tendermint_${GOOS}_${GOARCH} && make build && python -u scripts/release_management/zip-file.py ;fi - persist_to_workspace: root: build paths: - "*.zip" - "tendermint_linux_amd64" release_artifacts: executor: golang steps: - restore_cache: name: "Restore source code cache" keys: - go-src-v1-{{ .Revision }} - checkout - attach_workspace: at: /tmp/workspace - run: name: "Deploy to GitHub" command: | # Setting CIRCLE_TAG because we do not tag the release ourselves. source /tmp/workspace/release-version.source echo "---" ls -la /tmp/workspace/*.zip echo "---" python -u scripts/release_management/sha-files.py echo "---" cat /tmp/workspace/SHA256SUMS echo "---" export RELEASE_ID="`python -u scripts/release_management/github-draft.py`" echo "Release ID: ${RELEASE_ID}" #Todo: Parallelize uploads export GOOS=linux GOARCH=amd64 && python -u scripts/release_management/github-upload.py --id "${RELEASE_ID}" export GOOS=darwin GOARCH=amd64 && python -u scripts/release_management/github-upload.py --id "${RELEASE_ID}" export GOOS=windows GOARCH=amd64 && python -u scripts/release_management/github-upload.py --id "${RELEASE_ID}" export GOOS=linux GOARCH=arm && python -u scripts/release_management/github-upload.py --id "${RELEASE_ID}" python -u scripts/release_management/github-upload.py --file "/tmp/workspace/SHA256SUMS" --id "${RELEASE_ID}" python -u scripts/release_management/github-publish.py --id "${RELEASE_ID}" release_docker: machine: image: ubuntu-1604:201903-01 steps: - checkout - attach_workspace: at: /tmp/workspace - run: name: "Deploy to Docker Hub" command: | # Setting CIRCLE_TAG because we do not tag the release ourselves. source /tmp/workspace/release-version.source cp /tmp/workspace/tendermint_linux_amd64 DOCKER/tendermint docker build --label="tendermint" --tag="tendermint/tendermint:${CIRCLE_TAG}" --tag="tendermint/tendermint:latest" "DOCKER" docker login -u "${DOCKERHUB_USER}" --password-stdin \<<< "${DOCKERHUB_PASS}" docker push "tendermint/tendermint" docker logout reproducible_builds: executor: golang steps: - attach_workspace: at: /tmp/workspace - checkout - setup_remote_docker: docker_layer_caching: true - run: name: Build tendermint no_output_timeout: 20m command: | sudo apt-get update sudo apt-get install -y ruby bash -x ./scripts/gitian-build.sh all for os in darwin linux windows; do cp gitian-build-${os}/result/tendermint-${os}-res.yml . cp gitian-build-${os}/build/out/tendermint-*.tar.gz . rm -rf gitian-build-${os}/ done - store_artifacts: path: /go/src/github.com/tendermint/tendermint/tendermint-darwin-res.yml - store_artifacts: path: /go/src/github.com/tendermint/tendermint/tendermint-linux-res.yml - store_artifacts: path: /go/src/github.com/tendermint/tendermint/tendermint-windows-res.yml - store_artifacts: path: /go/src/github.com/tendermint/tendermint/tendermint-*.tar.gz # # Test RPC implementation against the swagger documented specs # contract_tests: # working_directory: /home/circleci/.go_workspace/src/github.com/tendermint/tendermint # machine: # image: circleci/classic:latest # environment: # GOBIN: /home/circleci/.go_workspace/bin # GOPATH: /home/circleci/.go_workspace/ # GOOS: linux # GOARCH: amd64 # parallelism: 1 # steps: # - checkout # - run: # name: Test RPC endpoints against swagger documentation # command: | # set -x # export PATH=~/.local/bin:$PATH # # install node and dredd # ./scripts/get_nodejs.sh # # build the binaries with a proper version of Go # docker run --rm -v "$PWD":/go/src/github.com/tendermint/tendermint -w /go/src/github.com/tendermint/tendermint golang make build-linux build-contract-tests-hooks # # This docker image works with go 1.7, we can install here the hook handler that contract-tests is going to use # go get github.com/snikch/goodman/cmd/goodman # make contract-tests workflows: version: 2 test-suite: jobs: - deploy_docs: context: tendermint-docs filters: branches: only: - master tags: only: - /^v.*/ - deploy_docs: context: tendermint-docs-staging filters: branches: only: - docs-staging - setup_dependencies - test_persistence: requires: - setup_dependencies - test_p2p - test_p2p: name: test_p2p_ipv6 ipv: 6 - reproducible_builds: filters: branches: only: - master - /v[0-9]+\.[0-9]+/ # - contract_tests: # requires: # - setup_dependencies release: jobs: - prepare_build - build_artifacts: requires: - prepare_build - release_artifacts: requires: - prepare_build - build_artifacts filters: branches: only: - /v[0-9]+\.[0-9]+/ - release_docker: requires: - prepare_build - build_artifacts filters: branches: only: - /v[0-9]+\.[0-9]+/ - master