Our previous strategy of just using `git describe --tags --dirty` to compute a version caused issues. The major one was that since version sort lexigrapically, git's strategy of having a commit count without leading zeros lead to cases where 0.11.0-dev-9 was "newer than" 0.11.0-dev-10 which is not what you want at all. With this change, we compute a version by first seeing if the commit is tagged, and if so, we use that tag. Otherwise, we take the closest tag and to it append the unix timestamp of the commit and then append a git hash. Because we use the commit timestamp, things will sort correctly again. Part of pulumi/home#174
60 lines
1.8 KiB
Makefile
60 lines
1.8 KiB
Makefile
PROJECT_NAME := Pulumi Fabric
|
|
SUB_PROJECTS := sdk/nodejs sdk/python
|
|
include build/common.mk
|
|
|
|
PROJECT := github.com/pulumi/pulumi
|
|
PROJECT_PKGS := $(shell go list ./cmd/... ./pkg/... | grep -v /vendor/)
|
|
EXTRA_TEST_PKGS := $(shell go list ./examples/ ./tests/... | grep -v /vendor/)
|
|
VERSION := $(shell scripts/get-version)
|
|
|
|
GOMETALINTERBIN := gometalinter
|
|
GOMETALINTER := ${GOMETALINTERBIN} --config=Gometalinter.json
|
|
|
|
TESTPARALLELISM := 10
|
|
|
|
# Our travis workers are a little show and sometime the fast tests take a little longer
|
|
ifeq ($(TRAVIS),true)
|
|
TEST_FAST_TIMEOUT := 10m
|
|
else
|
|
TEST_FAST_TIMEOUT := 2m
|
|
endif
|
|
|
|
build::
|
|
go install -ldflags "-X github.com/pulumi/pulumi/pkg/version.Version=${VERSION}" ${PROJECT}
|
|
|
|
install::
|
|
GOBIN=$(PULUMI_BIN) go install -ldflags "-X github.com/pulumi/pulumi/pkg/version.Version=${VERSION}" ${PROJECT}
|
|
|
|
LINT_SUPPRESS="or be unexported"
|
|
lint::
|
|
$(GOMETALINTER) main.go | grep -vE ${LINT_SUPPRESS} | sort ; exit $$(($${PIPESTATUS[1]}-1))
|
|
$(GOMETALINTER) ./pkg/... | grep -vE ${LINT_SUPPRESS} | sort ; exit $$(($${PIPESTATUS[1]}-1))
|
|
$(GOMETALINTER) ./cmd/... | grep -vE ${LINT_SUPPRESS} | sort ; exit $$(($${PIPESTATUS[1]}-1))
|
|
|
|
test_fast::
|
|
go test -timeout $(TEST_FAST_TIMEOUT) -cover -parallel ${TESTPARALLELISM} ${PROJECT_PKGS}
|
|
|
|
test_all::
|
|
PATH=$(PULUMI_ROOT)/bin:$(PATH) go test -cover -parallel ${TESTPARALLELISM} ${EXTRA_TEST_PKGS}
|
|
|
|
.PHONY: publish_tgz
|
|
publish_tgz:
|
|
$(call STEP_MESSAGE)
|
|
./scripts/publish_tgz.sh
|
|
|
|
.PHONY: publish_packages
|
|
publish_packages:
|
|
$(call STEP_MESSAGE)
|
|
./scripts/publish_packages.sh
|
|
|
|
.PHONY: coverage
|
|
coverage:
|
|
$(call STEP_MESSAGE)
|
|
./scripts/gocover.sh
|
|
|
|
# The travis_* targets are entrypoints for CI.
|
|
.PHONY: travis_cron travis_push travis_pull_request travis_api
|
|
travis_cron: all coverage
|
|
travis_push: only_build publish_tgz only_test publish_packages
|
|
travis_pull_request: all
|
|
travis_api: all
|