github.com/onflow/flow-go/crypto@v0.24.8/Makefile (about)

     1  # Name of the cover profile
     2  COVER_PROFILE := cover.out
     3  
     4  IMAGE_TAG := v0.0.7
     5  
     6  # allows CI to specify whether to have race detection on / off
     7  ifeq ($(RACE_DETECTOR),1)
     8  	RACE_FLAG := -race
     9  else
    10  	RACE_FLAG :=
    11  endif
    12  
    13  ADX_SUPPORT := $(shell if ([ -f "/proc/cpuinfo" ] && grep -q -e '^flags.*\badx\b' /proc/cpuinfo); then echo 1; else echo 0; fi)
    14  
    15  .PHONY: setup
    16  setup:
    17  	go generate
    18  
    19  # test BLS-related functionalities requiring the Relic library (and hence relic Go build flag)
    20  .PHONY: relic_tests
    21  relic_tests:
    22  ifeq ($(ADX_SUPPORT), 1)
    23  	go test -coverprofile=$(COVER_PROFILE) $(RACE_FLAG) $(if $(JSON_OUTPUT),-json,) $(if $(NUM_RUNS),-count $(NUM_RUNS),) --tags relic $(if $(VERBOSE),-v,)
    24  else
    25  	CGO_CFLAGS="-D__BLST_PORTABLE__" go test -coverprofile=$(COVER_PROFILE) $(RACE_FLAG) $(if $(JSON_OUTPUT),-json,) $(if $(NUM_RUNS),-count $(NUM_RUNS),) --tags relic $(if $(VERBOSE),-v,)
    26  endif
    27  
    28  # test all packages that do not require Relic library (all functionalities except the BLS-related ones)
    29  .PHONY: non_relic_tests
    30  non_relic_tests:
    31  # root package without relic 
    32  	go test -coverprofile=$(COVER_PROFILE) $(RACE_FLAG) $(if $(JSON_OUTPUT),-json,) $(if $(NUM_RUNS),-count $(NUM_RUNS),) $(if $(VERBOSE),-v,)
    33  # sub packages
    34  	go test -coverprofile=$(COVER_PROFILE) $(RACE_FLAG) $(if $(JSON_OUTPUT),-json,) $(if $(NUM_RUNS),-count $(NUM_RUNS),) $(if $(VERBOSE),-v,) ./hash
    35  	go test -coverprofile=$(COVER_PROFILE) $(RACE_FLAG) $(if $(JSON_OUTPUT),-json,) $(if $(NUM_RUNS),-count $(NUM_RUNS),) $(if $(VERBOSE),-v,) ./random
    36  
    37  ############################################################################################
    38  # CAUTION: DO NOT MODIFY THIS TARGET! DOING SO WILL BREAK THE FLAKY TEST MONITOR
    39  
    40  # sets up the crypto module and runs all tests
    41  .PHONY: test
    42  test: setup unittest
    43  
    44  # runs the unit tests of the module (assumes the module was set up)
    45  .PHONY: unittest
    46  unittest: relic_tests non_relic_tests
    47  
    48  ############################################################################################
    49  
    50  .PHONY: docker-build
    51  docker-build:
    52  	docker build -t gcr.io/dl-flow/golang-cmake:latest -t gcr.io/dl-flow/golang-cmake:$(IMAGE_TAG) .
    53  
    54  .PHONY: docker-push
    55  docker-push:
    56  	docker push gcr.io/dl-flow/golang-cmake:latest 
    57  	docker push "gcr.io/dl-flow/golang-cmake:$(IMAGE_TAG)"