1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-23 10:03:45 +00:00

Add linter to workflows

This commit is contained in:
Fenny 2020-05-12 23:05:07 +02:00
parent e719fa00bf
commit 8bfc40a1e9
6 changed files with 32 additions and 27 deletions

View File

@ -2,25 +2,22 @@ on: [push, pull_request]
name: Benchmark name: Benchmark
jobs: jobs:
Compare: Compare:
strategy: runs-on: ubuntu-latest
matrix:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps: steps:
- name: Install Go - name: Install Go
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
- name: Checkout code - name: Fetch Repository
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Run benchmark - name: Run Benchmark
run: go test -benchmem -run=^$ -bench . | tee output.txt run: go test -benchmem -run=^$ -bench . | tee output.txt
- name: Download previous benchmark data - name: Get Previous Benchmark Results
uses: actions/cache@v1 uses: actions/cache@v1
with: with:
path: ./cache path: ./cache
key: ${{ runner.os }}-benchmark key: ${{ runner.os }}-benchmark
- name: Store benchmark result - name: Save New Benchmark Results
uses: rhysd/github-action-benchmark@v1 uses: rhysd/github-action-benchmark@v1
with: with:
tool: 'go' tool: 'go'

10
.github/workflows/lint.yml vendored Normal file
View 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

View File

@ -2,16 +2,11 @@ on: [push, pull_request]
name: Security name: Security
jobs: jobs:
Gosec: Gosec:
strategy: runs-on: ubuntu-latest
matrix:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
env:
GO111MODULE: on
steps: steps:
- name: Checkout Source - name: Fetch Repository
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Run Gosec Security Scanner - name: Run Gosec
uses: securego/gosec@master uses: securego/gosec@master
with: with:
args: ./... args: ./...

View File

@ -1,10 +1,10 @@
on: [push, pull_request] on: [push, pull_request]
name: Test name: Test
jobs: jobs:
test: Build:
strategy: strategy:
matrix: 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] platform: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform }}
steps: steps:
@ -12,7 +12,7 @@ jobs:
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
- name: Checkout code - name: Fetch Repository
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Test - name: Run Test
run: go test -v -race run: go test -v -race

View File

@ -241,15 +241,17 @@ func Test_App_Listen(t *testing.T) {
DisableStartupMessage: true, DisableStartupMessage: true,
}) })
go func() { go func() {
time.Sleep(500 * time.Millisecond) time.Sleep(1 * time.Millisecond)
_ = app.Shutdown() _ = app.Shutdown()
}() }()
app.Listen(3002) err := app.Listen(3002)
assertEqual(t, nil, err)
go func() { go func() {
time.Sleep(500 * time.Millisecond) time.Sleep(500 * time.Millisecond)
_ = app.Shutdown() _ = app.Shutdown()
}() }()
app.Listen("3003") err = app.Listen("3003")
assertEqual(t, nil, err)
} }
func Test_App_Serve(t *testing.T) { func Test_App_Serve(t *testing.T) {
@ -265,5 +267,6 @@ func Test_App_Serve(t *testing.T) {
time.Sleep(500 * time.Millisecond) time.Sleep(500 * time.Millisecond)
_ = app.Shutdown() _ = app.Shutdown()
}() }()
app.Serve(ln) err = app.Serve(ln)
assertEqual(t, nil, err)
} }

View File

@ -202,9 +202,9 @@ func Benchmark_Ctx_Params(b *testing.B) {
var res string var res string
for n := 0; n < b.N; n++ { for n := 0; n < b.N; n++ {
res = c.Params("param1") _ = c.Params("param1")
res = c.Params("param2") _ = c.Params("param2")
res = c.Params("param3") _ = c.Params("param3")
res = c.Params("param4") res = c.Params("param4")
} }