Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup develop environment of circleCI #42

Merged
merged 6 commits into from
Mar 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 20 additions & 31 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,32 +186,6 @@ jobs:
- store_artifacts:
path: /home/circleci/project/test/p2p/logs

# TODO We need to replace the docker image with the image that adds libsodium library.
# upload_coverage:
# executor: golang
# steps:
# - attach_workspace:
# at: /tmp/workspace
# - restore_cache:
# name: "Restore source code cache"
# keys:
# - go-src-v1-{{ .Revision }}
# - checkout
# - restore_cache:
# name: "Restore go module cache"
# keys:
# - go-mod-v2-{{ checksum "go.sum" }}
# - run:
# name: gather
# command: |
# 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 .circleci/codecov.sh -f coverage.txt

deploy_docs:
executor: docs
steps:
Expand Down Expand Up @@ -278,14 +252,29 @@ jobs:
# 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 x${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"

lint:
executor: golang
parallelism: 1
steps:
- checkout
- restore_cache:
name: "Restore go modules cache"
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: "Run linter"
command: |
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.8
make lint

release_artifacts:
executor: golang
steps:
Expand Down Expand Up @@ -412,7 +401,10 @@ workflows:
branches:
only:
- docs-theme-latest
- setup_dependencies
- lint
- setup_dependencies:
requires:
- lint
- test_abci_apps:
requires:
- setup_dependencies
Expand All @@ -432,9 +424,6 @@ workflows:
# requires:
# - setup_dependencies
- test_p2p
# - upload_coverage:
# requires:
# - test_cover
- reproducible_builds:
filters:
branches:
Expand Down
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ linters-settings:
# disabled-checks:
# - wrapperFunc
# - commentFormatting # https://github.com/go-critic/go-critic/issues/755

# options for analysis running
run:
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ fmt:
@go fmt ./...

lint:
@echo "--> Running linter"
@golangci-lint run
sh -c "$(CURDIR)/scripts/current_branch_lint.sh"
find . -name '*.go' -type f -not -path "*.git*" | xargs gofmt -d -s
go mod verify

DESTINATION = ./index.html.md

Expand Down
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@
[State Machines](https://en.wikipedia.org/wiki/State_machine_replication).
Or [Blockchain](<https://en.wikipedia.org/wiki/Blockchain_(database)>), for short.

[![version](https://img.shields.io/github/tag/tendermint/tendermint.svg)](https://github.com/tendermint/tendermint/releases/latest)
[![API Reference](https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667)](https://godoc.org/github.com/tendermint/tendermint)
[![Go version](https://img.shields.io/badge/go-1.13-blue.svg)](https://github.com/moovweb/gvm)
[![riot.im](https://img.shields.io/badge/riot.im-JOIN%20CHAT-green.svg)](https://riot.im/app/#/room/#tendermint:matrix.org)
[![license](https://img.shields.io/github/license/tendermint/tendermint.svg)](https://github.com/tendermint/tendermint/blob/master/LICENSE)
[![](https://tokei.rs/b1/github/tendermint/tendermint?category=lines)](https://github.com/tendermint/tendermint)

| Branch | Tests | Coverage |
| ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| master | [![CircleCI](https://circleci.com/gh/tendermint/tendermint/tree/master.svg?style=shield)](https://circleci.com/gh/tendermint/tendermint/tree/master) | [![codecov](https://codecov.io/gh/tendermint/tendermint/branch/master/graph/badge.svg)](https://codecov.io/gh/tendermint/tendermint) |
| Branch | Tests |
| ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| master | [![CircleCI](https://circleci.com/gh/line/tendermint/tree/master.svg?style=shield)](https://circleci.com/gh/line/tendermint/tree/master) |

Tendermint Core is Byzantine Fault Tolerant (BFT) middleware that takes a state transition machine - written in any programming language -
and securely replicates it on many machines.
Expand Down
14 changes: 14 additions & 0 deletions scripts/current_branch_lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# get the base commit hash of this branch. The branch should be brached from master.
base_commit=$(diff -u <(git rev-list --first-parent HEAD) \
<(git rev-list --first-parent master) | \
sed -ne 's/^ //p' | head -1)

if [ "$base_commit" ]; then
#if base commit of this branch is exist, run linter from base commit to HEAD
golangci-lint run -v --new-from-rev "$base_commit"
else
# if not, check current don't commited files.
golangci-lint run -v -n
fi