Skip to content

Commit

Permalink
fix darwin arm64 builds (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsalisbury authored Nov 1, 2022
1 parent aa020ae commit b712d31
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 22 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 31 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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))"
Expand All @@ -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...
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion dev/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.6
0.1.7
Empty file added dev/changes/v0.1.7.md
Empty file.

0 comments on commit b712d31

Please sign in to comment.