Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
918bfeb
add compile on macos action
alphanota Jan 8, 2025
a75e27c
remove scape strings in main compilation rule
alphanota Jan 8, 2025
440ba17
Merge branch 'GoogleContainerTools:main' into fix-kokoro-v3
alphanota Jan 8, 2025
d1547fa
remove escape string in .cross build rule as well
alphanota Jan 8, 2025
c5fe2d8
fix go version
alphanota Jan 8, 2025
290d873
put all of -extldflags and its options in quotes
alphanota Jan 8, 2025
045b55a
set the entire -extlflags option in quotes in buildpack depedency
alphanota Jan 8, 2025
03b5a44
add verbose flag to go build
alphanota Jan 8, 2025
18a6e09
use docker to cross-compile
alphanota Jan 10, 2025
6958cc4
use docker to cross-compile
alphanota Jan 10, 2025
2d443a5
install docker with homebrew
alphanota Jan 10, 2025
451b421
use cask to install docker
alphanota Jan 10, 2025
3705b90
try installing docker from .dmg file
alphanota Jan 10, 2025
7ce47c3
try installing docker from .dmg file
alphanota Jan 10, 2025
51c5c00
use cask
alphanota Jan 10, 2025
0ca0356
use dockerd
alphanota Jan 10, 2025
60ef79c
use install docker action
alphanota Jan 10, 2025
7fb7268
use macos amd64
alphanota Jan 11, 2025
c38c5ae
remove some commands
alphanota Jan 11, 2025
0776d74
remove some commands
alphanota Jan 11, 2025
91dcbf0
remove some commands
alphanota Jan 11, 2025
d49c964
remove some commands
alphanota Jan 11, 2025
6c209c6
remove some commands
alphanota Jan 11, 2025
df9d2f3
remove some commands
alphanota Jan 11, 2025
01de85f
make changes
alphanota Jan 11, 2025
1ee9ce2
change docker command
alphanota Jan 11, 2025
8873eaf
change docker command
alphanota Jan 11, 2025
c0e686c
change docker command
alphanota Jan 11, 2025
96b4275
change docker command
alphanota Jan 11, 2025
32d2c83
change docker command
alphanota Jan 11, 2025
0337256
change docker command
alphanota Jan 11, 2025
038d8bc
debug the workflow
alphanota Jan 11, 2025
e3a6934
debug the workflow
alphanota Jan 11, 2025
41a0be7
debug the workflow
alphanota Jan 11, 2025
1bbef1a
test
alphanota Jan 11, 2025
5875162
make all lima mount points writable
alphanota Jan 11, 2025
2d5afc1
make all lima mount points writable
alphanota Jan 11, 2025
a06672a
use docker
alphanota Jan 11, 2025
4ee7c58
fix matrix.platforms
alphanota Jan 11, 2025
eee0b19
remove -arch flags from Makefile
alphanota Jan 12, 2025
a694c6a
modify makefile
alphanota Jan 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/compile-mac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Cross-Compile skaffold on MacOS

# Triggers the workflow on push or pull request events
on: [push, pull_request]

permissions: read-all

concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}-${{github.workflow}}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:

build:
name: Cross-Compile skaffold on MacOS
runs-on: macos-15-large
strategy:
matrix:
platforms: [linux-amd64, darwin-amd64, windows-amd64.exe, linux-arm64, darwin-arm64]
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Docker
uses: docker/setup-docker-action@v4
env:
LIMA_START_ARGS: --mount-writable

- name: Make and install Skaffold binary from current PR
run: |
docker run --rm \
-v ${PWD}:/skaffold \
-w /skaffold \
golang:1.23.4 /bin/bash -c " \
git config --global --add safe.directory /skaffold; \
make ./out/VERSION; \
make ./out/skaffold-${{ matrix.platforms }}"
26 changes: 24 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
GOVERSION ?= 1.23.4
GOPATH ?= $(shell go env GOPATH)
GOBIN ?= $(or $(shell go env GOBIN),$(GOPATH)/bin)
GOOS ?= $(shell go env GOOS)
Expand Down Expand Up @@ -93,12 +94,33 @@ install: $(BUILD_DIR)/$(PROJECT)
.PHONY: cross
cross: $(foreach platform, $(SUPPORTED_PLATFORMS), $(BUILD_DIR)/$(PROJECT)-$(platform))

$(BUILD_DIR)/$(PROJECT)-%: $(EMBEDDED_FILES_CHECK) $(GO_FILES) $(BUILD_DIR)
.PHONY $(BUILD_DIR)/$(PROJECT)-%:
$(BUILD_DIR)/$(PROJECT)-%:
$(eval os = $(firstword $(subst -, ,$*)))
$(eval goarch = $(lastword $(subst -, ,$(subst .exe,,$*))))
$(eval image_platform = $(shell \
if [[ $(os) == "darwin" ]]; then \
echo darwin-arm64; \
elif [[ $(goarch) == "arm64" ]]; then \
echo arm; \
else \
echo main; \
fi \
))
@echo $(image_platform)
docker run --rm \
-v $(CURDIR):/skaffold \
-w /skaffold \
docker.elastic.co/beats-dev/golang-crossbuild:$(GOVERSION)-$(image_platform)-debian12 \
-p="$(os)/$(goarch)" \
--build-cmd="git config --global --add safe.directory /skaffold;make ./out/docker-skaffold-$(os)-$(goarch)"

$(BUILD_DIR)/docker-$(PROJECT)-%: $(EMBEDDED_FILES_CHECK) $(GO_FILES) $(BUILD_DIR)
$(eval os = $(firstword $(subst -, ,$*)))
$(eval arch = $(lastword $(subst -, ,$(subst .exe,,$*))))
$(eval ldflags = $(GO_LDFLAGS) $(patsubst %,-extldflags \"%\",$(LDFLAGS_$(os))))
$(eval tags = $(GO_BUILD_TAGS) $(GO_BUILD_TAGS_$(os)) $(GO_BUILD_TAGS_$(os)_$(arch)))
GOOS=$(os) GOARCH=$(arch) CGO_ENABLED=1 go build -mod="vendor" -tags "$(tags)" -ldflags "$(ldflags)" -o $@ ./cmd/skaffold
CGO_ENABLED=1 go build -mod="vendor" -tags "$(tags)" -ldflags "$(ldflags)" -o $@ ./cmd/skaffold
(cd `dirname $@`; shasum -a 256 `basename $@`) | tee $@.sha256
file $@ || true

Expand Down