Skip to content

Commit

Permalink
test releaser
Browse files Browse the repository at this point in the history
  • Loading branch information
kindermax committed Jan 27, 2025
1 parent 60cae23 commit 036a314
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 10 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
on:
pull_request:
branches:
- master

name: Build
jobs:
test-releaser:
# runs-on: ubuntu-latest
runs-on: macos-latest
# strategy:
# matrix:
# platform: [ubuntu-latest, macos-latest]
# runs-on: ${{ matrix.platform }}
steps:
# - name: Install Dependencies (macOS)
# if: runner.os == 'macOS'
# run: brew install bash
- name: Setup go
uses: actions/setup-go@v2
with:
go-version: 1.23.x
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # this is important, otherwise it won't checkout the full tree (i.e. no previous tags)
- uses: mlugg/setup-zig@v1
with:
version: 0.13.0
# - name: Install Zig
# run: |
# curl -LO https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz
# tar -xf zig-linux-x86_64-0.13.0.tar.xz
# sudo mv zig-linux-x86_64-0.13.0 /usr/local/zig
# echo 'export PATH=/usr/local/zig:$PATH' >> $GITHUB_ENV
# - name: Show compliler env
# run: |
# go env
# gcc --version || echo "No gcc"
# clang --version || echo "No clang"
# sudo apt-get update && sudo apt-get install -y \
# curl \
# gcc-aarch64-linux-gnu \
# gcc-arm-linux-gnueabi \
- name: Releaser build
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: v2.6.1
args: build --clean --skip=validate --snapshot
env:
SDK_PATH: ${{ steps.macos_sdk.outputs.path }}
52 changes: 42 additions & 10 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,51 @@ release:
prerelease: auto

builds:
- env:
- CGO_ENABLED=1
goos:
- linux
- id: goreleaser-zig-cross-compilation-linux-macos
goos:
- darwin
goarch:
goarch:
- amd64
- arm64
ignore:
- goos: linux
goarch: arm64
ldflags:
- -X main.version={{.Version}}
ldflags:
- -s -w -X main.version={{.Version}}
flags:
- -trimpath
- -buildmode=pie
env:
- CGO_ENABLED=1
- >-
{{- if eq .Os "darwin" }}
{{- if eq .Arch "amd64"}}CC=zig c -target x86_64-macos-none -F{{ .Env.SDK_PATH }}/System/Library/Frameworks{{- end }}
{{- if eq .Arch "arm64"}}CC=zig c -target aarch64-macos-none -F{{ .Env.SDK_PATH }}/System/Library/Frameworks{{- end }}
{{- end }}
- >-
{{- if eq .Os "darwin" }}
{{- if eq .Arch "amd64"}}CC=zig c++ -target x86_64-macos-none -F{{ .Env.SDK_PATH }}/System/Library/Frameworks{{- end }}
{{- if eq .Arch "arm64"}}CC=zig c++ -target aarch64-macos-none -F{{ .Env.SDK_PATH }}/System/Library/Frameworks{{- end }}
{{- end }}
- id: goreleaser-zig-cross-compilation-linux
goos:
- linux
goarch:
- amd64
# - arm64
ldflags:
- -s -w -X main.version={{.Version}}
flags:
- -trimpath
env:
- CGO_ENABLED=1
- >-
{{- if eq .Os "linux" }}
{{- if eq .Arch "amd64" }}CC=zig c -target x86_64-linux-musl{{- end }}
{{- if eq .Arch "arm64"}}CC=zig c -target aarch64-linux-musl{{- end }}
{{- end }}
- >-
{{- if eq .Os "linux" }}
{{- if eq .Arch "amd64" }}CC=zig c++ -target x86_64-linux-musl{{- end }}
{{- if eq .Arch "arm64"}}CC=zig c++ -target aarch64-linux-musl{{- end }}
{{- end }}
archives:
- formats: [tar.gz]
Expand Down

0 comments on commit 036a314

Please sign in to comment.