Skip to content

Commit

Permalink
Build macOS artifacts on a darwin runner
Browse files Browse the repository at this point in the history
Cross-compiling from amd64 to arm64 with CGO_ENABLED=1 seems to only
work when GOOS is the same between compile host and target.

Signed-off-by: Jan Dubois <jan.dubois@suse.com>
  • Loading branch information
jandubois committed Oct 4, 2021
1 parent 1cd3aa6 commit f09603a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 7 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,33 @@ on:
env:
GO111MODULE: on
jobs:
artifacts-darwin:
name: Artifacts Darwin
runs-on: macos-11
timeout-minutes: 20
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.17.x
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Make darwin artifacts
run: make artifacts-darwin
- name: "Upload artifacts"
uses: actions/upload-artifact@v2
with:
name: artifacts-darwin
path: _artifact/
release:
runs-on: ubuntu-20.04
needs: artifacts-darwin
timeout-minutes: 20
steps:
- uses: actions/download-artifact@v2
with:
name: artifacts-darwin
path: _artifact/
- uses: actions/setup-go@v2
with:
go-version: 1.17.x
Expand Down
23 changes: 18 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,22 @@ jobs:
EXAMPLE: ${{ matrix.example }}
run: ./hack/test-example.sh examples/$EXAMPLE

artifacts:
name: Artifacts
# the release pipeline uses Linux, so we Linux here as well
artifacts-darwin:
name: Artifacts Darwin
runs-on: macos-11
timeout-minutes: 20
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.17.x
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Make darwin artifacts
run: make artifacts-darwin

artifacts-linux:
name: Artifacts Linux
runs-on: ubuntu-20.04
timeout-minutes: 20
steps:
Expand All @@ -179,5 +192,5 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Make artifacts
run: make artifacts
- name: Make linux artifacts
run: make artifacts-linux
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,17 @@ uninstall:
clean:
rm -rf _output

.PHONY: artifacts
artifacts:
.PHONY: artifacts-darwin
artifacts-darwin:
mkdir -p _artifacts
GOOS=darwin GOARCH=amd64 make clean binaries
$(TAR) -C _output/ -czvf _artifacts/lima-$(VERSION_TRIMMED)-Darwin-x86_64.tar.gz ./
GOOS=darwin GOARCH=arm64 make clean binaries
$(TAR) -C _output -czvf _artifacts/lima-$(VERSION_TRIMMED)-Darwin-arm64.tar.gz ./

.PHONY: artifacts-linux
artifacts-linux:
mkdir -p _artifacts
GOOS=linux GOARCH=amd64 make clean binaries
$(TAR) -C _output/ -czvf _artifacts/lima-$(VERSION_TRIMMED)-Linux-x86_64.tar.gz ./
GOOS=linux GOARCH=arm64 make clean binaries
Expand Down

0 comments on commit f09603a

Please sign in to comment.