Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Adapt github actions for TYPO3 13 #105

Merged
merged 7 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions .ddev/commands/host/ci
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,41 @@ ci_single() {
fi

if [[ "$COMPOSER" != "lowest" && "$COMPOSER" != "highest" ]]; then
echo_red "Invalid third argument. COMPOSER value can only be 'lowest' or 'highest'."
message 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 ""
message magenta "-------------------------------------------------"
message magenta "| TYPO3 \t| PHP\t\t| Composer\t|"
message magenta "-------------------------------------------------"
message magenta "| $TYPO3\t\t| $PHP\t\t| $COMPOSER\t|"
message magenta "-------------------------------------------------"
message magenta ""

ddev config --php-version="$PHP"
ddev restart

if [ -z "$GH_TOKEN" ] && ! ddev composer config --global --list | grep -q "github-oauth.github.com"; then
message red 'Be sure we have some github token. Add it to your ~/.ddev/homeadditions/.composer/auth.json or make available as GH_TOKEN'
exit 1
fi
if ! ddev composer config --global --list | grep -q "github-oauth.github.com"; then
message magenta "Add GH_TOKEN to composer github-oauth.github.com"
ddev composer config --global github-oauth.github.com ${GH_TOKEN}
fi

stashComposerFiles
ddev composer require --no-ansi --no-interaction --no-progress --no-update typo3/cms-core:^${TYPO3} || exit 1
if [ "$COMPOSER" == "lowest" ]; then
ddev exec composer update --prefer-lowest --prefer-stable --with-dependencies --no-progress --no-interaction || exit 1
else
ddev exec composer update --with-dependencies --no-progress --no-interaction || exit 1
fi
message magenta "ddev composer normalize"
ddev composer normalize
message magenta "ddev install $TYPO3"
ddev install "$TYPO3"
message magenta "composer ci"
ddev composer ci
restoreComposerFiles
}
Expand Down
8 changes: 5 additions & 3 deletions .ddev/commands/web/.install-12
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ jq '.extra.patches += {"typo3/cms-impexp": {"Disable error on new sys_file warni
cp ".ddev/test/files/patches/typo3-cms-impexp-disable-error-on-sys-file-warning.patch" $BASE_PATH/patches/

composer req typo3/minimal:'^12.4' typo3/cms-recycler:'^12.4' typo3/cms-tstemplate:'^12.4' typo3/cms-info:'^12.4' \
typo3/cms-lowlevel:'^12.4' typo3/cms-rte-ckeditor:'^12.4' typo3/cms-impexp:'^12.4' \
helhum/typo3-console:'^8.1' georgringer/news:'dev-12-13' \
v/site:'^1.0.0' sourcebroker/t3apinews:'^1.0.0' cweagans/composer-patches \
typo3/cms-install:'^12.4' typo3/cms-lowlevel:'^12.4' typo3/cms-rte-ckeditor:'^12.4' typo3/cms-impexp:'^12.4' \
typo3/cms-install:'^12.4' \
helhum/typo3-console:'^8.1' \
cweagans/composer-patches:'^1.7.3' georgringer/news:'dev-12-13' \
sourcebroker/t3apinews:'^1.0.0' v/site:'^1.0.0' \
sourcebroker/t3api:'@dev' \
--no-progress --no-interaction --working-dir $BASE_PATH

Expand Down
7 changes: 5 additions & 2 deletions .ddev/commands/web/.install-13
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ DATABASE=database_$VERSION

rm -rf $BASE_PATH


exclusions=(".*" "Documentation" "Documentation-GENERATED-temp" "var")
mkdir -p "$BASE_PATH/src/$EXTENSION_KEY"
for item in ./*; do
Expand Down Expand Up @@ -48,8 +49,10 @@ cp ".ddev/test/files/patches/typo3-cms-core-review-85198.patch" $BASE_PATH/patch
composer req typo3/cms-backend:'^13.3' typo3/cms-core:'^13.3' typo3/cms-extbase:'^13.3' typo3/cms-filelist:'^13.3' \
typo3/cms-fluid:'^13.3' typo3/cms-frontend:'^13.3' typo3/cms-recycler:'^13.3' typo3/cms-tstemplate:'^13.3' \
typo3/cms-info:'^13.3' typo3/cms-lowlevel:'^13.3' typo3/cms-rte-ckeditor:'^13.3' typo3/cms-impexp:'^13.3' \
helhum/typo3-console:'dev-issue/1169' georgringer/news:'dev-12-13' \
v/site:'^1.0.0' sourcebroker/t3apinews:'^1.0.0' cweagans/composer-patches:'^1.7.3' \
typo3/cms-install:'^13.3' \
helhum/typo3-console:'dev-issue/1169' \
cweagans/composer-patches:'^1.7.3' georgringer/news:'dev-12-13' \
sourcebroker/t3apinews:'^1.0.0' v/site:'^1.0.0' \
sourcebroker/t3api:'@dev' \
--no-progress --no-interaction --working-dir $BASE_PATH

Expand Down
4 changes: 2 additions & 2 deletions .ddev/commands/web/cache-flush
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ mapfile -t versions < <(get_supported_typo3_versions)
for version in "${versions[@]}"; do
TYPO3_PATH=".test/${version}/vendor/bin/typo3"
if [ -f "$TYPO3_PATH" ]; then
echo_green "Cache flush TYPO3 v${version}..."
message green "Cache flush TYPO3 v${version}..."
/usr/bin/php $TYPO3_PATH cache:flush
else
echo_red "TYPO3 binary not found for version ${version}"
message red "TYPO3 binary not found for version ${version}"
fi
done
2 changes: 1 addition & 1 deletion .ddev/commands/web/data
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ exportData() {
mv "${EXPORT_PATH}" "${TEST_SRC_IMPEXP_DIR}"
mv "${EXPORT_PATH}.files/" "${TEST_SRC_IMPEXP_DIR}"

echo_green "Dump finished and saved at ${TEST_SRC_IMPEXP_DIR}/${EXPORT_FILE}"
message green "Dump finished and saved at ${TEST_SRC_IMPEXP_DIR}/${EXPORT_FILE}"
}


Expand Down
2 changes: 1 addition & 1 deletion .ddev/commands/web/install
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TYPO3=${1}
if [ "$TYPO3" == "all" ]; then
mapfile -t versions < <(get_supported_typo3_versions)
for version in "${versions[@]}"; do
echo_green "Installing TYPO3 v${version}..."
message green "Installing TYPO3 v${version}..."
.ddev/commands/web/.install-$version
done
else
Expand Down
58 changes: 37 additions & 21 deletions .ddev/test/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

function get_supported_typo3_versions() {
if [ -z "${TYPO3_VERSIONS+x}" ]; then
echo_red "TYPO3_VERSIONS is unset. Please set it before running this function."
message red "TYPO3_VERSIONS is unset. Please set it before running this function."
return 1
else
local TYPO3_VERSIONS_ARRAY=()
IFS=' ' read -r -a TYPO3_VERSIONS_ARRAY <<< "$TYPO3_VERSIONS"
if [ ${#TYPO3_VERSIONS_ARRAY[@]} -eq 0 ]; then
echo_red "Error! No supported TYPO3 versions found in environment variables."
message red "Error! No supported TYPO3 versions found in environment variables."
return 1
fi
printf "%s\n" "${TYPO3_VERSIONS_ARRAY[@]}"
Expand All @@ -29,7 +29,7 @@ function get_supported_php_versions_for_typo3() {
local PHP_VERSIONS_ARRAY=()
eval "IFS=' ' read -r -a PHP_VERSIONS_ARRAY <<< \"\${TYPO3_VERSIONS_${TYPO3_VERSION}_PHP}\""
if [ ${#PHP_VERSIONS_ARRAY[@]} -eq 0 ]; then
echo_red "Error! There is no TYPO3_VERSIONS_${TYPO3_VERSION}_PHP variable."
message red "Error! There is no TYPO3_VERSIONS_${TYPO3_VERSION}_PHP variable."
exit 1
fi
printf "%s\n" "${PHP_VERSIONS_ARRAY[@]}"
Expand All @@ -41,7 +41,7 @@ function check_typo3_version() {
local found=0

if [ -z "$TYPO3" ]; then
echo_red "No TYPO3 version provided. Please set one of the supported TYPO3 versions as argument: $(get_supported_typo3_versions_comma_separated)"
message red "No TYPO3 version provided. Please set one of the supported TYPO3 versions as argument: $(get_supported_typo3_versions_comma_separated)"
exit 1
fi

Expand All @@ -57,7 +57,7 @@ function check_typo3_version() {
done

if [[ $found -eq 0 ]]; then
echo_red "TYPO3 version '$TYPO3' is not supported."
message red "TYPO3 version '$TYPO3' is not supported."
exit 1
fi

Expand All @@ -83,7 +83,7 @@ function check_php_version_for_typo3() {

if [[ $found -eq 0 ]]; then
IFS=', '
echo_red "Invalid second argument. PHP version can only be one of: ${SUPPORTED_PHP_VERSIONS_ARRAY[*]} for TYPO3 ${TYPO3}."
message red "Invalid second argument. PHP version can only be one of: ${SUPPORTED_PHP_VERSIONS_ARRAY[*]} for TYPO3 ${TYPO3}."
IFS=' '
return 1
fi
Expand All @@ -95,7 +95,7 @@ function get_lowest_supported_typo3_versions() {
local TYPO3_VERSIONS_ARRAY=()
IFS=' ' read -r -a TYPO3_VERSIONS_ARRAY <<< "$TYPO3_VERSIONS"
if [ ${#TYPO3_VERSIONS_ARRAY[@]} -eq 0 ]; then
echo_red "Error! No supported TYPO3 versions found in environment variables."
message red "Error! No supported TYPO3 versions found in environment variables."
exit 1
fi
printf "%s\n" "${TYPO3_VERSIONS_ARRAY[@]}" | sort -V | head -n 1
Expand All @@ -106,7 +106,7 @@ function get_lowest_supported_php_versions_for_typo3() {
local PHP_VERSIONS_ARRAY=()
eval "IFS=' ' read -r -a PHP_VERSIONS_ARRAY <<< \"\${TYPO3_VERSIONS_${TYPO3}_PHP}\""
if [ ${#PHP_VERSIONS_ARRAY[@]} -eq 0 ]; then
echo_red "Error! There is no TYPO3_VERSIONS_${TYPO3}_PHP variable."
message red "Error! There is no TYPO3_VERSIONS_${TYPO3}_PHP variable."
exit 1
fi
printf "%s\n" "${PHP_VERSIONS_ARRAY[@]}" | sort -V | head -n 1
Expand Down Expand Up @@ -135,22 +135,38 @@ restoreComposerFiles() {
mv composer.json.orig composer.json
local message='composer.json has been restored.'
if [ $exit_status -eq 0 ]; then
echo_green "${message}"
message green "${message}"
else
echo_red "${message}"
message red "${message}"
fi
fi
}

function echo_magenta() {
echo -e "\033[35m$1\033[0m"
message() {
local color=$1
local message=$2

case $color in
red)
echo -e "\033[31m$message\033[0m"
;;
green)
echo -e "\033[32m$message\033[0m"
;;
yellow)
echo -e "\033[33m$message\033[0m"
;;
blue)
echo -e "\033[34m$message\033[0m"
;;
magenta)
echo -e "\033[35m$message\033[0m"
;;
cyan)
echo -e "\033[36m$message\033[0m"
;;
*)
echo "$message"
;;
esac
}

function echo_red() {
echo -e "\033[41m$1\033[0m"
}

function echo_green() {
echo -e "\033[32m$1\033[0m"
}

11 changes: 11 additions & 0 deletions .github/workflows/TYPO3_12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
branches:
- main
- release/4.0.0
pull_request:
branches:
- main
- release/4.0.0

jobs:
test:
Expand All @@ -16,8 +18,17 @@ jobs:
typo3: ["12"]
php: ["8.1", "8.2", "8.3"]
composer: ["lowest", "highest"]
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Check Gitlab Token
run: |
if [ -z "${{ env.GH_TOKEN }}" ]; then
echo "GH_TOKEN is not set in Action Secrets"
exit 1
fi
- name: Run tests
uses: ddev/github-action-setup-ddev@v1
- run: ddev composer config --global github-oauth.github.com ${{ env.GH_TOKEN }}
- run: ddev ci ${{ matrix.typo3 }} ${{ matrix.php }} ${{ matrix.composer }}
33 changes: 33 additions & 0 deletions .github/workflows/TYPO3_13.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: TYPO3 13

on:
push:
branches:
- release/4.0.0
pull_request:
branches:
- release/4.0.0

jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
typo3: ["13"]
php: ["8.2", "8.3"]
composer: ["lowest", "highest"]
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Check Gitlab Token
run: |
if [ -z "${{ env.GH_TOKEN }}" ]; then
echo "GH_TOKEN is not set in Action Secrets"
exit 1
fi
- name: Run tests
uses: ddev/github-action-setup-ddev@v1
- run: ddev composer config --global github-oauth.github.com ${{ env.GH_TOKEN }}
- run: ddev ci ${{ matrix.typo3 }} ${{ matrix.php }} ${{ matrix.composer }}

3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
"saschaegerer/phpstan-typo3": "^1.10.0",
"seld/jsonlint": "^1.10.2",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0",
"typo3/cms-install": "^12.4.2 || ^13.1",
"typo3/coding-standards": "^0.8",
"typo3/testing-framework": "^8.0",
"typo3/testing-framework": "^8.2.1",
"webmozart/assert": "^1.11.0"
},
"replace": {
Expand Down
Loading