Skip to content

Commit

Permalink
[TASK] sync the CI stuff from main branch into 11.6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
dkd-kaehm authored and dkd-friedrich committed Mar 11, 2024
1 parent a25a12c commit f46b19f
Show file tree
Hide file tree
Showing 13 changed files with 156 additions and 160 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ If applicable, add screenshots to help explain your problem.
**Used versions (please complete the following information):**
- TYPO3 Version: [e.g. 11.5.36]
- Browser: [e.g. chrome, safari]
- EXT:solr Version: [e.g. 11.5.6]
- EXT:solr Version: [e.g. 11.6.0]
- Used Apache Solr Version: [e.g. 8.11.3]
- PHP Version: [e.g. 8.2.0]
- MySQL Version: [e.g. 8.0.0]
Expand Down
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[FEATURE] Please describe your feature wish here"
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

**Target versions**
Please add the EXT:solr target versions here.
67 changes: 21 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ jobs:
outputs:
matrix: ${{ steps.collect_build_matrix.outputs.matrix }}
steps:
# Workaround for issue with actions/checkout@v2 wrong PR commit checkout: See https://github.com/actions/checkout/issues/299#issuecomment-677674415
# Workaround for issue with actions/checkout "wrong PR commit checkout":
# See:
# ** https://github.com/actions/checkout/issues/299#issuecomment-677674415
# ** https://github.com/actions/checkout/issues/1359#issuecomment-1631503791
-
name: Checkout current state of Pull Request
if: github.event_name == 'pull_request'
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
-
name: Checkout current state of Branch
if: github.event_name == 'push'
uses: actions/checkout@v2
# End: Workaround for issue with actions/checkout@v2 wrong PR commit checkout
uses: actions/checkout@v3
# End: Workaround for issue with actions/checkout...
-
name: "Resolve target branch of pull request."
if: github.event_name == 'pull_request'
Expand Down Expand Up @@ -69,10 +72,10 @@ jobs:
echo "matrix=$(echo $matrix)" >> $GITHUB_OUTPUT
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
-
name: Build Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
file: ./Docker/SolrServer/Dockerfile
Expand All @@ -88,7 +91,7 @@ jobs:
./Build/Test/cibuild_docker.sh
-
name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: solrci-image
path: /tmp/solrci-image.tar
Expand All @@ -104,40 +107,39 @@ jobs:
TYPO3_DATABASE_HOST: '127.0.0.1'
TYPO3_DATABASE_USERNAME: 'root'
TYPO3_DATABASE_PASSWORD: 'root'
PHP_CS_FIXER_VERSION: '^3.2.1'
TYPO3_VERSION: ${{ matrix.TYPO3 }}

name: TYPO3 ${{ matrix.TYPO3 }} on PHP ${{ matrix.PHP }}
steps:
# Workaround for issue with actions/checkout@v2 wrong PR commit checkout: See https://github.com/actions/checkout/issues/299#issuecomment-677674415
# Workaround for issue with actions/checkout "wrong PR commit checkout". See: ci_bootstrapping job
-
name: Checkout current state of Pull Request
if: github.event_name == 'pull_request'
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2
ref: ${{ github.event.pull_request.head.sha }}
-
name: Checkout current state of Branch
if: github.event_name == 'push'
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2
# End: Workaround for issue with actions/checkout@v2 wrong PR commit checkout
# End: Workaround for issue with actions/checkout...
-
name: Mount RAMFS
run: |
mkdir -p ${{ env.CI_BUILD_DIRECTORY }}
sudo mount -t tmpfs -o size=3G none ${{ env.CI_BUILD_DIRECTORY }}
sudo mount -t tmpfs -o size=1G none ${{ env.CI_BUILD_DIRECTORY }}
sudo mkdir -p ${{ env.CI_BUILD_DIRECTORY }}/data-{solr,mysql} \
&& sudo chown $USER ${{ env.CI_BUILD_DIRECTORY }}/data-mysql \
&& sudo chown 8983:8983 ${{ env.CI_BUILD_DIRECTORY }}/data-solr
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
-
name: Download solrci-image from "ci_bootstrapping" job
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: solrci-image
path: /tmp
Expand All @@ -160,36 +162,9 @@ jobs:
with:
php-version: ${{ matrix.PHP }}
coverage: pcov
tools: composer:2.1.14
-
name: Resolve CI build cache key
# CI_CACHE_VERSION is used and can be increased to be able to invalidate caches.
# For example if some composer dependencies added or removed in composer.json or
# in Build/Test/bootstrap.sh
run: |
export CURRENT_TYPO3_VERSION_REFERNCE=$(./Build/Helpers/TYPO3_SOURCE_REFERENCE.sh "$TYPO3_VERSION" --short)
export CURRENT_SOLARIUM_VERSION=$(cat composer.json | jq --raw-output '.require."solarium/solarium"')
export CI_CACHE_VERSION="2023.01.20@00:00"
export CI_BUILD_CACHE_KEY=${{ runner.os }}-PHP:${{ matrix.PHP }}-TYPO3:$TYPO3_VERSION@$CURRENT_TYPO3_VERSION_REFERNCE-SOLARIUM:$CURRENT_SOLARIUM_VERSION-"CI_CACHE_VERSION:"$CI_CACHE_VERSION
echo "COMPOSER_GLOBAL_REQUEREMENTS=$(composer config home)" >> $GITHUB_ENV
echo "CI_BUILD_CACHE_KEY=$CI_BUILD_CACHE_KEY" >> $GITHUB_ENV
echo "The key for actions/cache@v2 is \"$CI_BUILD_CACHE_KEY\""
-
name: Restore ci build caches
id: restore_ci_build_caches
uses: actions/cache@v2
with:
path: |
${{ env.CI_BUILD_DIRECTORY }}/Web
${{ env.CI_BUILD_DIRECTORY }}/bin
${{ env.CI_BUILD_DIRECTORY }}/vendor
${{ env.COMPOSER_GLOBAL_REQUEREMENTS }}
composer.json
composer.lock
key: ${{ env.CI_BUILD_CACHE_KEY }}
tools: composer:2.5.5
-
name: CI-Bootstrap
if: steps.restore_ci_build_caches.outputs.cache-hit != 'true'
run: |
./Build/Test/bootstrap.sh --skip-solr-install
echo "Current Size of EXT:Solr build Artefacts before run: " \
Expand All @@ -204,8 +179,8 @@ jobs:
-
name: Upload code coverage to Scrutinizer
run: |
.Build/bin/ocular code-coverage:upload --format=php-clover coverage.unit.clover
.Build/bin/ocular code-coverage:upload --format=php-clover coverage.integration.clover
ocular code-coverage:upload --format=php-clover coverage.unit.clover
ocular code-coverage:upload --format=php-clover coverage.integration.clover
-
name: Clean up
run: |
Expand All @@ -225,7 +200,7 @@ jobs:
steps:
-
name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
-
Expand Down
1 change: 1 addition & 0 deletions Build/Test/IntegrationTests.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
bootstrap="IntegrationTestsBootstrap.php"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
Expand Down
6 changes: 4 additions & 2 deletions Build/Test/IntegrationTestsBootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
* The TYPO3 project - inspiring people to share!
*/

call_user_func(function () {
$testbase = new \TYPO3\TestingFramework\Core\Testbase();
use TYPO3\TestingFramework\Core\Testbase;

call_user_func(static function () {
$testbase = new Testbase();
$testbase->defineOriginalRootPath();
$testbase->createDirectory(ORIGINAL_ROOT . 'typo3temp/var/tests');
$testbase->createDirectory(ORIGINAL_ROOT . 'typo3temp/var/transient');
Expand Down
1 change: 1 addition & 0 deletions Build/Test/UnitTests.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
bootstrap="UnitTestsBootstrap.php"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
Expand Down
75 changes: 20 additions & 55 deletions Build/Test/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
#!/usr/bin/env bash

if [[ -n ${BASH_SOURCE[0]} ]]; then
SCRIPTPATH=$( cd $(dirname ${BASH_SOURCE[0]}) ; pwd -P )
else
SCRIPTPATH=$( cd $(dirname $0) ; pwd -P )
fi

EXTENSION_ROOTPATH="$SCRIPTPATH/../../"
SOLR_INSTALL_PATH="/opt/solr-tomcat/"

DEFAULT_TYPO3_VERSION="^11.5.14"
DEFAULT_PHP_CS_FIXER_VERSION="^3.2.1"
DEFAULT_TYPO3_VERSION="11"
DEFAULT_TYPO3_DATABASE_HOST="localhost"
DEFAULT_TYPO3_DATABASE_NAME="test"
DEFAULT_TYPO3_DATABASE_USERNAME="root"
DEFAULT_TYPO3_DATABASE_PASSWORD="supersecret"

if [[ $* == *--use-defaults* ]]; then
export TYPO3_VERSION=$DEFAULT_TYPO3_VERSION
export PHP_CS_FIXER_VERSION=$DEFAULT_PHP_CS_FIXER_VERSION
export TYPO3_DATABASE_HOST=$DEFAULT_TYPO3_DATABASE_HOST
export TYPO3_DATABASE_NAME=$DEFAULT_TYPO3_DATABASE_NAME
export TYPO3_DATABASE_USERNAME=$DEFAULT_TYPO3_DATABASE_USERNAME
Expand All @@ -31,11 +20,6 @@ if [[ $* == *--local* ]]; then
if [ -z "$typo3Version" ]; then typo3Version=$DEFAULT_TYPO3_VERSION; fi
export TYPO3_VERSION=$typo3Version

echo -n "Choose a php-cs-fixer version [defaults: " $DEFAULT_PHP_CS_FIXER_VERSION"] : "
read phpCSFixerVersion
if [ -z "$phpCSFixerVersion" ]; then phpCSFixerVersion=$DEFAULT_PHP_CS_FIXER_VERSION; fi
export PHP_CS_FIXER_VERSION=$phpCSFixerVersion

echo -n "Choose a database hostname: [defaults: " $DEFAULT_TYPO3_DATABASE_HOST"] : "
read typo3DbHost
if [ -z "$typo3DbHost" ]; then typo3DbHost=$DEFAULT_TYPO3_DATABASE_HOST; fi
Expand All @@ -57,60 +41,41 @@ if [[ $* == *--local* ]]; then
export TYPO3_DATABASE_PASSWORD=$typo3DbPassword
fi

echo "Using TYPO3 Version: $TYPO3_VERSION"
echo "Using PHP-CS Fixer Version: $PHP_CS_FIXER_VERSION"
echo "Using database host: $TYPO3_DATABASE_HOST"
echo "Using database dbname: $TYPO3_DATABASE_NAME"
echo "Using database user: $TYPO3_DATABASE_USERNAME"
echo "Using database password: $TYPO3_DATABASE_PASSWORD"

if [ -z $TYPO3_VERSION ]; then
echo "Must set env var TYPO3_VERSION (e.g. dev-main or ^11.5)"
exit 1
fi

# Use latest TYPO3 LTS stable version, if version number is compatible with get.typo3.org API
if [[ $TYPO3_VERSION =~ ^[0-9]+$ ]] ; then
TYPO3_VERSION=$("${BASH_SOURCE%/*}/../Helpers/TYPO3_GET_LATEST_VERSION.sh" "$TYPO3_VERSION")
fi

if ! wget --version > /dev/null 2>&1
then
echo "Couldn't find wget."
exit 1
fi

COMPOSER_NO_INTERACTION=1

# Setup TYPO3 environment variables
export TYPO3_PATH_PACKAGES="${EXTENSION_ROOTPATH}.Build/vendor/"
export TYPO3_PATH_WEB="${EXTENSION_ROOTPATH}.Build/Web/"
# Use latest TYPO3 LTS stable version, if version number is compatible with get.typo3.org API
if [[ $TYPO3_VERSION =~ ^[0-9]+$ ]] ; then
TYPO3_VERSION=$("${BASH_SOURCE%/*}/../Helpers/TYPO3_GET_LATEST_VERSION.sh" "$TYPO3_VERSION")
fi

echo "Installing test environment"
echo "Using extension path $EXTENSION_ROOTPATH"
echo "Using package path $TYPO3_PATH_PACKAGES"
echo "Using web path $TYPO3_PATH_WEB"
echo "Using TYPO3 Version: $TYPO3_VERSION"
echo "Using database host: $TYPO3_DATABASE_HOST"
echo "Using database dbname: $TYPO3_DATABASE_NAME"
echo "Using database user: $TYPO3_DATABASE_USERNAME"
echo "Using database password: $TYPO3_DATABASE_PASSWORD"

# Install TYPO3 sources
if [[ $TYPO3_VERSION = *"master"* ]]; then
composer config minimum-stability dev
fi
COMPOSER_NO_INTERACTION=1

if ! composer require --dev --update-with-dependencies --prefer-source \
typo3/cms-core:"$TYPO3_VERSION" \
typo3/cms-backend:"$TYPO3_VERSION" \
typo3/cms-recordlist:"$TYPO3_VERSION" \
typo3/cms-fluid:"$TYPO3_VERSION" \
typo3/cms-fluid-styled-content:"$TYPO3_VERSION" \
typo3/cms-frontend:"$TYPO3_VERSION" \
typo3/cms-extbase:"$TYPO3_VERSION" \
typo3/cms-reports:"$TYPO3_VERSION" \
typo3/cms-scheduler:"$TYPO3_VERSION" \
typo3/cms-tstemplate:"$TYPO3_VERSION" \
typo3/cms-install:"$TYPO3_VERSION"
echo "Installing test environment"
if ! composer tests:setup
then
echo "The test environment could not be installed by composer as expected. Please fix this issue."
exit 1
fi

mkdir -p $TYPO3_PATH_WEB/uploads $TYPO3_PATH_WEB/typo3temp
echo "Install third party tools globally:"
export PATH=$PATH:$(composer config --global home)/vendor/bin
if ! composer tests:setup:global-require
then
"The test environment could not be installed by composer as expected. Please fix this issue."
exit 1
fi
Loading

0 comments on commit f46b19f

Please sign in to comment.