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