Skip to content

Commit

Permalink
Try goreleaser-cross docker image instead
Browse files Browse the repository at this point in the history
  • Loading branch information
suprjinx committed Jul 17, 2023
1 parent c7653ef commit 7d86eec
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 13 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3

- name: Run GoReleaser to build release artifacts
uses: goreleaser/goreleaser-action@v4
with:
version: v1.18.2
args: release --snapshot --clean
- name: Run goreleaser in docker
run: |
docker run \
--rm \
-e CGO_ENABLED=1 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/fasttrackml \
-v `pwd`/sysroot:/sysroot \
-w /go/src/fasttrackml \
ghcr.io/goreleaser/goreleaser-cross:v1.19.5 \
release --snapshot --clean
- name: Upload release assets
uses: softprops/action-gh-release@v1
Expand Down
38 changes: 33 additions & 5 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,41 @@
project_name: fasttrackml
builds:
- id: linux-build
- id: darwin-amd64
main: ./
binary: {{ .ProjectName }}
goos:
- darwin
goarch:
- amd64
env:
- CGO_ENABLED=1
- CC_FOR_TARGET=aarch64-linux-gnu-gcc
- PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64
- PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig
- CC=o64-clang
- CXX=o64-clang++
flags:
- -mod=readonly
ldflags:
- -linkmode external -extldflags '-static' -s -w -X github.com/G-Research/fasttrackml/version.version={{.Version}}
- id: linux-armhf
main: ./
binary: golang-cross
goos:
- linux
goarch:
- amd64
- arm64
- arm
goarm:
- 7
env:
- CC=arm-linux-gnueabihf-gcc
- CXX=arm-linux-gnueabihf-g++
- CGO_CFLAGS=--sysroot=/sysroot/linux/armhf
- CGO_LDFLAGS=--sysroot=/sysroot/linux/armhf
- PKG_CONFIG_SYSROOT_DIR=/sysroot/linux/armhf
- PKG_CONFIG_PATH=/sysroot/linux/armhf/opt/vc/lib/pkgconfig:/sysroot/linux/armhf/usr/lib/arm-linux-gnueabihf/pkgconfig:/sysroot/linux/armhf/usr/lib/pkgconfig:/sysroot/linux/armhf/usr/local/lib/pkgconfig
flags:
- -mod=readonly
ldflags:
- -linkmode external -extldflags '-static' -s -w -X github.com/G-Research/fasttrackml/version.version={{.Version}}
archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
Expand All @@ -21,6 +46,9 @@ archives:
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
builds:
- darwin-amd64
- linux-armhf
# use zip for windows archives
format_overrides:
- goos: windows
Expand Down

0 comments on commit 7d86eec

Please sign in to comment.