Skip to content

Commit

Permalink
feat(chore): search surrogate by surrogate prefix (#459)
Browse files Browse the repository at this point in the history
* feat(chore): search surrogate by surrogate prefix

* feat(ci): add cache-tests suite

* debug mr.json and test screenshot

* fix(ci): re-enable CI tests

* fix(storage): unit tests

* feat(prepare): release v1.6.47

* feat(deps): bump storages version and cleanup unused code
  • Loading branch information
darkweak committed Mar 5, 2024
1 parent ecd55d3 commit cd051e5
Show file tree
Hide file tree
Showing 274 changed files with 12,443 additions and 15,494 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,86 @@ jobs:
collection: "docs/e2e/Souin E2E.postman_collection.json"
folder: '["Caddy"]'
delayRequest: 5000
run-cache-tests:
needs: build-caddy-validator
name: Run cache-tests suite requirements and add the generated screenshot to the PR
runs-on: ubuntu-latest
steps:
-
name: Add domain.com host to /etc/hosts
run: |
sudo echo "127.0.0.1 domain.com etcd redis" | sudo tee -a /etc/hosts
-
name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: latest
-
name: Checkout Souin code
uses: actions/checkout@v4
with:
repository: darkweak/souin
path: souin
-
name: Checkout cache-tests code
uses: actions/checkout@v4
with:
repository: http-tests/cache-tests
path: cache-tests
-
name: Install xcaddy
run: go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
-
name: Build Souin as caddy module for current commit
run: cd souin/plugins/caddy && xcaddy build --with github.com/darkweak/souin/plugins/caddy=./ --with github.com/darkweak/souin=../..
-
name: Run detached caddy
run: cd souin/plugins/caddy && ./caddy run --config ../../docs/cache-tests/cache-tests-caddyfile --adapter caddyfile &
-
name: Sync index.mjs from souin to cache-tests
run: cp souin/docs/cache-tests/index.mjs cache-tests/results/index.mjs
-
name: Run detached cache-tests server
run: cd cache-tests && pnpm install && pnpm run server &
-
name: Run cache-tests test suite
run: cd cache-tests && ./test-host.sh 127.0.0.1:4443 > results/mr.json
-
name: install puppeteer-headful
uses: mujo-code/puppeteer-headful@master
env:
CI: 'true'
-
name: screenshots-ci-action
uses: flameddd/screenshots-ci-action@master
with:
url: http://127.0.0.1:8000/
devices: iPad Pro landscape
noDesktop: true
noCommitHashFileName: true
fullPage: true
releaseId: 144343803
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Upload screenshot artifacts
id: screenshot-uploader
uses: edunad/actions-image@master
with:
path: screenshots/iPad_Pro_landscape.jpeg
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
title: 'cache-tests suite result'

build-beego-validator:
name: Check that Souin build as middleware
uses: ./.github/workflows/plugin_template.yml
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/workflow_plugins_generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,86 @@ jobs:
collection: "docs/e2e/Souin E2E.postman_collection.json"
folder: '["Caddy"]'
delayRequest: 5000
run-cache-tests:
needs: build-caddy-validator
name: Run cache-tests suite requirements and add the generated screenshot to the PR
runs-on: ubuntu-latest
steps:
-
name: Add domain.com host to /etc/hosts
run: |
sudo echo "127.0.0.1 domain.com etcd redis" | sudo tee -a /etc/hosts
-
name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: latest
-
name: Checkout Souin code
uses: actions/checkout@v4
with:
repository: darkweak/souin
path: souin
-
name: Checkout cache-tests code
uses: actions/checkout@v4
with:
repository: http-tests/cache-tests
path: cache-tests
-
name: Install xcaddy
run: go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
-
name: Build Souin as caddy module for current commit
run: cd souin/plugins/caddy && xcaddy build --with github.com/darkweak/souin/plugins/caddy=./ --with github.com/darkweak/souin=../..
-
name: Run detached caddy
run: cd souin/plugins/caddy && ./caddy run --config ../../docs/cache-tests/cache-tests-caddyfile --adapter caddyfile &
-
name: Sync index.mjs from souin to cache-tests
run: cp souin/docs/cache-tests/index.mjs cache-tests/results/index.mjs
-
name: Run detached cache-tests server
run: cd cache-tests && pnpm install && pnpm run server &
-
name: Run cache-tests test suite
run: cd cache-tests && ./test-host.sh 127.0.0.1:4443 > results/mr.json
-
name: install puppeteer-headful
uses: mujo-code/puppeteer-headful@master
env:
CI: 'true'
-
name: screenshots-ci-action
uses: flameddd/screenshots-ci-action@master
with:
url: http://127.0.0.1:8000/
devices: iPad Pro landscape
noDesktop: true
noCommitHashFileName: true
fullPage: true
releaseId: 144343803
env:
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
-
name: Upload screenshot artifacts
id: screenshot-uploader
uses: edunad/actions-image@master
with:
path: screenshots/iPad_Pro_landscape.jpeg
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
title: 'cache-tests suite result'
EOF
workflow+="$tpl"

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ traefik.json
plugins/caddy/caddy
plugins/caddy/.github/*
/vendor/

testing/
1 change: 0 additions & 1 deletion Dockerfile-dev
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ ADD ./go.* /app/src/github.com/darkweak/souin/
RUN go mod download
RUN go get golang.org/x/lint/golint
RUN mkdir -p /ssl
ADD ./cache /app/src/github.com/darkweak/souin/cache
ADD ./context /app/src/github.com/darkweak/souin/context
ADD ./pkg /app/src/github.com/darkweak/souin/pkg
ADD ./tests /app/src/github.com/darkweak/souin/tests
Expand Down
1 change: 0 additions & 1 deletion Dockerfile-prod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ RUN mkdir -p /app/src/github.com/darkweak/cmd
RUN mkdir -p /app/src/github.com/darkweak/souin
ADD ./go.* /app/src/github.com/darkweak/souin/
RUN mkdir -p /ssl
ADD ./cache /app/src/github.com/darkweak/souin/cache
ADD ./context /app/src/github.com/darkweak/souin/context
ADD ./pkg /app/src/github.com/darkweak/souin/pkg
ADD ./tests /app/src/github.com/darkweak/souin/tests
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ generate-workflow: ## Generate plugin workflow
golangci-lint: ## Run golangci-lint to ensure the code quality
docker run --rm -v $(PWD):/app -w /app golangci/golangci-lint:v1.55.2 golangci-lint run -v --timeout 180s ./...
for plugin in $(PLUGINS_LIST) ; do \
echo "Starting lint $$plugin \n" && docker run --rm -v $(PWD)/plugins/$$plugin:/app -w /app golangci/golangci-lint:v1.50.1 golangci-lint run -v --skip-dirs=override --timeout 240s ./...; \
echo "Starting lint $$plugin \n" && docker run --rm -v $(PWD):/app -w /app golangci/golangci-lint:v1.55.2 golangci-lint run -v --skip-dirs=override --timeout 240s ./plugins/$$plugin; \
done
cd plugins/caddy && go mod tidy && go mod download

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ experimental:
plugins:
souin:
moduleName: github.com/darkweak/souin
version: v1.6.46
version: v1.6.47
```
After that you can declare either the whole configuration at once in the middleware block or by service. See the examples below.
```yaml
Expand Down
137 changes: 0 additions & 137 deletions cache/ykeys/ykey.go

This file was deleted.

Loading

0 comments on commit cd051e5

Please sign in to comment.