2021-09-04 00:51:02 -04:00
|
|
|
name: Run Tests on PR
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
jobs:
|
|
|
|
tests:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
GO111MODULE: on
|
|
|
|
steps:
|
2023-10-21 06:27:25 -04:00
|
|
|
- uses: actions/checkout@v4
|
2023-05-10 12:08:54 -04:00
|
|
|
- uses: actions/setup-go@v4
|
2021-11-04 00:55:12 -04:00
|
|
|
with:
|
2023-10-21 06:27:25 -04:00
|
|
|
go-version: "^1.21.3"
|
2021-09-04 00:51:02 -04:00
|
|
|
- name: Unit test
|
|
|
|
run: |
|
|
|
|
go test -v ./...
|
|
|
|
- name: Run Gosec Security Scanner
|
2023-10-21 06:27:25 -04:00
|
|
|
uses: securego/gosec@master
|
|
|
|
with:
|
2023-10-21 10:21:21 -04:00
|
|
|
args: --exclude=G104,G402 ./...
|
2023-11-29 02:45:32 -05:00
|
|
|
- name: xgo build
|
|
|
|
uses: crazy-max/ghaction-xgo@v2
|
|
|
|
with:
|
|
|
|
xgo_version: latest
|
2024-04-06 02:25:29 -04:00
|
|
|
go_version: 1.20.x
|
2023-11-29 02:45:32 -05:00
|
|
|
dest: dist
|
|
|
|
pkg: cmd/dashboard
|
|
|
|
prefix: dashboard
|
2024-04-05 23:51:08 -04:00
|
|
|
targets: linux/amd64,linux/arm64,linux/arm-7,linux/s390x,linux/riscv64,windows/amd64,windows/386,windows/arm64 # linux/386,
|
2023-11-29 02:45:32 -05:00
|
|
|
v: true
|
|
|
|
x: false
|
|
|
|
race: false
|
|
|
|
ldflags: -s -w --extldflags '-static -fpic' -X github.com/naiba/nezha/service/singleton.Version=test
|
|
|
|
buildmode: default
|
|
|
|
|