Skip to content

Commit 89ea996

Browse files
committed
test releaser
1 parent 60cae23 commit 89ea996

File tree

3 files changed

+89
-66
lines changed

3 files changed

+89
-66
lines changed

.github/workflows/build.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- master
5+
6+
permissions:
7+
contents: write # needed to write releases
8+
9+
name: Build
10+
jobs:
11+
test-releaser:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Setup go
15+
uses: actions/setup-go@v2
16+
with:
17+
go-version: 1.23.x
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0 # this is important, otherwise it won't checkout the full tree (i.e. no previous tags)
22+
- name: Build
23+
env:
24+
PACKAGE_NAME: github.com/lets-cli/lets
25+
GOLANG_CROSS_VERSION: v1.23
26+
run: |
27+
docker run \
28+
--rm \
29+
-e CGO_ENABLED=1 \
30+
-v /var/run/docker.sock:/var/run/docker.sock \
31+
-v `pwd`:/go/src/${PACKAGE_NAME}\
32+
-v `pwd`/sysroot:/sysroot \
33+
-w /go/src/${PACKAGE_NAME} \
34+
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
35+
--clean --skip=validate --skip=publish --snapshot
36+
# - name: Releaser build
37+
# uses: goreleaser/goreleaser-action@v4
38+
# with:
39+
# distribution: goreleaser
40+
# version: v2.6.1
41+
# args: build --clean --skip=validate --snapshot --single-target
42+
# env:
43+
# GOOS: darwin
44+
# GOARCH: amd64
45+
# ZIG_LOCAL_CACHE_DIR: ${{ steps.set_env.outputs.current_dir }}
46+
# ZIG_GLOBAL_CACHE_DIR: ${{ steps.set_env.outputs.current_dir }}
47+
# SDK_PATH: ${{ steps.set_env.outputs.sdk_path }}

.github/workflows/test.yaml

Lines changed: 0 additions & 56 deletions
This file was deleted.

.goreleaser.yml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,51 @@ release:
99
prerelease: auto
1010

1111
builds:
12-
- env:
13-
- CGO_ENABLED=1
14-
goos:
15-
- linux
12+
- id: goreleaser-zig-cross-compilation-linux-macos
13+
goos:
1614
- darwin
17-
goarch:
15+
goarch:
1816
- amd64
1917
- arm64
20-
ignore:
21-
- goos: linux
22-
goarch: arm64
23-
ldflags:
24-
- -X main.version={{.Version}}
18+
ldflags:
19+
- -s -w -X main.version={{.Version}}
20+
flags:
21+
- -trimpath
22+
- -buildmode=pie
23+
env:
24+
- CGO_ENABLED=1
25+
- >-
26+
{{- if eq .Os "darwin" }}
27+
{{- if eq .Arch "amd64"}}CC=zig c -target x86_64-macos-none -F{{ .Env.SDK_PATH }}/System/Library/Frameworks{{- end }}
28+
{{- if eq .Arch "arm64"}}CC=zig c -target aarch64-macos-none -F{{ .Env.SDK_PATH }}/System/Library/Frameworks{{- end }}
29+
{{- end }}
30+
- >-
31+
{{- if eq .Os "darwin" }}
32+
{{- if eq .Arch "amd64"}}CC=zig c++ -target x86_64-macos-none -F{{ .Env.SDK_PATH }}/System/Library/Frameworks{{- end }}
33+
{{- if eq .Arch "arm64"}}CC=zig c++ -target aarch64-macos-none -F{{ .Env.SDK_PATH }}/System/Library/Frameworks{{- end }}
34+
{{- end }}
35+
- id: goreleaser-zig-cross-compilation-linux
36+
goos:
37+
- linux
38+
goarch:
39+
- amd64
40+
# - arm64
41+
ldflags:
42+
- -s -w -X main.version={{.Version}}
43+
flags:
44+
- -trimpath
45+
env:
46+
- CGO_ENABLED=1
47+
- >-
48+
{{- if eq .Os "linux" }}
49+
{{- if eq .Arch "amd64" }}CC=zig c -target x86_64-linux-musl{{- end }}
50+
{{- if eq .Arch "arm64"}}CC=zig c -target aarch64-linux-musl{{- end }}
51+
{{- end }}
52+
- >-
53+
{{- if eq .Os "linux" }}
54+
{{- if eq .Arch "amd64" }}CC=zig c++ -target x86_64-linux-musl{{- end }}
55+
{{- if eq .Arch "arm64"}}CC=zig c++ -target aarch64-linux-musl{{- end }}
56+
{{- end }}
2557
2658
archives:
2759
- formats: [tar.gz]

0 commit comments

Comments
 (0)