diff --git a/CHANGELOG.md b/CHANGELOG.md index cac3bf19..f551672c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,11 @@ Instead, edit the files in dev/changes/, then run 'make docs' to update this fil --> # Changelog - Go Build Action -## Unreleased Changes (targeting v0.1.6) +## Unreleased Changes (targeting v0.1.7) + + + +## [v0.1.6](https://github.com/hashicorp/actions-go-build/releases/tag/v0.1.6) - October 19, 2022 Changed: diff --git a/Makefile b/Makefile index 5776725d..d270842f 100644 --- a/Makefile +++ b/Makefile @@ -49,21 +49,45 @@ endif CURR_REVISION := $(DIRTY)$(CURR_REVISION) PRODUCT_REVISION ?= $(CURR_REVISION) +CLINAME := $(PRODUCT_NAME) +CLI := dist/$(CLINAME) +TMP_BUILD := $(TMPDIR)/temp-build/$(CLINAME) +RUNCLI := @$(TMP_BUILD) + +# GO_TARGETS are targets that need to invoke the go command to build +# or test the CLI. +GO_TARGETS := $(TMP_BUILD) $(CLI) test/go +# Unset some go configuration for go targets so that build-specific +# config from product repos doesn't influence the building of the CLI +# itself, which should always be built and tested for the host platform, +# not the target platform. +$(GO_TARGETS): export GOOS := +$(GO_TARGETS): export GOARCH := + build: go build ./... test: test/go +.PHONY: test/go +test/go: compile + @go test $(GO_TEST_FLAGS) ./... + cover: GO_TEST_FLAGS := -coverprofile=coverage.profile cover: test/go @go tool cover -html=coverage.profile && rm coverage.profile test/update: test/go/update -CLINAME := $(PRODUCT_NAME) -CLI := dist/$(CLINAME) -TMP_BUILD := $(TMPDIR)/temp-build/$(CLINAME) -RUNCLI := @$(TMP_BUILD) +.PHONY: test/go/update +test/go/update: export UPDATE_TESTDATA := true +test/go/update: test/go + @echo "Test data updated." + +.PHONY: compile +compile: + @$(CLEAR) + @go build ./... .PHONY: env env: @@ -74,8 +98,6 @@ env: .PHONY: $(TMP_BUILD) $(TMP_BUILD): - # Running tests... - @$(RUN_TESTS_QUIET) @echo "# Creating temporary build." 1>&2 @rm -f "$(TMP_BUILD)" @mkdir -p "$(dir $(TMP_BUILD))" @@ -91,8 +113,11 @@ $(TMP_BUILD): # # Thus, each version of actions-go-build is built using itself. .PHONY: $(CLI) +# Ensure we build the CLI for the host platform, not the target platform. $(CLI): @$(CLEAR) + # Running tests... + @$(RUN_TESTS_QUIET) # First build: Plain go build... @$(MAKE) $(TMP_BUILD) # Second build: Using first build to build self... @@ -134,20 +159,6 @@ run: $(TMP_BUILD) @$${QUIET:-false} || echo "\$$ $(notdir $<) $(RUN)" $(RUNCLI) $(RUN) -.PHONY: test/go/update -test/go/update: export UPDATE_TESTDATA := true -test/go/update: test/go - @echo "Test data updated." - -.PHONY: compile -compile: - @$(CLEAR) - @go build ./... - -.PHONY: test/go -test/go: compile - @go test $(GO_TEST_FLAGS) ./... - .PHONY: docs docs: readme changelog diff --git a/dev/VERSION b/dev/VERSION index c946ee61..11808190 100644 --- a/dev/VERSION +++ b/dev/VERSION @@ -1 +1 @@ -0.1.6 +0.1.7 diff --git a/dev/changes/v0.1.7.md b/dev/changes/v0.1.7.md new file mode 100644 index 00000000..e69de29b