-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: tests | ||
on: | ||
pull_request: | ||
push: | ||
branches: [ main ] | ||
|
||
schedule: | ||
- cron: '25 07 * * *' | ||
|
||
workflow_dispatch: | ||
inputs: | ||
debug_enabled: | ||
description: 'Debug with tmate set "debug_enabled"' | ||
required: false | ||
default: "false" | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
# This is required for "gautamkrishnar/keepalive-workflow" | ||
permissions: | ||
contents: write | ||
|
||
env: | ||
NIGHTLY_DDEV_PR_URL: "https://nightly.link/ddev/ddev/actions/runs/1720215802/ddev-linux-amd64.zip" | ||
# Allow ddev get to use a github token to prevent rate limiting by tests | ||
DDEV_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
tests: | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
strategy: | ||
matrix: | ||
ddev_version: [stable, HEAD] | ||
# ddev_version: [stable, edge, HEAD, P] | ||
fail-fast: false | ||
|
||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Homebrew | ||
id: set-up-homebrew | ||
uses: Homebrew/actions/setup-homebrew@master | ||
- name: Environment setup | ||
run: | | ||
brew install bats-core mkcert | ||
mkcert -install | ||
- name: Use ddev stable | ||
if: matrix.ddev_version == 'stable' | ||
run: brew install ddev/ddev/ddev | ||
|
||
- name: Use ddev edge | ||
if: matrix.ddev_version == 'edge' | ||
run: brew install ddev/ddev-edge/ddev | ||
|
||
- name: Use ddev HEAD | ||
if: matrix.ddev_version == 'HEAD' | ||
run: brew install --HEAD ddev/ddev/ddev | ||
|
||
- name: Use ddev PR | ||
if: matrix.ddev_version == 'PR' | ||
run: | | ||
curl -sSL -o ddev_linux.zip ${NIGHTLY_DDEV_PR_URL} | ||
unzip ddev_linux.zip | ||
mv ddev /usr/local/bin/ddev && chmod +x /usr/local/bin/ddev | ||
- name: Download docker images | ||
run: | | ||
mkdir junk && pushd junk && ddev config --auto && ddev debug download-images >/dev/null && ddev delete -Oy junk | ||
- name: tmate debugging session | ||
uses: mxschmitt/action-tmate@v3 | ||
with: | ||
limit-access-to-actor: true | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }} | ||
|
||
- name: tests | ||
run: bats tests | ||
|
||
# keepalive-workflow adds a dummy commit if there's no other action here, keeps | ||
# GitHub from turning off tests after 60 days | ||
- uses: gautamkrishnar/keepalive-workflow@v1 | ||
if: matrix.ddev_version == 'stable' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
setup() { | ||
set -eu -o pipefail | ||
export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.." | ||
export TESTDIR=~/tmp/test-opensearch | ||
mkdir -p $TESTDIR | ||
export PROJECTNAME=test-opensearch | ||
export ADDON_PATH="ddev/ddev-opensearch" | ||
export USE_VERSION8=false | ||
export DDEV_NON_INTERACTIVE=true | ||
ddev delete -Oy ${PROJECTNAME} >/dev/null 2>&1 || true | ||
cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) | ||
ddev config --project-name=${PROJECTNAME} | ||
ddev start -y >/dev/null | ||
} | ||
|
||
execute_test() { | ||
echo "# ddev get ${ADDON_PATH} with project ${PROJECTNAME} in ${TESTDIR} ($(pwd))" >&3 | ||
ddev get ${ADDON_PATH} >/dev/null | ||
ddev restart >/dev/null | ||
health_checks | ||
} | ||
|
||
health_checks() { | ||
ddev exec "curl -s opensearch:9200" | grep "${PROJECTNAME}-opensearch" | ||
} | ||
|
||
teardown() { | ||
ddev delete -Oy ${PROJECTNAME} >/dev/null 2>&1 | ||
[ "${TESTDIR}" != "" ] && rm -rf ${TESTDIR} | ||
} | ||
|
||
@test "install from directory" { | ||
ADDON_PATH="${DIR}" | ||
execute_test | ||
} | ||
|
||
@test "install from release" { | ||
execute_test | ||
} |