2021-09-04 12:51:02 +08:00
|
|
|
name: Run Tests
|
|
|
|
|
2021-09-04 12:18:12 +08:00
|
|
|
on:
|
|
|
|
push:
|
2023-11-30 09:52:24 +08:00
|
|
|
paths:
|
|
|
|
- "**.go"
|
|
|
|
- "go.mod"
|
|
|
|
- "go.sum"
|
|
|
|
- "resource/**"
|
|
|
|
- ".github/workflows/test.yml"
|
2024-10-20 23:23:04 +08:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
|
2021-09-04 12:18:12 +08:00
|
|
|
jobs:
|
|
|
|
tests:
|
2024-09-02 22:13:13 +08:00
|
|
|
strategy:
|
|
|
|
fail-fast: true
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu, windows, macos]
|
|
|
|
|
|
|
|
runs-on: ${{ matrix.os }}-latest
|
2021-09-04 12:18:12 +08:00
|
|
|
env:
|
|
|
|
GO111MODULE: on
|
|
|
|
steps:
|
2023-10-21 18:27:25 +08:00
|
|
|
- uses: actions/checkout@v4
|
2024-09-02 22:13:13 +08:00
|
|
|
|
|
|
|
- uses: actions/setup-go@v5
|
2021-11-04 12:55:12 +08:00
|
|
|
with:
|
2024-10-17 21:03:03 +08:00
|
|
|
go-version: "1.23.x"
|
2024-10-19 23:17:14 +08:00
|
|
|
|
|
|
|
- name: bootstrap
|
|
|
|
run: |
|
|
|
|
go install github.com/swaggo/swag/cmd/swag@latest
|
2024-10-20 14:09:29 +08:00
|
|
|
swag init --pd -d . -g ./cmd/dashboard/main.go -o ./cmd/dashboard/docs
|
2024-09-02 22:13:13 +08:00
|
|
|
|
2021-09-04 12:18:12 +08:00
|
|
|
- name: Unit test
|
|
|
|
run: |
|
|
|
|
go test -v ./...
|
2024-09-02 22:13:13 +08:00
|
|
|
|
|
|
|
- name: Build test
|
|
|
|
run: go build -v ./cmd/dashboard
|
|
|
|
|
2021-09-04 12:18:12 +08:00
|
|
|
- name: Run Gosec Security Scanner
|
2024-09-02 22:13:13 +08:00
|
|
|
if: runner.os == 'Linux'
|
2023-10-21 18:27:25 +08:00
|
|
|
uses: securego/gosec@master
|
|
|
|
with:
|
2024-10-02 10:10:06 +08:00
|
|
|
args: --exclude=G104,G402,G115,G203 ./...
|