From bccf054fc1e68c7e6110215655dca7a85eeb231f Mon Sep 17 00:00:00 2001 From: darkweak Date: Thu, 29 Feb 2024 21:17:04 +0100 Subject: [PATCH] debug mr.json and test screenshot --- .github/workflows/plugins.yml | 170 ++++++++++++++----------- docs/cache-tests/cache-tests-caddyfile | 22 ++-- docs/cache-tests/index.mjs | 4 +- 3 files changed, 112 insertions(+), 84 deletions(-) diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index 214689813..5d1b0c204 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -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 @@ -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 @@ -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 @@ -126,6 +126,34 @@ jobs: - 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 # Required for headful puppeteer + 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 + 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' + release_id: 144343803 + - + name: Debug actions-image outputs + run: echo "${{join(steps.screenshot-uploader.outputs.*, '\n')}}" # build-beego-validator: # name: Check that Souin build as middleware diff --git a/docs/cache-tests/cache-tests-caddyfile b/docs/cache-tests/cache-tests-caddyfile index e66ab5ad3..178980711 100644 --- a/docs/cache-tests/cache-tests-caddyfile +++ b/docs/cache-tests/cache-tests-caddyfile @@ -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 diff --git a/docs/cache-tests/index.mjs b/docs/cache-tests/index.mjs index 32539e2f2..878f04c01 100644 --- a/docs/cache-tests/index.mjs +++ b/docs/cache-tests/index.mjs @@ -1,14 +1,14 @@ export default [ { file: 'caddy.json', - name: 'caddy', + name: 'Caddy', type: 'rev-proxy', version: '0.7.0', link: 'https://github.com/http-tests/cache-tests/wiki/Caddy' }, { file: 'mr.json', - name: 'Souin', + name: 'Merge request', type: 'rev-proxy', version: '0.0.1', link: 'https://github.com/http-tests/cache-tests/wiki/Caddy'