Skip to content

Commit

Permalink
feat(plugins): Introduce new plugin support, Hertz (#334)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
darkweak committed Apr 26, 2023
1 parent e934c2d commit 2577ef6
Show file tree
Hide file tree
Showing 112 changed files with 5,158 additions and 1,647 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/non-regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
pull_request:
workflow_dispatch:

env:
GO_VERSION: '1.20'

jobs:
lint-validation:
name: Validate Go code linting
Expand All @@ -14,7 +17,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand All @@ -29,7 +32,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: ${{ env.GO_VERSION }}
- name: Run unit static tests
run: go test -v -race $(go list ./... | grep -v pkg/storage)
unit-test-golang-with-services:
Expand All @@ -42,7 +45,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: ${{ env.GO_VERSION }}
- name: Build and run the docker stack
run: |
docker network create your_network || true
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/plugin_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ on:
CAPITALIZED_NAME:
required: true
type: string
GO_VERSION:
required: true
type: string

jobs:
plugin-test:
name: Check that Souin build as ${{ inputs.CAPITALIZED_NAME }} middleware
runs-on: ubuntu-latest
env:
GO_VERSION: ${{ inputs.GO_VERSION }}
steps:
-
name: Add domain.com host to /etc/hosts
Expand All @@ -23,7 +28,7 @@ jobs:
name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: ${{ inputs.GO_VERSION }}
-
name: Checkout code
uses: actions/checkout@v3
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/plugins-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- master

env:
GO_VERSION: '1.20'

jobs:
build-caddy-validator:
name: Check that Souin build as caddy module and can be tagged on master
Expand All @@ -18,7 +21,7 @@ jobs:
name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: ${{ env.GO_VERSION }}
-
name: Checkout code
uses: actions/checkout@v3
Expand Down
34 changes: 32 additions & 2 deletions .github/workflows/plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
sudo echo "127.0.0.1 domain.com etcd redis" | sudo tee -a /etc/hosts
-
name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: '1.20'
-
name: Checkout code
uses: actions/checkout@v2
Expand Down Expand Up @@ -81,94 +81,124 @@ jobs:
with:
CAPITALIZED_NAME: Beego
LOWER_NAME: beego
GO_VERSION: '1.20'
build-chi-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Chi
LOWER_NAME: chi
GO_VERSION: '1.20'
build-dotweb-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Dotweb
LOWER_NAME: dotweb
GO_VERSION: '1.20'
build-echo-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Echo
LOWER_NAME: echo
GO_VERSION: '1.20'
build-fiber-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Fiber
LOWER_NAME: fiber
GO_VERSION: '1.20'
build-gin-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Gin
LOWER_NAME: gin
GO_VERSION: '1.20'
build-goa-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Goa
LOWER_NAME: goa
GO_VERSION: '1.20'
build-go-zero-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Go-zero
LOWER_NAME: go-zero
GO_VERSION: '1.20'
build-hertz-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Hertz
LOWER_NAME: hertz
GO_VERSION: '1.20'
build-kratos-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Kratos
LOWER_NAME: kratos
GO_VERSION: '1.20'
build-roadrunner-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Roadrunner
LOWER_NAME: roadrunner
GO_VERSION: '1.20'
build-skipper-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Skipper
LOWER_NAME: skipper
GO_VERSION: '1.20'
build-souin-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Souin
LOWER_NAME: souin
GO_VERSION: '1.20'
build-traefik-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Traefik
LOWER_NAME: traefik
GO_VERSION: '1.20'
build-tyk-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Tyk
LOWER_NAME: tyk
GO_VERSION: '1.20'
build-webgo-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
secrets: inherit
with:
CAPITALIZED_NAME: Webgo
LOWER_NAME: webgo
GO_VERSION: '1.20'
17 changes: 12 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
create:
tags: ["v*"]

env:
GO_VERSION: '1.20'

jobs:
generate-souin-traefik-docker:
name: Generate embedded Souin as traefik middleware
Expand Down Expand Up @@ -75,9 +78,9 @@ jobs:
steps:
-
name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: ${{ env.GO_VERSION }}
-
name: Checkout
uses: actions/checkout@v2
Expand All @@ -95,18 +98,22 @@ jobs:
generate-tyk-versions:
name: Generate Tyk plugin binaries
runs-on: ubuntu-latest
env:
LATEST_VERSION: v5.0
PREVIOUS_VERSION: v4.3
SECOND_TO_LAST_VERSION: v4.2
steps:
-
name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: ${{ env.GO_VERSION }}
-
name: Checkout code
uses: actions/checkout@v3
-
name: Generate Tyk amd64 artifacts
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
run: cd plugins/tyk && make vendor && docker compose -f docker-compose.yml.artifacts up
-
name: Upload Tyk amd64 artifacts
uses: actions/upload-artifact@v3
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/workflow_plugins_generator.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

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

IFS= read -r -d '' tpl <<EOF
name: Build and validate Souin as plugins
Expand Down Expand Up @@ -39,9 +40,9 @@ jobs:
sudo echo "127.0.0.1 domain.com etcd redis" | sudo tee -a /etc/hosts
-
name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: '$go_version'
-
name: Checkout code
uses: actions/checkout@v2
Expand Down Expand Up @@ -93,6 +94,7 @@ for i in ${!plugins[@]}; do
with:
CAPITALIZED_NAME: $capitalized
LOWER_NAME: $lower
GO_VERSION: '$go_version'
EOF
workflow+="$tpl"
done
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM golang:1.19-alpine AS souin
ARG GO_VERSION

FROM golang:${GO_VERSION}-alpine AS souin

RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh gcc libc-dev
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile-prod
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM golang:1.19-alpine AS builder
ARG GO_VERSION

FROM golang:${GO_VERSION}-alpine AS builder

RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh gcc libc-dev
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
DC=docker-compose
DC_BUILD=$(DC) build
DC_EXEC=$(DC) exec
PLUGINS_LIST=beego caddy chi dotweb echo fiber gin go-zero goyave kratos roadrunner skipper traefik tyk webgo souin
MOD_PLUGINS_LIST=beego caddy chi dotweb echo fiber gin go-zero goyave kratos roadrunner skipper webgo
PLUGINS_LIST=beego caddy chi dotweb echo fiber gin goa go-zero goyave hertz kratos roadrunner skipper traefik tyk webgo souin
MOD_PLUGINS_LIST=beego caddy chi dotweb echo fiber gin goa go-zero goyave hertz kratos roadrunner skipper webgo

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

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

build-and-run-hertz: base-build-and-run-hertz ## Run Hertz with Souin as plugin

build-and-run-kratos: base-build-and-run-kratos ## Run Kratos with Souin as plugin

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

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

build-and-run-goa: base-build-and-run-goa ## Run Goa with Souin as plugin

build-and-run-go-zero: base-build-and-run-go-zero ## Run Go-zero with Souin as plugin

build-and-run-goyave: base-build-and-run-goyave ## Run Goyave with Souin as plugin
Expand Down
Loading

0 comments on commit 2577ef6

Please sign in to comment.