nezha/.github/workflows/test.yml
2023-11-29 15:45:32 +08:00

47 lines
1.2 KiB
YAML

name: Run Tests
on:
push:
branches:
- master
paths-ignore:
- ".github/workflows/codeql-analysis.yml"
- ".github/workflows/test-on-pr.yml"
- ".github/workflows/contributors.yml"
- ".github/workflows/sync.yml"
- ".github/workflows/release.yml"
- "README.md"
- ".goreleaser.yml"
jobs:
tests:
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "^1.21.3"
- name: Unit test
run: |
go test -v ./...
- 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