File tree Expand file tree Collapse file tree 1 file changed +34
-13
lines changed
Expand file tree Collapse file tree 1 file changed +34
-13
lines changed Original file line number Diff line number Diff line change 1919
2020jobs :
2121 build :
22- name : Build (${{ matrix.goos }}/${{ matrix.goarch }})
23- runs-on : ubuntu-latest
2422 strategy :
2523 fail-fast : false
2624 matrix :
27- goos : [linux, darwin]
28- goarch : [amd64, arm64]
29-
25+ include :
26+ - os : ubuntu-latest
27+ goos : linux
28+ goarch : amd64
29+ - os : ubuntu-latest
30+ goos : linux
31+ goarch : arm64
32+ cc : aarch64-linux-gnu-gcc
33+ cxx : aarch64-linux-gnu-g++
34+ - os : macos-latest
35+ goos : darwin
36+ goarch : amd64
37+ - os : macos-latest
38+ goos : darwin
39+ goarch : arm64
40+ runs-on : ${{ matrix.os }}
3041 steps :
31- - name : Checkout
32- uses : actions/checkout@v4
42+ - uses : actions/checkout@v4
3343
34- - name : Set up Go
35- uses : actions/setup-go@v5
44+ - uses : actions/setup-go@v5
3645 with :
3746 go-version : ' >=1.22'
3847 cache : true
3948
49+ - name : Install cross compiler (linux/arm64)
50+ if : ${{ matrix.cc == 'aarch64-linux-gnu-gcc' }}
51+ run : |
52+ sudo apt-get update
53+ sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
54+
4055 - name : Test
56+ if : ${{ matrix.goos == 'linux' }}
4157 run : go test ./...
4258
4359 - name : Build
4460 shell : bash
61+ env :
62+ CC : ${{ matrix.cc }}
63+ CXX : ${{ matrix.cxx }}
64+ CGO_ENABLED : 1
65+ GOOS : ${{ matrix.goos }}
66+ GOARCH : ${{ matrix.goarch }}
4567 run : |
4668 set -euxo pipefail
4769 mkdir -p dist
48- OUT="dist/${APP_NAME}_${VERSION}_${{ matrix.goos }}_${{ matrix.goarch }}"
49- CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} \
50- go build -trimpath -ldflags="-s -w -X main.version=${VERSION}" -o "$OUT" .
51- (cd dist && sha256sum "$(basename "$OUT")" > "$(basename "$OUT").sha256")
70+ OUT="dist/${APP_NAME}_${VERSION}_${GOOS}_${GOARCH}"
71+ go build -trimpath -ldflags="-s -w -X main.version=${VERSION}" -o "$OUT" .
72+ (cd dist && sha256sum "$(basename "$OUT")" > "$(basename "$OUT").sha256" || shasum -a 256 "$(basename "$OUT")" > "$(basename "$OUT").sha256")
5273
5374 - name : Upload artifact
5475 uses : actions/upload-artifact@v4
You can’t perform that action at this time.
0 commit comments