|
| 1 | +MODULE = github.com/iofinnet/tss-lib/v3 |
| 2 | +PACKAGES = $(shell go list ./... | grep -v '/vendor/') |
| 3 | +UT_TIMEOUT = -timeout 60m |
| 4 | +UT_COVER = -covermode=atomic -cover |
| 5 | +UT_PACKAGES_LEVEL_0 = $(shell go list ./... | grep -v '/vendor/' | grep 'keygen' ) |
| 6 | +UT_PACKAGES_LEVEL_1 = $(shell go list ./... | grep -v '/vendor/' | grep -v 'keygen' ) |
| 7 | + |
| 8 | +all: protob test |
| 9 | + |
| 10 | +######################################## |
| 11 | +### Protocol Buffers |
| 12 | + |
| 13 | +protob: |
| 14 | + @echo "--> Building Protocol Buffers using buf" |
| 15 | + @go tool buf generate |
| 16 | + |
| 17 | +######################################## |
| 18 | +### Format |
| 19 | + |
| 20 | +fmt: |
| 21 | + @go fmt ./... |
| 22 | + |
| 23 | +lint: |
| 24 | + @golangci-lint run |
| 25 | + |
| 26 | +build: protob |
| 27 | + go fmt ./... |
| 28 | + |
| 29 | +######################################## |
| 30 | +### Testing |
| 31 | + |
| 32 | +test_unit_level0: |
| 33 | + @echo "--> Running Unit Tests - Level 0" |
| 34 | + @echo "!!! WARNING: This will take a long time :|" |
| 35 | + @echo "!!! WARNING: This will delete fixtures" |
| 36 | + go clean -testcache |
| 37 | + rm -f ./test/_ecdsa_fixtures/*json |
| 38 | + rm -f ./test/_schnorr_fixtures/*json |
| 39 | + go test -failfast ${UT_TIMEOUT} ${UT_COVER} $(UT_PACKAGES_LEVEL_0) |
| 40 | + |
| 41 | + |
| 42 | +test_unit: test_unit_level0 |
| 43 | + @echo "--> Running Unit Tests - Level 1" |
| 44 | + @echo "!!! WARNING: This will take a long time :|" |
| 45 | + go test -failfast ${UT_TIMEOUT} ${UT_COVER} $(UT_PACKAGES_LEVEL_1) |
| 46 | + |
| 47 | +test_unit_race_level0: |
| 48 | + @echo "--> Running Unit Tests (with Race Detection) - Level 0" |
| 49 | + @echo "!!! WARNING: This will take a long time :|" |
| 50 | + @echo "!!! WARNING: This will delete fixtures" |
| 51 | + go clean -testcache |
| 52 | + rm -f ./test/_ecdsa_fixtures/*json |
| 53 | + rm -f ./test/_schnorr_fixtures/*json |
| 54 | + go test -failfast -race ${UT_TIMEOUT} $(UT_PACKAGES_LEVEL_0) |
| 55 | + |
| 56 | +test_unit_race: test_unit_race_level0 |
| 57 | + @echo "--> Running Unit Tests (with Race Detection) - Level 1" |
| 58 | + @echo "!!! WARNING: This will take a long time :|" |
| 59 | + go test -failfast -race ${UT_TIMEOUT} ${UT_COVER} $(UT_PACKAGES_LEVEL_1) |
| 60 | + |
| 61 | +test_unit_race_ci: test_unit_race_level0 |
| 62 | + @echo "--> Running Unit Tests (with Race Detection) - Level 1" |
| 63 | + @echo "!!! WARNING: This will take a long time :|" |
| 64 | + go test -failfast -race ${UT_TIMEOUT} $(UT_PACKAGES_LEVEL_1) |
| 65 | + |
| 66 | +test: |
| 67 | + make test_unit_race |
| 68 | + |
| 69 | +test_ci: |
| 70 | + make test_unit_race_ci |
| 71 | + |
| 72 | +######################################## |
| 73 | +### Pre Commit |
| 74 | + |
| 75 | +pre_commit: build test |
| 76 | + |
| 77 | +######################################## |
| 78 | + |
| 79 | +# To avoid unintended conflicts with file names, always add to .PHONY |
| 80 | +# # unless there is a reason not to. |
| 81 | +# # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html |
| 82 | +.PHONY: protob build test test_ci test_unit test_unit_race |
0 commit comments