Skip to content

Commit 2577ef6

Browse files
authored
feat(plugins): Introduce new plugin support, Hertz (#334)
* feat(plugins): Introduce new plugin support, Hertz * feat(plugins): add Hertz unit tests * fix: rename souin golang files to httpcache * feat(plugins): introduce new Goa support (#338) * feat(plugins): goa introduction * fix: linter * feat: bump minimal go version * feat: bump prepare new tagged version
1 parent e934c2d commit 2577ef6

File tree

112 files changed

+5158
-1647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+5158
-1647
lines changed

.github/workflows/non-regression.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
pull_request:
55
workflow_dispatch:
66

7+
env:
8+
GO_VERSION: '1.20'
9+
710
jobs:
811
lint-validation:
912
name: Validate Go code linting
@@ -14,7 +17,7 @@ jobs:
1417
- name: Install Go
1518
uses: actions/setup-go@v3
1619
with:
17-
go-version: 1.19
20+
go-version: ${{ env.GO_VERSION }}
1821
- name: golangci-lint
1922
uses: golangci/golangci-lint-action@v3
2023
with:
@@ -29,7 +32,7 @@ jobs:
2932
- name: Install Go
3033
uses: actions/setup-go@v3
3134
with:
32-
go-version: 1.19
35+
go-version: ${{ env.GO_VERSION }}
3336
- name: Run unit static tests
3437
run: go test -v -race $(go list ./... | grep -v pkg/storage)
3538
unit-test-golang-with-services:
@@ -42,7 +45,7 @@ jobs:
4245
- name: Install Go
4346
uses: actions/setup-go@v3
4447
with:
45-
go-version: 1.19
48+
go-version: ${{ env.GO_VERSION }}
4649
- name: Build and run the docker stack
4750
run: |
4851
docker network create your_network || true

.github/workflows/plugin_template.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ on:
99
CAPITALIZED_NAME:
1010
required: true
1111
type: string
12+
GO_VERSION:
13+
required: true
14+
type: string
1215

1316
jobs:
1417
plugin-test:
1518
name: Check that Souin build as ${{ inputs.CAPITALIZED_NAME }} middleware
1619
runs-on: ubuntu-latest
20+
env:
21+
GO_VERSION: ${{ inputs.GO_VERSION }}
1722
steps:
1823
-
1924
name: Add domain.com host to /etc/hosts
@@ -23,7 +28,7 @@ jobs:
2328
name: Install Go
2429
uses: actions/setup-go@v3
2530
with:
26-
go-version: 1.19
31+
go-version: ${{ inputs.GO_VERSION }}
2732
-
2833
name: Checkout code
2934
uses: actions/checkout@v3

.github/workflows/plugins-master.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches:
66
- master
77

8+
env:
9+
GO_VERSION: '1.20'
10+
811
jobs:
912
build-caddy-validator:
1013
name: Check that Souin build as caddy module and can be tagged on master
@@ -18,7 +21,7 @@ jobs:
1821
name: Install Go
1922
uses: actions/setup-go@v3
2023
with:
21-
go-version: 1.19
24+
go-version: ${{ env.GO_VERSION }}
2225
-
2326
name: Checkout code
2427
uses: actions/checkout@v3

.github/workflows/plugins.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jobs:
3434
sudo echo "127.0.0.1 domain.com etcd redis" | sudo tee -a /etc/hosts
3535
-
3636
name: Install Go
37-
uses: actions/setup-go@v2
37+
uses: actions/setup-go@v3
3838
with:
39-
go-version: 1.19
39+
go-version: '1.20'
4040
-
4141
name: Checkout code
4242
uses: actions/checkout@v2
@@ -81,94 +81,124 @@ jobs:
8181
with:
8282
CAPITALIZED_NAME: Beego
8383
LOWER_NAME: beego
84+
GO_VERSION: '1.20'
8485
build-chi-validator:
8586
name: Check that Souin build as middleware
8687
uses: ./.github/workflows/plugin_template.yml
8788
secrets: inherit
8889
with:
8990
CAPITALIZED_NAME: Chi
9091
LOWER_NAME: chi
92+
GO_VERSION: '1.20'
9193
build-dotweb-validator:
9294
name: Check that Souin build as middleware
9395
uses: ./.github/workflows/plugin_template.yml
9496
secrets: inherit
9597
with:
9698
CAPITALIZED_NAME: Dotweb
9799
LOWER_NAME: dotweb
100+
GO_VERSION: '1.20'
98101
build-echo-validator:
99102
name: Check that Souin build as middleware
100103
uses: ./.github/workflows/plugin_template.yml
101104
secrets: inherit
102105
with:
103106
CAPITALIZED_NAME: Echo
104107
LOWER_NAME: echo
108+
GO_VERSION: '1.20'
105109
build-fiber-validator:
106110
name: Check that Souin build as middleware
107111
uses: ./.github/workflows/plugin_template.yml
108112
secrets: inherit
109113
with:
110114
CAPITALIZED_NAME: Fiber
111115
LOWER_NAME: fiber
116+
GO_VERSION: '1.20'
112117
build-gin-validator:
113118
name: Check that Souin build as middleware
114119
uses: ./.github/workflows/plugin_template.yml
115120
secrets: inherit
116121
with:
117122
CAPITALIZED_NAME: Gin
118123
LOWER_NAME: gin
124+
GO_VERSION: '1.20'
125+
build-goa-validator:
126+
name: Check that Souin build as middleware
127+
uses: ./.github/workflows/plugin_template.yml
128+
secrets: inherit
129+
with:
130+
CAPITALIZED_NAME: Goa
131+
LOWER_NAME: goa
132+
GO_VERSION: '1.20'
119133
build-go-zero-validator:
120134
name: Check that Souin build as middleware
121135
uses: ./.github/workflows/plugin_template.yml
122136
secrets: inherit
123137
with:
124138
CAPITALIZED_NAME: Go-zero
125139
LOWER_NAME: go-zero
140+
GO_VERSION: '1.20'
141+
build-hertz-validator:
142+
name: Check that Souin build as middleware
143+
uses: ./.github/workflows/plugin_template.yml
144+
secrets: inherit
145+
with:
146+
CAPITALIZED_NAME: Hertz
147+
LOWER_NAME: hertz
148+
GO_VERSION: '1.20'
126149
build-kratos-validator:
127150
name: Check that Souin build as middleware
128151
uses: ./.github/workflows/plugin_template.yml
129152
secrets: inherit
130153
with:
131154
CAPITALIZED_NAME: Kratos
132155
LOWER_NAME: kratos
156+
GO_VERSION: '1.20'
133157
build-roadrunner-validator:
134158
name: Check that Souin build as middleware
135159
uses: ./.github/workflows/plugin_template.yml
136160
secrets: inherit
137161
with:
138162
CAPITALIZED_NAME: Roadrunner
139163
LOWER_NAME: roadrunner
164+
GO_VERSION: '1.20'
140165
build-skipper-validator:
141166
name: Check that Souin build as middleware
142167
uses: ./.github/workflows/plugin_template.yml
143168
secrets: inherit
144169
with:
145170
CAPITALIZED_NAME: Skipper
146171
LOWER_NAME: skipper
172+
GO_VERSION: '1.20'
147173
build-souin-validator:
148174
name: Check that Souin build as middleware
149175
uses: ./.github/workflows/plugin_template.yml
150176
secrets: inherit
151177
with:
152178
CAPITALIZED_NAME: Souin
153179
LOWER_NAME: souin
180+
GO_VERSION: '1.20'
154181
build-traefik-validator:
155182
name: Check that Souin build as middleware
156183
uses: ./.github/workflows/plugin_template.yml
157184
secrets: inherit
158185
with:
159186
CAPITALIZED_NAME: Traefik
160187
LOWER_NAME: traefik
188+
GO_VERSION: '1.20'
161189
build-tyk-validator:
162190
name: Check that Souin build as middleware
163191
uses: ./.github/workflows/plugin_template.yml
164192
secrets: inherit
165193
with:
166194
CAPITALIZED_NAME: Tyk
167195
LOWER_NAME: tyk
196+
GO_VERSION: '1.20'
168197
build-webgo-validator:
169198
name: Check that Souin build as middleware
170199
uses: ./.github/workflows/plugin_template.yml
171200
secrets: inherit
172201
with:
173202
CAPITALIZED_NAME: Webgo
174203
LOWER_NAME: webgo
204+
GO_VERSION: '1.20'

.github/workflows/release.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
create:
55
tags: ["v*"]
66

7+
env:
8+
GO_VERSION: '1.20'
9+
710
jobs:
811
generate-souin-traefik-docker:
912
name: Generate embedded Souin as traefik middleware
@@ -75,9 +78,9 @@ jobs:
7578
steps:
7679
-
7780
name: Set up Go
78-
uses: actions/setup-go@v2
81+
uses: actions/setup-go@v3
7982
with:
80-
go-version: 1.19
83+
go-version: ${{ env.GO_VERSION }}
8184
-
8285
name: Checkout
8386
uses: actions/checkout@v2
@@ -95,18 +98,22 @@ jobs:
9598
generate-tyk-versions:
9699
name: Generate Tyk plugin binaries
97100
runs-on: ubuntu-latest
101+
env:
102+
LATEST_VERSION: v5.0
103+
PREVIOUS_VERSION: v4.3
104+
SECOND_TO_LAST_VERSION: v4.2
98105
steps:
99106
-
100107
name: Set up Go
101-
uses: actions/setup-go@v2
108+
uses: actions/setup-go@v3
102109
with:
103-
go-version: 1.19
110+
go-version: ${{ env.GO_VERSION }}
104111
-
105112
name: Checkout code
106113
uses: actions/checkout@v3
107114
-
108115
name: Generate Tyk amd64 artifacts
109-
run: cd plugins/tyk && make vendor && LATEST_VERSION=v5.0 PREVIOUS_VERSION=v4.3 SECOND_TO_LAST_VERSION=v4.2 docker compose -f docker-compose.yml.artifacts up
116+
run: cd plugins/tyk && make vendor && docker compose -f docker-compose.yml.artifacts up
110117
-
111118
name: Upload Tyk amd64 artifacts
112119
uses: actions/upload-artifact@v3

.github/workflows/workflow_plugins_generator.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

3-
plugins=("beego" "chi" "dotweb" "echo" "fiber" "gin" "go-zero" "kratos" "roadrunner" "skipper" "souin" "traefik" "tyk" "webgo")
3+
plugins=("beego" "chi" "dotweb" "echo" "fiber" "gin" "goa" "go-zero" "hertz" "kratos" "roadrunner" "skipper" "souin" "traefik" "tyk" "webgo")
4+
go_version=1.20
45

56
IFS= read -r -d '' tpl <<EOF
67
name: Build and validate Souin as plugins
@@ -39,9 +40,9 @@ jobs:
3940
sudo echo "127.0.0.1 domain.com etcd redis" | sudo tee -a /etc/hosts
4041
-
4142
name: Install Go
42-
uses: actions/setup-go@v2
43+
uses: actions/setup-go@v3
4344
with:
44-
go-version: 1.19
45+
go-version: '$go_version'
4546
-
4647
name: Checkout code
4748
uses: actions/checkout@v2
@@ -93,6 +94,7 @@ for i in ${!plugins[@]}; do
9394
with:
9495
CAPITALIZED_NAME: $capitalized
9596
LOWER_NAME: $lower
97+
GO_VERSION: '$go_version'
9698
EOF
9799
workflow+="$tpl"
98100
done

Dockerfile-dev

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM golang:1.19-alpine AS souin
1+
ARG GO_VERSION
2+
3+
FROM golang:${GO_VERSION}-alpine AS souin
24

35
RUN apk update && apk upgrade && \
46
apk add --no-cache bash git openssh gcc libc-dev

Dockerfile-prod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM golang:1.19-alpine AS builder
1+
ARG GO_VERSION
2+
3+
FROM golang:${GO_VERSION}-alpine AS builder
24

35
RUN apk update && apk upgrade && \
46
apk add --no-cache bash git openssh gcc libc-dev

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
DC=docker-compose
77
DC_BUILD=$(DC) build
88
DC_EXEC=$(DC) exec
9-
PLUGINS_LIST=beego caddy chi dotweb echo fiber gin go-zero goyave kratos roadrunner skipper traefik tyk webgo souin
10-
MOD_PLUGINS_LIST=beego caddy chi dotweb echo fiber gin go-zero goyave kratos roadrunner skipper webgo
9+
PLUGINS_LIST=beego caddy chi dotweb echo fiber gin goa go-zero goyave hertz kratos roadrunner skipper traefik tyk webgo souin
10+
MOD_PLUGINS_LIST=beego caddy chi dotweb echo fiber gin goa go-zero goyave hertz kratos roadrunner skipper webgo
1111

1212
base-build-and-run-%:
1313
cd plugins/$* && $(MAKE) prepare
@@ -30,6 +30,8 @@ build-and-run-echo: base-build-and-run-echo ## Run Echo with Souin as plugin
3030

3131
build-and-run-fiber: base-build-and-run-fiber ## Run Fiber with Souin as plugin
3232

33+
build-and-run-hertz: base-build-and-run-hertz ## Run Hertz with Souin as plugin
34+
3335
build-and-run-kratos: base-build-and-run-kratos ## Run Kratos with Souin as plugin
3436

3537
build-and-run-roadrunner: base-build-and-run-roadrunner ## Run Roadrunner with Souin as plugin
@@ -40,6 +42,8 @@ build-and-run-souin: base-build-and-run-souin ## Run Souin as plugin
4042

4143
build-and-run-gin: base-build-and-run-gin ## Run Gin with Souin as plugin
4244

45+
build-and-run-goa: base-build-and-run-goa ## Run Goa with Souin as plugin
46+
4347
build-and-run-go-zero: base-build-and-run-go-zero ## Run Go-zero with Souin as plugin
4448

4549
build-and-run-goyave: base-build-and-run-goyave ## Run Goyave with Souin as plugin

0 commit comments

Comments
 (0)