Skip to content

Commit

Permalink
feat: Apple Silicon local development support (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsmalls93 authored Apr 22, 2024
1 parent a92a2d2 commit ab14a59
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
34 changes: 29 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,31 @@ RELEASE_TAG ?= $(shell bash build/gettag.sh)

export GOBIN := $(INSTALL_PREFIX)/bin
export PATH := $(GOBIN):$(PATH)
export MAC_CPU_BRAND=$(sysctl -n machdep.cpu.brand_string)

ifeq ($(findstring Apple,$(MAC_CPU_BRAND)),APPLE)
export IS_APPLE_SILICON=true
else
export IS_APPLE_SILICON=false
endif

ifeq ($(IS_APPLE_SILICON),true)
export SKAFFOLD_URL=https://storage.googleapis.com/skaffold/releases/latest/skaffold-darwin-arm64
else
export SKAFFOLD_URL=https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
endif

ifeq ($(IS_APPLE_SILICON),true)
export SQLC_URL=https://downloads.sqlc.dev/sqlc_1.25.0_darwin_arm64.tar.gz
else
export SQLC_URL=https://downloads.sqlc.dev/sqlc_1.25.0_linux_amd64.tar.gz
endif

ifeq ($(IS_APPLE_SILICON),true)
export SWAG_URL=https://github.com/swaggo/swag/releases/download/v1.16.2/swag_1.16.2_Darwin_arm64.tar.gz
else
export SWAG_URL=https://github.com/swaggo/swag/releases/download/v1.16.2/swag_1.16.2_Linux_x86_64.tar.gz
endif

##@ Commands

Expand All @@ -27,8 +52,7 @@ info: ## Show build info
generate: $(GOBIN)/sqlc $(GOBIN)/swag ## Generate code
go generate ./...

e2e: testinfra ## Deploy the end-to-end setup
$(MAKE) deploy
e2e: testinfra deploy ## Deploy the end-to-end setup

testinfra: $(GOBIN)/skaffold ## Create test infrastructure
bash -x e2e/kind/up.sh
Expand Down Expand Up @@ -81,19 +105,19 @@ $(GOBIN)/makehelp: | $(GOBIN)
| install /dev/stdin $(GOBIN)/makehelp

$(GOBIN)/skaffold: | $(GOBIN)
curl -fsSL https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 \
curl -fsSL $(SKAFFOLD_URL) \
| install /dev/stdin $(GOBIN)/skaffold

$(GOBIN)/golangci-lint: | $(GOBIN)
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
| sh -s -- -b $(GOBIN) v1.55.2

$(GOBIN)/sqlc: | $(GOBIN)
curl -fsSL https://downloads.sqlc.dev/sqlc_1.25.0_linux_amd64.tar.gz \
curl -fsSL $(SQLC_URL) \
| tar -C $(GOBIN) -xzf - sqlc

$(GOBIN)/swag: | $(GOBIN)
curl -fsSL https://github.com/swaggo/swag/releases/download/v1.16.2/swag_1.16.2_Linux_x86_64.tar.gz \
curl -fsSL $(SWAG_URL) \
| tar -C $(GOBIN) -xzf - swag

$(GOBIN)/sqlite3: | $(GOBIN)
Expand Down
2 changes: 2 additions & 0 deletions git/copy_linux.go → git/copy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build linux || darwin

package git

import (
Expand Down

0 comments on commit ab14a59

Please sign in to comment.