Skip to content

Commit

Permalink
up acion
Browse files Browse the repository at this point in the history
  • Loading branch information
eudore committed Aug 31, 2023
1 parent d247ba3 commit 27f4183
Show file tree
Hide file tree
Showing 98 changed files with 12,865 additions and 8,602 deletions.
159 changes: 76 additions & 83 deletions .github/workflows/go.yml → .github/workflows/github-action.yml
Original file line number Diff line number Diff line change
@@ -1,83 +1,76 @@
name: Run Tests
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- uses: golangci/golangci-lint-action@v3
continue-on-error: true
with:
args: --verbose --disable errcheck
test:
needs: lint
strategy:
max-parallel: 2
matrix:
os: [macos, ubuntu]
go: ["1.18"]
include:
- os: macos
gopath: /Users/runner/go
gocache: /Users/runner/Library/Caches/go-build
- os: ubuntu
gopath: /home/runner/go
gocache: /home/runner/.cache/go-build
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}-latest
env:
GO111MODULE: off
GOPATH: ${{ matrix.gopath }}:${{ github.workspace }}
CGO_ENABLED: 1
WORKDIR: src/github.com/eudore/eudore/
PACKAGES: github.com/eudore/eudore,github.com/eudore/eudore/middleware
defaults:
run:
working-directory: ${{ env.WORKDIR }}
steps:
- uses: actions/checkout@v3
with:
path: ${{ env.WORKDIR }}
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: actions/cache@v3
with:
key: ${{ runner.os }}-go-${{ hashFiles('src/github.com/eudore/eudore/go.mod') }}
restore-keys: ${{ runner.os }}-go-
path: |
${{ matrix.gopath }}
${{ matrix.gocache }}
- name: Run Debug
run: rm -f _example/xxxlogger_test.go
- name: Run Go Get
run: for pkg in $(go list -json _example/*_test.go | jq -r '.XTestImports[]' | grep -E "github|monkey" | grep -v eudore); do go get -v $pkg; done
- name: Run Tests
run: set -o pipefail;go test -v -timeout=1m -race -cover -coverprofile=coverage.out -coverpkg='${{ env.PACKAGES }}' _example/*_test.go | tee output;
- name: Run Notice
if: ${{ strategy.job-index == 0 }}
run: 'echo "::notice::$(tail -3 output | grep "coverage: ")"'
- name: Run Coverage
if: ${{ strategy.job-index == 0 }}
run: go tool cover -html coverage.out -o coverage.html
- uses: actions/upload-artifact@v3
if: ${{ strategy.job-index == 0 }}
with:
name: Coverage-eudore-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.go }}
path: ${{ env.WORKDIR }}/coverage.html
- uses: codecov/codecov-action@v3
if: ${{ strategy.job-index == 0xf }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ env.WORKDIR }}/coverage.out
flags: ${{ matrix.os }},go-${{ matrix.go }}
verbose: true
name: Run Tests
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- uses: golangci/golangci-lint-action@v3
continue-on-error: true
with:
args: --verbose -c .github/workflows/golang-lint.yml
test:
strategy:
max-parallel: 2
matrix:
os: [macos, ubuntu]
go: ["1.18"]
include:
- os: macos
gopath: /Users/runner/go
gocache: /Users/runner/Library/Caches/go-build
- os: ubuntu
gopath: /home/runner/go
gocache: /home/runner/.cache/go-build
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}-latest
env:
GO111MODULE: off
GOPATH: ${{ matrix.gopath }}:${{ github.workspace }}
CGO_ENABLED: 1
WORKDIR: src/github.com/eudore/eudore/
PACKAGES: github.com/eudore/eudore,github.com/eudore/eudore/middleware
defaults:
run:
working-directory: ${{ env.WORKDIR }}
steps:
- uses: actions/checkout@v3
with:
path: ${{ env.WORKDIR }}
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: actions/cache@v3
with:
key: ${{ runner.os }}-go-${{ hashFiles('src/github.com/eudore/eudore/go.mod') }}
restore-keys: ${{ runner.os }}-go-
path: |
${{ matrix.gopath }}
${{ matrix.gocache }}
- name: Run Debug
run: rm -f _example/logger_test.go
- name: Run Go Get
run: for pkg in $(go list -json _example/*_test.go | jq -r '.XTestImports[]' | grep -E "github|monkey" | grep -v eudore); do go get -v $pkg; done
- name: Run Tests
run: go test -v -timeout=1m -race -cover -coverprofile=coverage.out -coverpkg='${{ env.PACKAGES }}' _example/*_test.go | tee output
- name: Run Notice
if: ${{ strategy.job-index == 0 }}
run: |
'echo "::notice::$(tail -3 output | grep "coverage: ")"'
- name: Run Coverage
if: ${{ strategy.job-index == 0 }}
run: go tool cover -html coverage.out -o coverage.html
- uses: actions/upload-artifact@v3
if: ${{ strategy.job-index == 0 }}
with:
name: Coverage-eudore-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.go }}
path: ${{ env.WORKDIR }}/coverage.html
59 changes: 59 additions & 0 deletions .github/workflows/golang-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
run:
timeout: 2m
skip-dirs:
- database
- database2
skip-files:
- protobuf.go
- middleware/admin.go
- middleware/dump.go
issues:
max-same-issues: 10
linters:
enable-all: true
disable:
- golint
- deadcode
- nosnakecase
- ifshort
- scopelint
- maligned
- structcheck
- exhaustivestruct
- varcheck
- interfacer
- errcheck
- varnamelen
- wrapcheck
- nlreturn
- ireturn
- interfacebloat
- gochecknoglobals
- nonamedreturns
- forcetypeassert
- exhaustruct
- lll
- gosec
- wsl
- containedctx
- exhaustive
- contextcheck
- tagliatelle
- gomnd
- goerr113
- nestif
- gocognit
- tagalign
linters-settings:
gocyclo:
min-complexity: 15
cyclop:
max-complexity: 15
depguard:
rules:
main:
allow:
- $gostd
- github.com/eudore/eudore
funlen:
statements: 50
50 changes: 35 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,44 @@
# Change Log

setIntField set Duration type
middleware/cache 不同accept会导致数据格式不同

Next
- Database 实现

[2022年10月31日]
- App 优化运行输出日志
- Client 完整重构
- Logger 修复Sync方法,更新其他组件日志
- Config 合并实现方法
- Render/BindProtobuf 无需proto文件进行编码
- NewContextMessage 新增函数返回请求上下文消息,复用message。
- middleware/gzip 使用自定义压缩函数,可以使用br压缩。
- middleware/look 使用自定义data获取函数。
[2023年8月31日]
- go.mod go版本依赖从1.9升级为1.18,增加error embed 泛型等新版本特性支持。
- github 使用action配置添加lint和codecov。
- LoggerStd 修改为Hook结构增强扩展。
- Client 添加ClietOption/ClintBody,修改请求构造方法。
- RouterStd 使用Group时参数loggerkind时修改router日志输出级别,加入Metadata接口实现。
- HandlerData validate使用新fc实现避免反射,完成filter实现过滤或修改数据。
- FuncCreator 使用泛型重构减少反射使用,额外扩展新函数规则,允许使用逻辑关系式。
- Context FormValues调用parseForm解析方法修改,不将PostForm和Form复制数据。
- ConvertTo 移除To/ToMap等转换函数,Get/Set函数优化异常处理。
- GetAny 修改GetAny相关函数使用泛型实现,重命名移除多余函数。
- HandlerExtender 默认扩展函数重命名。
- ResponseWriter 添加WriteString和Unwrap实现。
- NewFileSystems 处理Dir和Embed的http混合文件对象。
- NewConfigParseEnvFile 配置解析env文件。
- NewConfigParseArgs 保存未处理的命令行参数。
- LoggerStdDataJSON 具有环境变量EnvEudoreDaemonEnable时禁用标准输出。
- ServerListenConfig 使用DefaultServerListen启动监听。
- middleware/cache 添加对Accept/Accept-Encoding/304支持。
- middleware/compress 添加选择压缩方法,忽略小Body和已压缩Mime。
- middleware/bodylimit 忽略NoBody,使用http.MaxBytesReader限制body长度。
- daemon 整理启动命令、后台启动、信号处理、热重启,不进行单位测试覆盖。

[2022年10月31日](https://github.com/eudore/eudore/tree/de9fd1ea1b653ba6e4f9bb5c108733e3142cadf6)
- App 优化运行输出日志
- Client 完整重构
- Logger 修复Sync方法,更新其他组件日志
- Config 合并实现方法
- Render/BindProtobuf 无需proto文件进行编码
- NewContextMessage 新增函数返回请求上下文消息,复用message。
- middleware/gzip 使用自定义压缩函数,可以使用br压缩。
- middleware/look 使用自定义data获取函数。

[2022年4月30日](https://github.com/eudore/eudore/tree/b80422e67f5c9907967e36e577d23220793a6c9c)
- App和Context 生命周期管理
- DataHandlerFunc 合并Bind Validate Filte Render
- DataHandlerFunc 合并Bind Validate Filte Render
- Client 移入App组合
- Server 实现ServeConn方法
- ConvertTo 重构实现
Expand All @@ -31,9 +51,9 @@ Next
- middleware/look 解析Accept Header为format值,模板内容优化。
- ConfigParseFunc ConfigParseFunc重构
- ResponseWriter WriteHeader将延时写入
- contextBase 细节调整
- contextBase 细节调整
- policy 增加401
- httptest 修复响应对象并非读写
- httptest 修复响应对象并非读写

[2021年8月31日](https://github.com/eudore/eudore/commit/627e6de1fa64c45873c70f86637efa2decc5763f)
- Controller 简化内容保留ControllerAutoRoute。
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Eudore

[![Build Status](https://github.com/eudore/eudore/actions/workflows/action.yml/badge.svg)](https://github.com/eudore/eudore/actions/workflows/action.yml)
[![godoc](https://godoc.org/github.com/eudore/eudore?status.svg)](https://godoc.org/github.com/eudore/eudore)
[![go report card](https://goreportcard.com/badge/github.com/eudore/eudore)](https://goreportcard.com/report/github.com/eudore/eudore)
[![codecov](https://codecov.io/gh/eudore/eudore/branch/master/graph/badge.svg)](https://codecov.io/gh/eudore/eudore)
Expand Down Expand Up @@ -30,5 +31,4 @@ go get -v -u github.com/eudore/eudore
- [godoc](https://godoc.org/github.com/eudore/eudore)
- [example演示 100+](_example#example)
- [wiki文档](https://github.com/eudore/eudore/wiki)
- [更新说明](CHANGELOG.md)
- [实践](https://github.com/eudore/website)
- [更新说明](CHANGELOG.md)
30 changes: 16 additions & 14 deletions _example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ go version go1.18.7 linux/amd64 coverage: 100.0% of statements in github.com/eud
- [New](appNew.go)
- [静态文件](appStatic.go)
- [全局请求中间件](appMiddleware.go)
- [后台启动](appDaemon.go)(Alpha)
- [启动命令解析](appCommand.go)(Alpha)
- [监听代码自动编译重启](appNotify.go)(Alpha)
- [自定义app](appExtend.go)
- [重新加载配置](appReload.go)
- Config
- [map存储配置](configMap.go)
- [结构体存储配置](configEudore.go)
Expand All @@ -37,6 +33,8 @@ go version go1.18.7 linux/amd64 coverage: 100.0% of statements in github.com/eud
- [写入Elastic](loggerElastic.go)
- [日志脱敏](loggerSensitive.go)
- [logrus库适配](loggerLogrus.go)
- Client
- x
- Server
- [设置超时](serverStd.go)
- [服务监听](serverListen.go)
Expand All @@ -55,6 +53,11 @@ go version go1.18.7 linux/amd64 coverage: 100.0% of statements in github.com/eud
- [路由器注册移除](routerDelete.go)
- [路由器核心简化](routerCore.go)
- [radix树](routerRadix.go)
- Controller
- [路由控制器](controllerAutoRoute.go)
- [控制器组合](controllerCompose.go)
- [控制器自定义参数](controllerParams.go)
- [控制器错误处理](controllerError.go)
- Context
- [Request Info](contextRequestInfo.go)
- [Response Write](contextResponsWrite.go)
Expand All @@ -76,7 +79,7 @@ go version go1.18.7 linux/amd64 coverage: 100.0% of statements in github.com/eud
- [Send Template](contextRenderTemplate.go)
- [文件上传](contextUpload.go)
- [设置额外数据](contextValue.go)
- Context处理扩展
- HandlerExtender
- [默认处理](handlerDefault.go)
- [处理ContextData扩展](handlerContextData.go)
- [处理自定义函数类型](handlerFunc.go)
Expand All @@ -88,11 +91,8 @@ go version go1.18.7 linux/amd64 coverage: 100.0% of statements in github.com/eud
- [Rpc式map请求](handlerRpcMap.go)
- [使用embed](handlerEmbed.go)
- [使用jwt](handlerJwt.go)
- Controller
- [路由控制器](controllerAutoRoute.go)
- [控制器组合](controllerCompose.go)
- [控制器自定义参数](controllerParams.go)
- [控制器错误处理](controllerError.go)
- HandlerData
- FuncCreator
- Middleware
- [Admin中间件管理后台](middlewareAdmin.go)
- [BasicAuth](middlewareBasicAuth.go)
Expand Down Expand Up @@ -122,6 +122,11 @@ go version go1.18.7 linux/amd64 coverage: 100.0% of statements in github.com/eud
- [RouterRewrite](middlewareRouterRewrite.go)
- [Timeout请求超时](middlewareTimeout.go)
- [自定义中间件处理函数](middlewareHandle.go)
- Daemon
- [后台启动](appDaemon.go)
- [命令管理进程](appCommand.go)
- [热重启](appRestart.go)
- [重新加载配置](appReload.go)
- Policy(Alpha)
- [Pbac](policyPbac.go)
- [Rbac](policyRbac.go)
Expand All @@ -140,10 +145,6 @@ go version go1.18.7 linux/amd64 coverage: 100.0% of statements in github.com/eud
- Websocket
- [使用github.com/gobwas/ws库](websocketGobwas.go)
- [使用github.com/gorilla/websocket库](websocketGorilla.go)
- tool
- [转换对象成map](toolConvertMap.go)
- [对象转换](toolConvertTo.go)
- [基于路径读写对象](toolGetSet.go)
- net/http
- [中间件 黑名单](nethttpBlack.go)
- [中间件 路径重写](nethttpRewrite.go)
Expand All @@ -155,5 +156,6 @@ go version go1.18.7 linux/amd64 coverage: 100.0% of statements in github.com/eud
- [http客户端简化实现](otherHttpClient.go)
- [http服务端简化实现](otherHttpServer.go)
- [http服务端简化](otherHttpServer2.go)
- [监听代码自动编译重启](otherNotify.go)(Alpha)


Loading

0 comments on commit 27f4183

Please sign in to comment.