Merge PR #125: Standardize and cleanup makefile

This commit is contained in:
Alessio Treglia 2019-09-17 19:07:46 +01:00 committed by Jack Zampolin
parent 6970ebe19b
commit b4728108f1
3 changed files with 68 additions and 69 deletions

View File

@ -53,7 +53,7 @@ commands:
echo 'export GO111MODULE=on'
jobs:
setup_dependencies:
setup-dependencies:
executor: golang
steps:
- checkout
@ -93,42 +93,42 @@ jobs:
paths:
- "."
test_sim_nondeterminism:
test-sim-nondeterminism:
executor: golang
steps:
- make:
target: test_sim_nondeterminism
target: test-sim-nondeterminism
description: "Test Gaia non-determinism simulations"
test_sim_import_export:
test-sim-import-export:
executor: golang
steps:
- make:
target: test_sim_import_export
target: test-sim-import-export
description: "Test Gaia import/export simulation"
test_sim_after_import:
test-sim-after-import:
executor: golang
steps:
- make:
target: test_sim_after_import
target: test-sim-after-import
description: "Test Gaia simulation after importing state"
test_sim_multi_seed_short:
test-sim-multi-seed-short:
executor: golang
steps:
- make:
target: test_sim_multi_seed_short
target: test-sim-multi-seed-short
description: "Test Gaia multi-seed simulation (short-lived)"
test_sim_multi_seed_long:
test-sim-multi-seed-long:
executor: golang
steps:
- make:
target: test_sim_multi_seed_long
target: test-sim-multi-seed-long
description: "Test Gaia multi-seed simulation (long-lived)"
integration_tests:
integration-tests:
executor: golang
steps:
- checkout
@ -139,9 +139,9 @@ jobs:
name: Test CLI integration
command: |
export BUILDDIR=`pwd`/build
make check-build
make test-build
test_cover:
test-cover:
executor: golang
parallelism: 4
steps:
@ -166,7 +166,7 @@ jobs:
- store_artifacts:
path: /tmp/logs
upload_coverage:
upload-coverage:
executor: golang
steps:
- attach_workspace:
@ -223,7 +223,7 @@ jobs:
make localnet-start
./contrib/localnet-blocks-test.sh 40 5 10 localhost
deploy_docs:
deploy-docs:
executor: docs
steps:
- checkout
@ -247,7 +247,7 @@ jobs:
echo "Website build started"
fi
macos_ci:
macos-ci:
executor: mac
steps:
- mac_set_env
@ -269,14 +269,14 @@ jobs:
- run:
name: Integration tests
command: source $BASH_ENV
make check-build
make test-build
- run:
name: Test full gaia simulation
command: |
source $BASH_ENV
make sim-gaia-fast
docker_image:
docker-image:
executor: golang
steps:
- attach_workspace:
@ -299,7 +299,7 @@ jobs:
docker push tendermint/gaia:$GAIAD_VERSION
fi
docker_tagged:
docker-tagged:
executor: golang
steps:
- attach_workspace:
@ -312,7 +312,7 @@ jobs:
docker login --password-stdin -u $DOCKER_USER \<<$DOCKER_PASS
docker push tendermint/gaia:$CIRCLE_TAG
reproducible_builds:
reproducible-builds:
executor: golang
steps:
- attach_workspace:
@ -362,10 +362,10 @@ workflows:
version: 2
test-suite:
jobs:
- docker_image:
- docker-image:
requires:
- setup_dependencies
- docker_tagged:
- setup-dependencies
- docker-tagged:
filters:
tags:
only:
@ -374,43 +374,43 @@ workflows:
ignore:
- /.*/
requires:
- setup_dependencies
- macos_ci:
- setup-dependencies
- macos-ci:
filters:
branches:
only:
- master
- develop
- deploy_docs:
- deploy-docs:
filters:
branches:
only:
- master
- develop
- setup_dependencies:
- setup-dependencies:
# filters here are needed to enable this job also for tags
filters:
tags:
only:
- /^v.*/
- integration_tests:
- integration-tests:
requires:
- setup_dependencies
- test_sim_nondeterminism:
- setup-dependencies
- test-sim-nondeterminism:
requires:
- setup_dependencies
- test_sim_import_export:
- setup-dependencies
- test-sim-import-export:
requires:
- setup_dependencies
- test_sim_after_import:
- setup-dependencies
- test-sim-after-import:
requires:
- setup_dependencies
- test_sim_multi_seed_short:
- setup-dependencies
- test-sim-multi-seed-short:
requires:
- setup_dependencies
- test_sim_multi_seed_long:
- setup-dependencies
- test-sim-multi-seed-long:
requires:
- setup_dependencies
- setup-dependencies
# These filters ensure that the long sim only runs during release
filters:
branches:
@ -418,20 +418,20 @@ workflows:
tags:
only:
- /^v.*/
- test_cover:
- test-cover:
requires:
- setup_dependencies
- setup-dependencies
- localnet
- upload_coverage:
- upload-coverage:
requires:
- test_cover
- reproducible_builds:
- test-cover
- reproducible-builds:
filters:
branches:
only:
- master
requires:
- setup_dependencies
- setup-dependencies
# - contract_tests:
# requires:
# - setup_dependencies
# - setup-dependencies

View File

@ -86,7 +86,7 @@ else
go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests ./cmd/contract_tests
endif
install: go.sum check-ledger
install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiad
go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiacli
@ -119,19 +119,19 @@ distclean: clean
### Testing
check: check-unit check-build
check-all: check check-race check-cover
test: test-unit test-build
test-all: check test-race test-cover
check-unit:
test-unit:
@VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock' ./...
check-race:
test-race:
@VERSION=$(VERSION) go test -mod=readonly -race -tags='ledger test_ledger_mock' ./...
check-cover:
test-cover:
@go test -mod=readonly -timeout 30m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock' ./...
check-build: build
test-build: build
@go test -mod=readonly -p 4 `go list ./cli_test/...` -tags=cli_test -v
@ -193,5 +193,4 @@ include sims.mk
.PHONY: all build-linux install install-debug \
go-mod-cache draw-deps clean build \
setup-transactions setup-contract-tests-data start-gaia run-lcd-contract-tests contract-tests \
check check-all check-build check-cover check-ledger check-unit check-race
test test-all test-build test-cover test-unit test-race

26
sims.mk
View File

@ -6,39 +6,39 @@
BINDIR ?= $(GOPATH)/bin
SIMAPP = github.com/cosmos/gaia/app
test_sim_nondeterminism:
test-sim-nondeterminism:
@echo "Running non-determinism test..."
@go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \
-NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h
test_sim_custom_genesis_fast:
test-sim-custom-genesis-fast:
@echo "Running custom genesis simulation..."
@echo "By default, ${HOME}/.gaiad/config/genesis.json will be used."
@go test -mod=readonly $(SIMAPP) -run TestFullGaiaSimulation -Genesis=${HOME}/.gaiad/config/genesis.json \
-Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h
test_sim_import_export: runsim
test-sim-import-export: runsim
@echo "Running Gaia import/export simulation. This may take several minutes..."
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestGaiaImportExport
test_sim_after_import: runsim
test-sim-after-import: runsim
@echo "Running Gaia simulation-after-import. This may take several minutes..."
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestGaiaSimulationAfterImport
test_sim_custom_genesis_multi_seed: runsim
test-sim-custom-genesis-multi-seed: runsim
@echo "Running multi-seed custom genesis simulation..."
@echo "By default, ${HOME}/.gaiad/config/genesis.json will be used."
@$(BINDIR)/runsim -Jobs=4 -Genesis=${HOME}/.gaiad/config/genesis.json 400 5 TestFullGaiaSimulation
test_sim_multi_seed_long: runsim
test-sim-multi-seed-long: runsim
@echo "Running multi-seed application simulation. This may take awhile!"
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 500 50 TestFullAppSimulation
test_sim_multi_seed_short: runsim
test-sim-multi-seed-short: runsim
@echo "Running multi-seed application simulation. This may take awhile!"
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 50 10 TestFullAppSimulation
sim-benchmark-invariants:
test-sim-benchmark-invariants:
@echo "Running simulation invariant benchmarks..."
@go test -mod=readonly $(SIMAPP) -benchmem -bench=BenchmarkInvariants -run=^$ \
-Enabled=true -NumBlocks=1000 -BlockSize=200 \
@ -48,16 +48,16 @@ SIM_NUM_BLOCKS ?= 500
SIM_BLOCK_SIZE ?= 200
SIM_COMMIT ?= true
sim-gaia-benchmark:
test-sim-gaia-benchmark:
@echo "Running Gaia benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!"
@go test -mod=readonly -benchmem -run=^$$ $(SIMAPP) -bench ^BenchmarkFullGaiaSimulation$$ \
-Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h
sim-gaia-profile:
test-sim-gaia-profile:
@echo "Running Gaia benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!"
@go test -mod=readonly -benchmem -run=^$$ $(SIMAPP) -bench ^BenchmarkFullGaiaSimulation$$ \
-Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h -cpuprofile cpu.out -memprofile mem.out
.PHONY: runsim sim-gaia-nondeterminism sim-gaia-custom-genesis-fast sim-gaia-fast sim-gaia-import-export \
sim-gaia-simulation-after-import sim-gaia-custom-genesis-multi-seed sim-gaia-multi-seed \
sim-benchmark-invariants sim-gaia-benchmark sim-gaia-profile
.PHONY: runsim test-sim-gaia-nondeterminism test-sim-gaia-custom-genesis-fast test-sim-gaia-fast sim-gaia-import-export \
test-sim-gaia-simulation-after-import test-sim-gaia-custom-genesis-multi-seed test-sim-gaia-multi-seed \
test-sim-benchmark-invariants test-sim-gaia-benchmark test-sim-gaia-profile