Skip to content

Commit

Permalink
Use goreleaser-cross for build
Browse files Browse the repository at this point in the history
  • Loading branch information
suprjinx committed Jul 17, 2023
1 parent 7d86eec commit 040e9c3
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
-v `pwd`:/go/src/fasttrackml \
-v `pwd`/sysroot:/sysroot \
-w /go/src/fasttrackml \
ghcr.io/goreleaser/goreleaser-cross:v1.19.5 \
ghcr.io/goreleaser/goreleaser-cross:v1.20 \
release --snapshot --clean
- name: Upload release assets
Expand Down
70 changes: 55 additions & 15 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,77 @@
project_name: fasttrackml
env:
- CGO_ENABLED=1
builds:
- id: darwin-amd64
main: ./
binary: {{ .ProjectName }}
binary: fasttrackml
goos:
- darwin
goarch:
- amd64
env:
- 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

- id: darwin-arm64
main: ./
binary: golang-cross
binary: fasttrackml
goos:
- darwin
goarch:
- arm64
env:
- CC=oa64-clang
- CXX=oa64-clang++
flags:
- -mod=readonly
ldflags:
- -linkmode external -extldflags '-static' -s -w -X github.com/G-Research/fasttrackml/version.version={{.Version}}

- id: linux-arm64
main: ./
binary: fasttrackml
goos:
- linux
goarch:
- arm64
env:
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
flags:
- -mod=readonly
ldflags:
- -linkmode external -extldflags '-static' -s -w -X github.com/G-Research/fasttrackml/version.version={{.Version}}

- id: linux-amd64
main: ./
binary: fasttrackml
goos:
- linux
goarch:
- arm
goarm:
- 7
- amd64
env:
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
flags:
- -mod=readonly
ldflags:
- -linkmode external -extldflags '-static' -s -w -X github.com/G-Research/fasttrackml/version.version={{.Version}}

- id: windows-amd64
main: ./
binary: fasttrackml
goos:
- windows
goarch:
- amd64
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
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
flags:
- -mod=readonly
ldflags:
Expand All @@ -48,7 +88,7 @@ archives:
{{- if .Arm }}v{{ .Arm }}{{ end }}
builds:
- darwin-amd64
- linux-armhf
- linux-arm64
# use zip for windows archives
format_overrides:
- goos: windows
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,15 @@ PHONY: run
run: build ## run the FastTrackML server
@echo ">>> Running the FasttrackML server."
./$(APP) server

PHONY: release
release:
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.20 \
release --clean --snapshot

0 comments on commit 040e9c3

Please sign in to comment.