📦 static link

This commit is contained in:
naiba 2023-11-29 15:45:32 +08:00
parent b0b7e9da61
commit a823da1f29
3 changed files with 30 additions and 7 deletions

View File

@ -30,7 +30,7 @@ jobs:
v: true
x: false
race: false
ldflags: -s -w -X github.com/naiba/nezha/service/singleton.Version=${{ steps.extract_branch.outputs.tag }}
ldflags: -s -w --extldflags '-static -fpic' -X github.com/naiba/nezha/service/singleton.Version=${{ steps.extract_branch.outputs.tag }}
buildmode: default
- name: fix dist

View File

@ -17,10 +17,22 @@ jobs:
- name: Unit test
run: |
go test -v ./...
- name: Build test
run: |
go build cmd/dashboard/main.go
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: --exclude=G104,G402 ./...
- name: xgo build
uses: crazy-max/ghaction-xgo@v2
with:
xgo_version: latest
go_version: 1.21
dest: dist
pkg: cmd/dashboard
prefix: dashboard
targets: linux/amd64,linux/arm64,linux/arm-7,linux/s390x,linux/riscv64 # linux/386,
v: true
x: false
race: false
ldflags: -s -w --extldflags '-static -fpic' -X github.com/naiba/nezha/service/singleton.Version=test
buildmode: default

View File

@ -26,10 +26,21 @@ jobs:
- name: Unit test
run: |
go test -v ./...
- name: Build test
run: |
go build cmd/dashboard/main.go
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: --exclude=G104,G402 ./...
- name: xgo build
uses: crazy-max/ghaction-xgo@v2
with:
xgo_version: latest
go_version: 1.21
dest: dist
pkg: cmd/dashboard
prefix: dashboard
targets: linux/amd64,linux/arm64,linux/arm-7,linux/s390x,linux/riscv64 # linux/386,
v: true
x: false
race: false
ldflags: -s -w --extldflags '-static -fpic' -X github.com/naiba/nezha/service/singleton.Version=test
buildmode: default