src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

Makefile (3382B)


      1 PRE_RELEASE_VERSION ?=
      2 
      3 RELEASE_MANIFEST_FILE ?=
      4 RELEASE_CHGLOG_DESC_FILE ?=
      5 
      6 REPOTOOLS_VERSION ?= latest
      7 REPOTOOLS_MODULE = github.com/awslabs/aws-go-multi-module-repository-tools
      8 REPOTOOLS_CMD_CALCULATE_RELEASE = ${REPOTOOLS_MODULE}/cmd/calculaterelease@${REPOTOOLS_VERSION}
      9 REPOTOOLS_CMD_CALCULATE_RELEASE_ADDITIONAL_ARGS ?=
     10 REPOTOOLS_CMD_UPDATE_REQUIRES = ${REPOTOOLS_MODULE}/cmd/updaterequires@${REPOTOOLS_VERSION}
     11 REPOTOOLS_CMD_UPDATE_MODULE_METADATA = ${REPOTOOLS_MODULE}/cmd/updatemodulemeta@${REPOTOOLS_VERSION}
     12 REPOTOOLS_CMD_GENERATE_CHANGELOG = ${REPOTOOLS_MODULE}/cmd/generatechangelog@${REPOTOOLS_VERSION}
     13 REPOTOOLS_CMD_CHANGELOG = ${REPOTOOLS_MODULE}/cmd/changelog@${REPOTOOLS_VERSION}
     14 REPOTOOLS_CMD_TAG_RELEASE = ${REPOTOOLS_MODULE}/cmd/tagrelease@${REPOTOOLS_VERSION}
     15 REPOTOOLS_CMD_MODULE_VERSION = ${REPOTOOLS_MODULE}/cmd/moduleversion@${REPOTOOLS_VERSION}
     16 
     17 UNIT_TEST_TAGS=
     18 BUILD_TAGS=
     19 
     20 ifneq ($(PRE_RELEASE_VERSION),)
     21 	REPOTOOLS_CMD_CALCULATE_RELEASE_ADDITIONAL_ARGS += -preview=${PRE_RELEASE_VERSION}
     22 endif
     23 
     24 smithy-publish-local:
     25 	cd codegen && ./gradlew publishToMavenLocal
     26 
     27 smithy-build:
     28 	cd codegen && ./gradlew build
     29 
     30 smithy-clean:
     31 	cd codegen && ./gradlew clean
     32 
     33 ##################
     34 # Linting/Verify #
     35 ##################
     36 .PHONY: verify vet cover
     37 
     38 verify: vet
     39 
     40 vet:
     41 	go vet ${BUILD_TAGS} --all ./...
     42 
     43 cover:
     44 	go test ${BUILD_TAGS} -coverprofile c.out ./...
     45 	@cover=`go tool cover -func c.out | grep '^total:' | awk '{ print $$3+0 }'`; \
     46 		echo "total (statements): $$cover%";
     47 
     48 ################
     49 # Unit Testing #
     50 ################
     51 .PHONY: unit unit-race unit-test unit-race-test
     52 
     53 unit: verify
     54 	go vet ${BUILD_TAGS} --all ./... && \
     55 	go test ${BUILD_TAGS} ${RUN_NONE} ./... && \
     56 	go test -timeout=1m ${UNIT_TEST_TAGS} ./...
     57 
     58 unit-race: verify
     59 	go vet ${BUILD_TAGS} --all ./... && \
     60 	go test ${BUILD_TAGS} ${RUN_NONE} ./... && \
     61 	go test -timeout=1m ${UNIT_TEST_TAGS} -race -cpu=4 ./...
     62 
     63 unit-test: verify
     64 	go test -timeout=1m ${UNIT_TEST_TAGS} ./...
     65 
     66 unit-race-test: verify
     67 	go test -timeout=1m ${UNIT_TEST_TAGS} -race -cpu=4 ./...
     68 
     69 #####################
     70 #  Release Process  #
     71 #####################
     72 .PHONY: preview-release pre-release-validation release
     73 
     74 preview-release:
     75 	go run ${REPOTOOLS_CMD_CALCULATE_RELEASE} ${REPOTOOLS_CMD_CALCULATE_RELEASE_ADDITIONAL_ARGS}
     76 
     77 pre-release-validation:
     78 	@if [[ -z "${RELEASE_MANIFEST_FILE}" ]]; then \
     79 		echo "RELEASE_MANIFEST_FILE is required to specify the file to write the release manifest" && false; \
     80 	fi
     81 	@if [[ -z "${RELEASE_CHGLOG_DESC_FILE}" ]]; then \
     82 		echo "RELEASE_CHGLOG_DESC_FILE is required to specify the file to write the release notes" && false; \
     83 	fi
     84 
     85 release: pre-release-validation
     86 	go run ${REPOTOOLS_CMD_CALCULATE_RELEASE} -o ${RELEASE_MANIFEST_FILE} ${REPOTOOLS_CMD_CALCULATE_RELEASE_ADDITIONAL_ARGS}
     87 	go run ${REPOTOOLS_CMD_UPDATE_REQUIRES} -release ${RELEASE_MANIFEST_FILE}
     88 	go run ${REPOTOOLS_CMD_UPDATE_MODULE_METADATA} -release ${RELEASE_MANIFEST_FILE}
     89 	go run ${REPOTOOLS_CMD_GENERATE_CHANGELOG} -release ${RELEASE_MANIFEST_FILE} -o ${RELEASE_CHGLOG_DESC_FILE}
     90 	go run ${REPOTOOLS_CMD_CHANGELOG} rm -all
     91 	go run ${REPOTOOLS_CMD_TAG_RELEASE} -release ${RELEASE_MANIFEST_FILE}
     92 
     93 module-version:
     94 	@go run ${REPOTOOLS_CMD_MODULE_VERSION} .
     95 
     96 ##############
     97 # Repo Tools #
     98 ##############
     99 .PHONY: install-changelog
    100 
    101 install-changelog:
    102 	go install ${REPOTOOLS_MODULE}/cmd/changelog@${REPOTOOLS_VERSION}