Skip to content

Commit

Permalink
Update Makefile for macOS cross-compilation with goreleaser (#145)
Browse files Browse the repository at this point in the history
* Update Makefile for macOS cross-compilation with goreleaser

* Fix incorrect invocation of goreleaser-cross

* See if disabling windows build will fix out-of-disk-space error

* Try to restore Windows builds by freeing up disk space in CI runner

* Also add disk-space-freeing action to the release-test job
  • Loading branch information
ethanjli authored Feb 28, 2024
1 parent 08dc467 commit 442d7ff
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ jobs:
with:
fetch-depth: 0

- name: Free up disk space
uses: jlumbroso/[email protected]
with:
docker-images: false
swap-storage: false

- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v4
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ jobs:
with:
fetch-depth: 0

- name: Free up disk space
uses: jlumbroso/[email protected]
with:
docker-images: false
swap-storage: false

- name: Set up Golang with cache
uses: magnetikonline/action-golang-cache@v4
with:
Expand Down
36 changes: 18 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PACKAGE_NAME := github.com/PlanktoScope/forklift
GOLANG_CROSS_VERSION ?= v1.21.0
GOLANG_CROSS_VERSION ?= v1.22.0

.DEFAULT_GOAL := dev

Expand Down Expand Up @@ -69,28 +69,28 @@ diff: ## git diff
build: ## Use goreleaser-cross (due to macOS CGo requirement) to run goreleaser --snapshot --skip=publish --clean
build: install
$(call print-target)
goreleaser --snapshot --skip=publish --clean
# docker run \
# --rm \
# -v /var/run/docker.sock:/var/run/docker.sock \
# -v `pwd`:/go/src/$(PACKAGE_NAME) \
# -w /go/src/$(PACKAGE_NAME) \
# ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
# --snapshot --skip=publish --clean
# goreleaser --snapshot --skip=publish --clean
docker run \
--rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
release --snapshot --skip publish --clean

.PHONY: release
release: ## Use goreleaser-cross (due to macOS CGo requirement) to run goreleaser --clean
release: install
$(call print-target)
goreleaser --clean
# docker run \
# --rm \
# -e GITHUB_TOKEN=${GITHUB_TOKEN} \
# -v /var/run/docker.sock:/var/run/docker.sock \
# -v `pwd`:/go/src/$(PACKAGE_NAME) \
# -w /go/src/$(PACKAGE_NAME) \
# ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
# --clean
# goreleaser --clean
docker run \
--rm \
-e GITHUB_TOKEN=${GITHUB_TOKEN} \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
release --clean

.PHONY: run
run: ## go run
Expand Down

0 comments on commit 442d7ff

Please sign in to comment.