Skip to content

Commit

Permalink
feat: update setup for 2025 (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
stasadev authored Jan 21, 2025
1 parent 2c492ce commit 8555209
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 31 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ on:
workflow_dispatch:
inputs:
debug_enabled:
description: 'Debug with tmate set "debug_enabled"'
type: boolean
description: Debug with tmate
required: false
default: "false"
default: false

env:
# Allow ddev get to use a github token to prevent rate limiting by tests
DDEV_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Required permissions for keep-alive, used by ddev/github-action-add-on-test
# This is required for "gautamkrishnar/keepalive-workflow", see "ddev/github-action-add-on-test"
permissions:
actions: write

Expand All @@ -32,10 +33,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: ddev/github-action-add-on-test@v2
with:
ddev_version: ${{ matrix.ddev_version }}
token: ${{ secrets.GITHUB_TOKEN }}
debug_enabled: ${{ github.event.inputs.debug_enabled }}
addon_repository: ${{ env.GITHUB_REPOSITORY }}
addon_ref: ${{ env.GITHUB_REF }}
- uses: ddev/github-action-add-on-test@v2
with:
ddev_version: ${{ matrix.ddev_version }}
token: ${{ secrets.GITHUB_TOKEN }}
debug_enabled: ${{ github.event.inputs.debug_enabled }}
addon_repository: ${{ env.GITHUB_REPOSITORY }}
addon_ref: ${{ env.GITHUB_REF }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![tests](https://github.com/ddev/ddev-varnish/actions/workflows/tests.yml/badge.svg)](https://github.com/ddev/ddev-varnish/actions/workflows/tests.yml) ![project is maintained](https://img.shields.io/maintenance/yes/2024.svg)
[![tests](https://github.com/ddev/ddev-varnish/actions/workflows/tests.yml/badge.svg)](https://github.com/ddev/ddev-varnish/actions/workflows/tests.yml) ![project is maintained](https://img.shields.io/maintenance/yes/2025.svg)

# ddev-varnish

Expand Down
8 changes: 2 additions & 6 deletions install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ project_files:
- varnish
- commands/varnish

ddev_version_constraint: '>= v1.24.0'

pre_install_actions:
# Make sure we have a ddev version that can support what we do here
- |
#ddev-nodisplay
#ddev-description:Checking DDEV version
(ddev debug capabilities | grep ddev-get-yaml-interpolation >/dev/null) || (echo "Please upgrade DDEV to v1.21.4+ for appropriate capabilities" && false)
# Make sure we have a ddev version that can support what we do here
- |
#ddev-nodisplay
#ddev-description:Removing old docker-compose.varnish-extras.yaml
Expand Down
21 changes: 10 additions & 11 deletions tests/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,26 @@ setup() {
export TESTDIR=~/tmp/testvarnish
mkdir -p $TESTDIR
export PROJNAME=test-varnish
export DDEV_NON_INTERACTIVE=true
export DDEV_NONINTERACTIVE=true
ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 || true
cd "${TESTDIR}"
ddev config --project-name=${PROJNAME} --additional-hostnames=extrahostname --additional-fqdns=extrafqdn.ddev.site --omit-containers=db
# dba is gone in v1.22.0, so try to do it but ignore results
ddev config --omit-containers=dba,db >/dev/null 2>&1 || true
printf "<?php\nphpinfo();\n" >index.php
ddev start >/dev/null
ddev start -y >/dev/null
}

teardown() {
set -eu -o pipefail
cd ${TESTDIR} || (printf "unable to cd to ${TESTDIR}\n" && exit 1)
cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 )
ddev delete -Oy ${PROJNAME} >/dev/null 2>&1
[ "${TESTDIR}" != "" ] && rm -rf ${TESTDIR}
}

@test "install from directory" {
set -eu -o pipefail
cd ${TESTDIR}
echo "# ddev get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3
ddev get ${DIR} >/dev/null
echo "# ddev add-on get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3
ddev add-on get ${DIR} >/dev/null
ddev restart >/dev/null 2>&1
for url in http://${PROJNAME}.ddev.site/ http://extrahostname.ddev.site/ http://extrafqdn.ddev.site/ https://${PROJNAME}.ddev.site/ https://extrahostname.ddev.site/ https://extrafqdn.ddev.site/ ; do
# It's "Via:" with http and "via:" with https. Tell me why.
Expand All @@ -48,8 +46,8 @@ teardown() {
set -eu -o pipefail
cd ${TESTDIR}
ddev config --router-http-port 8080 --router-https-port 8443 --mailpit-http-port 18025 --mailpit-https-port 18026
echo "# ddev get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3
ddev get ${DIR} >/dev/null
echo "# ddev add-on get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3
ddev add-on get ${DIR} >/dev/null
ddev restart >/dev/null 2>&1
for url in http://${PROJNAME}.ddev.site:8080/ http://extrahostname.ddev.site:8080/ http://extrafqdn.ddev.site:8080/ https://${PROJNAME}.ddev.site:8443/ https://extrahostname.ddev.site:8443/ https://extrafqdn.ddev.site:8443/ ; do
# It's "Via:" with http and "via:" with https. Tell me why.
Expand All @@ -68,11 +66,12 @@ teardown() {
curl -sI "https://${PROJNAME}.ddev.site:18026" | grep -i "https://novarnish.${PROJNAME}.ddev.site:18026/" >/dev/null || (echo "# https://${PROJNAME}.ddev.site:18026 did not redirect" >&3 && exit 1);
}

# bats test_tags=release
@test "install from release" {
set -eu -o pipefail
cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 )
echo "# ddev get ddev/ddev-varnish with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3
ddev get ddev/ddev-varnish >/dev/null
echo "# ddev add-on get ddev/ddev-varnish with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3
ddev add-on get ddev/ddev-varnish >/dev/null
ddev restart >/dev/null 2>&1
for url in http://${PROJNAME}.ddev.site/ http://extrahostname.ddev.site/ http://extrafqdn.ddev.site/ https://${PROJNAME}.ddev.site/ https://extrahostname.ddev.site/ https://extrafqdn.ddev.site/ ; do
# It's "Via:" with http and "via:" with https. Tell me why.
Expand Down

0 comments on commit 8555209

Please sign in to comment.