Skip to content

Commit

Permalink
debug mr.json and test screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
darkweak committed Feb 29, 2024
1 parent c67bffe commit 51d6ed4
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 82 deletions.
166 changes: 95 additions & 71 deletions .github/workflows/plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,74 +4,74 @@ on:
- pull_request

jobs:
build-caddy-validator:
name: Check that Souin build as caddy module
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
etcd:
image: quay.io/coreos/etcd
env:
ETCD_NAME: etcd0
ETCD_ADVERTISE_CLIENT_URLS: http://etcd:2379,http://etcd:4001
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379,http://0.0.0.0:4001
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd:2380
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_INITIAL_CLUSTER_TOKEN: etcd-cluster-1
ETCD_INITIAL_CLUSTER: etcd0=http://etcd:2380
ETCD_INITIAL_CLUSTER_STATE: new
ports:
- 2379:2379
- 2380:2380
- 4001:4001
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@v3
with:
go-version: '1.21'
-
name: Checkout code
uses: actions/checkout@v4
-
name: Install xcaddy
run: go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
-
name: Build Souin as caddy module
run: cd plugins/caddy && xcaddy build --with github.com/darkweak/souin/plugins/caddy=./ --with github.com/darkweak/souin@latest=../..
-
name: Run Caddy tests
run: cd plugins/caddy && go test -v ./...
-
name: Run detached caddy
run: cd plugins/caddy && ./caddy run &
-
name: Run Caddy E2E tests
uses: matt-ball/newman-action@master
with:
collection: "docs/e2e/Souin E2E.postman_collection.json"
folder: '["Caddy"]'
delayRequest: 5000
-
name: Run detached caddy
run: cd plugins/caddy && ./caddy stop
-
name: Run detached caddy
run: cd plugins/caddy && ./caddy run --config ./configuration.json &
-
name: Run Caddy E2E tests
uses: matt-ball/newman-action@master
with:
collection: "docs/e2e/Souin E2E.postman_collection.json"
folder: '["Caddy"]'
delayRequest: 5000
# build-caddy-validator:
# name: Check that Souin build as caddy module
# runs-on: ubuntu-latest
# services:
# redis:
# image: redis
# ports:
# - 6379:6379
# etcd:
# image: quay.io/coreos/etcd
# env:
# ETCD_NAME: etcd0
# ETCD_ADVERTISE_CLIENT_URLS: http://etcd:2379,http://etcd:4001
# ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379,http://0.0.0.0:4001
# ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd:2380
# ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
# ETCD_INITIAL_CLUSTER_TOKEN: etcd-cluster-1
# ETCD_INITIAL_CLUSTER: etcd0=http://etcd:2380
# ETCD_INITIAL_CLUSTER_STATE: new
# ports:
# - 2379:2379
# - 2380:2380
# - 4001:4001
# 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@v3
# with:
# go-version: '1.21'
# -
# name: Checkout code
# uses: actions/checkout@v4
# -
# name: Install xcaddy
# run: go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
# -
# name: Build Souin as caddy module
# run: cd plugins/caddy && xcaddy build --with github.com/darkweak/souin/plugins/caddy=./ --with github.com/darkweak/souin@latest=../..
# -
# name: Run Caddy tests
# run: cd plugins/caddy && go test -v ./...
# -
# name: Run detached caddy
# run: cd plugins/caddy && ./caddy run &
# -
# name: Run Caddy E2E tests
# uses: matt-ball/newman-action@master
# with:
# collection: "docs/e2e/Souin E2E.postman_collection.json"
# folder: '["Caddy"]'
# delayRequest: 5000
# -
# name: Run detached caddy
# run: cd plugins/caddy && ./caddy stop
# -
# name: Run detached caddy
# run: cd plugins/caddy && ./caddy run --config ./configuration.json &
# -
# name: Run Caddy E2E tests
# uses: matt-ball/newman-action@master
# with:
# 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
Expand All @@ -83,12 +83,12 @@ jobs:
sudo echo "127.0.0.1 domain.com etcd redis" | sudo tee -a /etc/hosts
-
name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '1.21'

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

Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
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 souin/docs/cache-tests/cache-tests-caddyfile &
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
Expand All @@ -126,6 +126,30 @@ jobs:
-
name: Run cache-tests test suite
run: cd cache-tests && ./test-host.sh 127.0.0.1:4443 > results/mr.json
-
name: Screenshot cache-tests
id: screenshot-generator
uses: swinton/screenshot-website@main
with:
source: http://127.0.0.1:8000/
destination: cache-tests-screenshot.png
full-page: true
-
name: Screenshot cache-tests
uses: karol-brejna-i/webpage-screenshot-action@v1
with:
url: http://127.0.0.1:8000/
# mode: element
# xpath: //table[1]
output: cache-tests-screenshot.png
-
name: Pull request artifacts
uses: edunad/actions-image@master
with:
# path: ${{ steps.screenshot-generator.outputs.path }}
path: cache-tests-screenshot.png
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
title: 'cache-tests suite'

# build-beego-validator:
# name: Check that Souin build as middleware
Expand Down
22 changes: 11 additions & 11 deletions docs/cache-tests/cache-tests-caddyfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
order cache before rewrite
cache {
api {
prometheus
souin
}
cdn {
dynamic
}
ttl 1000s
default_cache_control public
order cache before rewrite
cache {
api {
prometheus
souin
}
cdn {
dynamic
}
ttl 1000s
default_cache_control public
}
}

:4443
Expand Down

0 comments on commit 51d6ed4

Please sign in to comment.