Skip to content

Commit a484814

Browse files
authored
feat: apply changes from ddev-addon-template (#32)
1 parent 7f0a471 commit a484814

File tree

8 files changed

+174
-52
lines changed

8 files changed

+174
-52
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 🐞 Bug report or Support Request
2+
description: Create a report to help us improve.
3+
labels: [bug]
4+
body:
5+
- type: checkboxes
6+
attributes:
7+
label: Preliminary checklist
8+
description: Please complete the following checks before submitting an issue.
9+
options:
10+
- label: I am using the latest stable version of DDEV
11+
required: true
12+
- label: I am using the latest stable version of this add-on
13+
required: true
14+
- type: textarea
15+
attributes:
16+
label: Expected Behavior
17+
description: What did you expect to happen?
18+
validations:
19+
required: true
20+
- type: textarea
21+
attributes:
22+
label: Actual Behavior
23+
description: What actually happened instead?
24+
validations:
25+
required: true
26+
- type: textarea
27+
attributes:
28+
label: Steps To Reproduce
29+
description: Specific steps to reproduce the behavior.
30+
placeholder: |
31+
1. In this environment...
32+
2. With this config...
33+
3. Run `...`
34+
4. See error...
35+
validations:
36+
required: false
37+
- type: textarea
38+
attributes:
39+
label: Anything else?
40+
description: |
41+
Links? References? Screenshots? Anything that will give us more context about your issue!
42+
43+
💡 Attach images or log files by clicking this area to highlight it and dragging files in.
44+
validations:
45+
required: false
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: 🚀 Feature request
2+
description: Suggest an idea for this project.
3+
labels: [enhancement]
4+
body:
5+
- type: checkboxes
6+
attributes:
7+
label: Is there an existing issue for this?
8+
description: Please search existing issues to see if one already exists for your request.
9+
options:
10+
- label: I have searched the existing issues
11+
required: true
12+
- type: textarea
13+
attributes:
14+
label: Is your feature request related to a problem?
15+
description: Clearly and concisely describe the problem. (Ex. I'm always frustrated when...)
16+
validations:
17+
required: true
18+
- type: textarea
19+
attributes:
20+
label: Describe your solution
21+
description: Clearly and concisely describe what you want to happen.
22+
validations:
23+
required: true
24+
- type: textarea
25+
attributes:
26+
label: Describe alternatives
27+
description: Clearly and concisely describe any alternative solutions or features you've considered.
28+
validations:
29+
required: false
30+
- type: textarea
31+
attributes:
32+
label: Additional context
33+
description: Add any other context or screenshots about the feature request.
34+
validations:
35+
required: false

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## The Issue
2+
3+
- #<issue number>
4+
5+
<!-- Provide a brief description of the issue. -->
6+
7+
## How This PR Solves The Issue
8+
9+
## Manual Testing Instructions
10+
11+
## Automated Testing Overview
12+
13+
<!-- Please describe the tests introduced by this PR, or explain why no tests are needed. -->
14+
15+
## Release/Deployment Notes
16+
17+
<!-- Does this affect anything else or have ramifications for other code? Does anything have to be done on deployment? -->

.github/workflows/tests.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@ on:
1010
workflow_dispatch:
1111
inputs:
1212
debug_enabled:
13-
description: 'Debug with tmate set "debug_enabled"'
13+
type: boolean
14+
description: Debug with tmate
1415
required: false
15-
default: "false"
16+
default: false
1617

18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
# This is required for "gautamkrishnar/keepalive-workflow", see "ddev/github-action-add-on-test"
1723
permissions:
1824
actions: write
1925

@@ -27,10 +33,10 @@ jobs:
2733
runs-on: ubuntu-latest
2834

2935
steps:
30-
- uses: ddev/github-action-add-on-test@v2
31-
with:
32-
ddev_version: ${{ matrix.ddev_version }}
33-
token: ${{ secrets.GITHUB_TOKEN }}
34-
debug_enabled: ${{ github.event.inputs.debug_enabled }}
35-
addon_repository: ${{ env.GITHUB_REPOSITORY }}
36-
addon_ref: ${{ env.GITHUB_REF }}
36+
- uses: ddev/github-action-add-on-test@v2
37+
with:
38+
ddev_version: ${{ matrix.ddev_version }}
39+
token: ${{ secrets.GITHUB_TOKEN }}
40+
debug_enabled: ${{ github.event.inputs.debug_enabled }}
41+
addon_repository: ${{ env.GITHUB_REPOSITORY }}
42+
addon_ref: ${{ env.GITHUB_REF }}

README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![tests](https://github.com/ddev/ddev-adminer/actions/workflows/tests.yml/badge.svg)](https://github.com/ddev/ddev-adminer/actions/workflows/tests.yml) ![project is maintained](https://img.shields.io/maintenance/yes/2024.svg)
1+
[![tests](https://github.com/ddev/ddev-adminer/actions/workflows/tests.yml/badge.svg)](https://github.com/ddev/ddev-adminer/actions/workflows/tests.yml) ![project is maintained](https://img.shields.io/maintenance/yes/2025.svg)
22

33
# DDEV Adminer Service
44

@@ -16,20 +16,10 @@ AdminerEvo works with MySQL, MariaDB, PostgreSQL, SQLite, MS SQL, Oracle, Elasti
1616

1717
## Installation
1818

19-
For DDEV v1.23.5 or above run
20-
21-
```sh
22-
ddev add-on get ddev/ddev-adminer
23-
```
24-
25-
For earlier versions of DDEV run
26-
2719
```sh
28-
ddev get ddev/ddev-adminer
20+
ddev add-on get ddev/ddev-adminer && ddev restart
2921
```
3022

31-
Afterward run `ddev restart`
32-
3323
Then you can just `ddev adminer` or use `ddev describe` to get the URL (`https://<project>.ddev.site:9101`).
3424

3525
## What does this add-on do?

commands/host/adminer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
## #ddev-generated: If you want to edit and own this file, remove this line.
44
## Description: Launch a browser with Adminer

install.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ project_files:
66
- docker-compose.adminer_norouter.yaml
77
- commands/host/adminer
88

9+
ddev_version_constraint: '>= v1.24.2'
10+
911
pre_install_actions:
1012
# Ensure we're on DDEV 1.23+. It's required for the `adminer` command (launch by port).
1113
- |

tests/test.bats

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,50 @@
1+
#!/usr/bin/env bats
2+
3+
# Bats is a testing framework for Bash
4+
# Documentation https://bats-core.readthedocs.io/en/stable/
5+
# Bats libraries documentation https://github.com/ztombol/bats-docs
6+
7+
# For local tests, install bats-core, bats-assert, bats-file, bats-support
8+
# And run this in the add-on root directory:
9+
# bats ./tests/test.bats
10+
# To exclude release tests:
11+
# bats ./tests/test.bats --filter-tags '!release'
12+
# For debugging:
13+
# bats ./tests/test.bats --show-output-of-passing-tests --verbose-run --print-output-on-failure
14+
115
setup() {
216
set -eu -o pipefail
3-
brew_prefix=$(brew --prefix)
4-
load "${brew_prefix}/lib/bats-support/load.bash"
5-
load "${brew_prefix}/lib/bats-assert/load.bash"
617

7-
export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.."
8-
export TESTDIR=~/tmp/test-adminer
9-
mkdir -p $TESTDIR
10-
export PROJNAME=test-adminer
11-
export DDEV_NON_INTERACTIVE=true
12-
ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 || true
18+
# Override this variable for your add-on:
19+
export GITHUB_REPO=ddev/ddev-adminer
20+
21+
TEST_BREW_PREFIX="$(brew --prefix 2>/dev/null || true)"
22+
export BATS_LIB_PATH="${BATS_LIB_PATH}:${TEST_BREW_PREFIX}/lib:/usr/lib/bats"
23+
bats_load_library bats-assert
24+
bats_load_library bats-file
25+
bats_load_library bats-support
26+
27+
export DIR="$(cd "$(dirname "${BATS_TEST_FILENAME}")/.." >/dev/null 2>&1 && pwd)"
28+
export PROJNAME="test-$(basename "${GITHUB_REPO}")"
29+
mkdir -p ~/tmp
30+
export TESTDIR=$(mktemp -d ~/tmp/${PROJNAME}.XXXXXX)
31+
export DDEV_NONINTERACTIVE=true
32+
export DDEV_NO_INSTRUMENTATION=true
33+
ddev delete -Oy "${PROJNAME}" >/dev/null 2>&1 || true
1334
cd "${TESTDIR}"
14-
ddev config --project-name=${PROJNAME}
15-
ddev start -y >/dev/null 2>&1
35+
run ddev config --project-name="${PROJNAME}" --project-tld=ddev.site
36+
assert_success
37+
run ddev start -y
38+
assert_success
1639
}
1740

1841
health_checks() {
19-
set +u # bats-assert has unset variables so turn off unset check
20-
# ddev restart is required because we have done `ddev add-on get` on a new service
21-
run ddev restart
22-
assert_success
2342
# Make sure we can hit the 9101 port successfully
24-
curl -s -I -f https://${PROJNAME}.ddev.site:9101 >/tmp/curlout.txt
43+
run curl -sfI https://${PROJNAME}.ddev.site:9101
44+
assert_success
45+
assert_output --partial "HTTP/2 200"
46+
assert_output --partial "adminer"
47+
2548
# Make sure `ddev adminer` works
2649
DDEV_DEBUG=true run ddev adminer
2750
assert_success
@@ -30,35 +53,39 @@ health_checks() {
3053

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

3860
@test "install from directory" {
3961
set -eu -o pipefail
40-
cd ${TESTDIR}
41-
echo "# ddev add-on get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3
42-
ddev add-on get ${DIR} >/dev/null 2>&1
43-
ddev mutagen sync >/dev/null 2>&1
62+
echo "# ddev add-on get ${DIR} with project ${PROJNAME} in $(pwd)" >&3
63+
run ddev add-on get "${DIR}"
64+
assert_success
65+
run ddev restart -y
66+
assert_success
4467
health_checks
4568
}
4669

70+
# bats test_tags=release
4771
@test "install from release" {
4872
set -eu -o pipefail
49-
cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 )
50-
echo "# ddev add-on get ddev/ddev-adminer with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3
51-
ddev add-on get ddev/ddev-adminer >/dev/null 2>&1
52-
ddev restart >/dev/null 2>&1
73+
echo "# ddev add-on get ${GITHUB_REPO} with project ${PROJNAME} in $(pwd)" >&3
74+
run ddev add-on get "${GITHUB_REPO}"
75+
assert_success
76+
run ddev restart -y
77+
assert_success
5378
health_checks
5479
}
5580

5681
@test "install from directory with nonstandard port" {
5782
set -eu -o pipefail
58-
cd ${TESTDIR}
59-
ddev config --router-http-port=8080 --router-https-port=8443
60-
echo "# ddev add-on get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3
61-
ddev add-on get ${DIR} >/dev/null 2>&1
62-
ddev mutagen sync >/dev/null 2>&1
83+
run ddev config --router-http-port=8080 --router-https-port=8443
84+
assert_success
85+
echo "# ddev add-on get ${DIR} with project ${PROJNAME} in $(pwd)" >&3
86+
run ddev add-on get "${DIR}"
87+
assert_success
88+
run ddev restart -y
89+
assert_success
6390
health_checks
6491
}

0 commit comments

Comments
 (0)