mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-22 09:53:24 +00:00
Add linter to workflows
This commit is contained in:
parent
e719fa00bf
commit
8bfc40a1e9
13
.github/workflows/benchmark.yml
vendored
13
.github/workflows/benchmark.yml
vendored
@ -2,25 +2,22 @@ on: [push, pull_request]
|
||||
name: Benchmark
|
||||
jobs:
|
||||
Compare:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Checkout code
|
||||
- name: Fetch Repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Run benchmark
|
||||
- name: Run Benchmark
|
||||
run: go test -benchmem -run=^$ -bench . | tee output.txt
|
||||
- name: Download previous benchmark data
|
||||
- name: Get Previous Benchmark Results
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ./cache
|
||||
key: ${{ runner.os }}-benchmark
|
||||
- name: Store benchmark result
|
||||
- name: Save New Benchmark Results
|
||||
uses: rhysd/github-action-benchmark@v1
|
||||
with:
|
||||
tool: 'go'
|
||||
|
10
.github/workflows/lint.yml
vendored
Normal file
10
.github/workflows/lint.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
on: [push, pull_request]
|
||||
name: Linter
|
||||
jobs:
|
||||
Golint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch Repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Run Golint
|
||||
uses: actions-contrib/golangci-lint@v1
|
11
.github/workflows/security.yml
vendored
11
.github/workflows/security.yml
vendored
@ -2,16 +2,11 @@ on: [push, pull_request]
|
||||
name: Security
|
||||
jobs:
|
||||
Gosec:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Source
|
||||
- name: Fetch Repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Run Gosec Security Scanner
|
||||
- name: Run Gosec
|
||||
uses: securego/gosec@master
|
||||
with:
|
||||
args: ./...
|
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
@ -1,10 +1,10 @@
|
||||
on: [push, pull_request]
|
||||
name: Test
|
||||
jobs:
|
||||
test:
|
||||
Build:
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.11.x, 1.12.x, 1.13.x, 1.14.x]
|
||||
go-version: [1.11.x, 1.14.x]
|
||||
platform: [ubuntu-latest, windows-latest]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
@ -12,7 +12,7 @@ jobs:
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Checkout code
|
||||
- name: Fetch Repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Test
|
||||
- name: Run Test
|
||||
run: go test -v -race
|
11
app_test.go
11
app_test.go
@ -241,15 +241,17 @@ func Test_App_Listen(t *testing.T) {
|
||||
DisableStartupMessage: true,
|
||||
})
|
||||
go func() {
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
time.Sleep(1 * time.Millisecond)
|
||||
_ = app.Shutdown()
|
||||
}()
|
||||
app.Listen(3002)
|
||||
err := app.Listen(3002)
|
||||
assertEqual(t, nil, err)
|
||||
go func() {
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
_ = app.Shutdown()
|
||||
}()
|
||||
app.Listen("3003")
|
||||
err = app.Listen("3003")
|
||||
assertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_App_Serve(t *testing.T) {
|
||||
@ -265,5 +267,6 @@ func Test_App_Serve(t *testing.T) {
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
_ = app.Shutdown()
|
||||
}()
|
||||
app.Serve(ln)
|
||||
err = app.Serve(ln)
|
||||
assertEqual(t, nil, err)
|
||||
}
|
||||
|
@ -202,9 +202,9 @@ func Benchmark_Ctx_Params(b *testing.B) {
|
||||
|
||||
var res string
|
||||
for n := 0; n < b.N; n++ {
|
||||
res = c.Params("param1")
|
||||
res = c.Params("param2")
|
||||
res = c.Params("param3")
|
||||
_ = c.Params("param1")
|
||||
_ = c.Params("param2")
|
||||
_ = c.Params("param3")
|
||||
res = c.Params("param4")
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user