Skip to content

Commit

Permalink
split gh action into lint and tests, add golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mvrilo committed Jan 20, 2024
1 parent 7cdf2a7 commit 1b30ca7
Show file tree
Hide file tree
Showing 5 changed files with 1,621 additions and 25 deletions.
38 changes: 25 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
name: CI
on: [push, pull_request]
on: [pull_request]
permissions:
contents: read
jobs:
lint:
strategy:
matrix:
go: ['1.16','1.21']
os: ['ubuntu-latest']
name: lint
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v3
- uses: golangci/golangci-lint-action@v3
test:
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.16','1.21']
os: ['ubuntu-latest']
name: test
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.20.x
- uses: actions/checkout@v3
- run: go vet ./...
- uses: golangci/[email protected]
with:
version: latest
skip-build-cache: true
skip-pkg-cache: true
- run: go test -race ./...
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v3
- run: go test -race ./...
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
REDOC_PATH=assets/redoc.standalone.js
REDOC_URL=https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js

all: $(REDOC_PATH)
all: $(REDOC_PATH) lint test

lint:
go fmt ./...
go vet ./...
go test ./...
go run github.com/golangci/golangci-lint/cmd/golangci-lint run ./...

test:
go test -race ./...

$(REDOC_PATH):
curl -sL -o $(REDOC_PATH) $(REDOC_URL)
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/gin-gonic/gin v1.9.1
github.com/gofiber/adaptor/v2 v2.2.1
github.com/gofiber/fiber/v2 v2.46.0
github.com/golangci/golangci-lint v1.55.2
github.com/labstack/echo/v4 v4.10.2
github.com/stretchr/testify v1.8.3
github.com/stretchr/testify v1.8.4
)
Loading

0 comments on commit 1b30ca7

Please sign in to comment.