Skip to content

Commit

Permalink
Refactor development commands and testing stack. Change docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
kszymukowicz committed Jun 9, 2024
1 parent 0aa2c9d commit b904722
Show file tree
Hide file tree
Showing 63 changed files with 427 additions and 510 deletions.
60 changes: 0 additions & 60 deletions .ddev/commands/host/.test-single

This file was deleted.

90 changes: 90 additions & 0 deletions .ddev/commands/host/ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#!/bin/bash

## Description: Run matrix tests from TYPO3_VERSIONS, PHP_VERSIONS, composer "lowest/highest".
## Usage: "ci"
## Example: "ddev ci" or "ddev ci all" or "ddev ci 12 8.3 lowest"

set -e

source .ddev/test/utils.sh
export_ddev_env_vars

ci_single() {
TYPO3=$1
PHP=$2
COMPOSER=${3:-highest}

if [ -z "$TYPO3" ]; then
TYPO3=$(get_lowest_supported_typo3_versions)
else
if ! check_typo3_version "$TYPO3"; then
exit 1
fi
fi

if [ -z "$PHP" ]; then
PHP=$(get_lowest_supported_php_versions_for_typo3 "$TYPO3")
else
if ! check_php_version_for_typo3 "$TYPO3" "$PHP"; then
exit 1
fi
fi

if [[ "$COMPOSER" != "lowest" && "$COMPOSER" != "highest" ]]; then
echo_red "Invalid third argument. COMPOSER value can only be 'lowest' or 'highest'."
exit 1
fi

echo_magenta "-------------------------------------------------"
echo_magenta "| TYPO3 \t| PHP\t\t| Composer\t|"
echo_magenta "-------------------------------------------------"
echo_magenta "| $TYPO3\t\t| $PHP\t\t| $COMPOSER\t|"
echo_magenta "-------------------------------------------------"
echo_magenta ""

ddev config --php-version="$PHP"
ddev restart
if [ "$COMPOSER" == "lowest" ]; then
ddev exec composer update --prefer-lowest --prefer-stable
else
ddev exec composer update
fi
ddev composer normalize
ddev install "$TYPO3"
ddev composer ci
}

if [ $# -eq 0 ]; then
ddev composer ci
ddev docs ci
exit 0
fi

TYPO3=${1}

if [ "$TYPO3" == "all" ]; then
COMPOSER_INSTALLS=("lowest" "highest")

TYPO3_VERSIONS_ARRAY=()
while IFS= read -r line; do
TYPO3_VERSIONS_ARRAY+=("$line")
done < <(get_supported_typo3_versions)

for TYPO3 in "${TYPO3_VERSIONS_ARRAY[@]}"; do
PHP_VERSIONS=()
while IFS= read -r line; do
PHP_VERSIONS+=("$line")
done < <(get_supported_php_versions_for_typo3 "$TYPO3")
for PHP in "${PHP_VERSIONS[@]}"; do
for COMPOSER in "${COMPOSER_INSTALLS[@]}"; do
ci_single "$TYPO3" "$PHP" "$COMPOSER"
done
done
done
ddev docs ci
else
PHP=${2}
COMPOSER=${3}
ci_single "$TYPO3" "$PHP" "$COMPOSER"
ddev docs ci
fi
19 changes: 14 additions & 5 deletions .ddev/commands/host/docs
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
#!/bin/bash

## Description: Build docs or open docs editing in watch mode. Mode "watch" is default.
## Usage: "docs [watch|build]"
## Example: "ddev docs" "ddev docs watch" "ddev docs build"
## Usage: "docs [watch|build|test]"
## Example: "ddev docs" "ddev docs watch" "ddev docs build" "ddev docs test"

MODE=${1:-watch}

if [ "$MODE" == "build" ]; then
docker run --rm --pull always -v ./:/project/ ghcr.io/typo3-documentation/render-guides:latest --no-progress --config Documentation Documentation
mkdir -p Documentation-GENERATED-temp
docker run --rm --pull always -v ./:/project/ ghcr.io/typo3-documentation/render-guides:latest --no-progress --config Documentation
elif [ "$MODE" == "watch" ]; then
open http://localhost:5174/Documentation-GENERATED-temp/Index.html && docker run --rm -it --pull always -v ./Documentation:/project/Documentation -v ./Documentation-GENERATED-temp:/project/Documentation-GENERATED-temp -p 5174:5173 ghcr.io/garvinhicking/typo3-documentation-browsersync:latest
mkdir -p Documentation-GENERATED-temp
open http://localhost:5173/Documentation-GENERATED-temp/Index.html
docker run --rm -it --pull always \
-v "./Documentation:/project/Documentation" \
-v "./Documentation-GENERATED-temp:/project/Documentation-GENERATED-temp" \
-p 5173:5173 ghcr.io/garvinhicking/typo3-documentation-browsersync:latest
elif [ "$MODE" == "ci" ]; then
mkdir -p Documentation-GENERATED-temp
docker run --rm --pull always -v "$(pwd)":/project -t ghcr.io/typo3-documentation/render-guides:latest --config=Documentation --no-progress --fail-on-log
else
echo "Invalid mode. Please use 'build' or 'watch'."
echo "Invalid mode. Please use 'build', 'watch', or 'test'."
exit 1
fi
37 changes: 0 additions & 37 deletions .ddev/commands/host/test

This file was deleted.

63 changes: 0 additions & 63 deletions .ddev/commands/web/.data-export

This file was deleted.

30 changes: 0 additions & 30 deletions .ddev/commands/web/.data-import

This file was deleted.

Loading

0 comments on commit b904722

Please sign in to comment.