Skip to content

Commit

Permalink
release: use osxcross for better cross compiling support
Browse files Browse the repository at this point in the history
Updates the release process to perform better cross compiling support
and ultimately, set `CGO_ENABLED=1` in the releases.

This does drop Windows and FreeBSD support however, I don't have a great
testing story for them at the moment so we can revisit when/if the
request arises.
  • Loading branch information
jacobbednarz committed Jun 27, 2023
1 parent 46191e7 commit 320940f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: "1.20"
- name: OSXCross for CGO Support
run: |
mkdir ../../osxcross
git clone https://github.com/plentico/osxcross-target.git ../../osxcross/target
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
Expand Down
33 changes: 27 additions & 6 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
builds:
- env:
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
- id: linux-build
flags:
- -trimpath
asmflags:
Expand All @@ -10,16 +8,39 @@ builds:
- all=-trimpath=$GOPATH
ldflags:
- -s -w -X github.com/jacobbednarz/cf-vault/cmd.Rev={{ .Version }}
env:
- CGO_ENABLED=1
goos:
- darwin
- freebsd
- linux
- windows
ignore:
- goos: linux
goarch: "386"
- id: darwin-build
flags:
- -trimpath
asmflags:
- all=-trimpath=$GOPATH
gcflags:
- all=-trimpath=$GOPATH
ldflags:
- -s -w -X github.com/jacobbednarz/cf-vault/cmd.Rev={{ .Version }}
env:
- CGO_ENABLED=1
- CC=/home/runner/work/osxcross/target/bin/o64-clang
- CXX=/home/runner/work/osxcross/target/bin/o64-clang++
goos:
- darwin
ignore:
- goos: darwin
goarch: "386"

archives:
- format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'

checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256

changelog:
skip: true

0 comments on commit 320940f

Please sign in to comment.