|
cache: |
|
key: "$CI_COMMIT_REF_NAME/$CI_JOB_STAGE" |
|
paths: |
|
- .composer/ |
|
|
|
before_script: |
|
# Install git on machine |
|
- apk add git --update |
|
|
|
stages: |
|
- test |
|
- mirror |
|
- upload |
|
|
|
.test: &testing |
|
stage: test |
|
image: php:$DOCKER_TAG |
|
only: |
|
- branches |
|
before_script: |
|
# Where to locate the DocRoot (needed for Unit Tests) |
|
- export TYPO3_PATH_WEB="$PWD/.Build/Web" |
|
- export COMPOSER_CACHE_DIR=.composer |
|
# Install composer |
|
- curl -OLs https://composer.github.io/installer.sig |
|
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" |
|
- php -r "if (hash_file('SHA384', 'composer-setup.php') === trim(file_get_contents('installer.sig'))) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" |
|
- php composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer |
|
- php -r "unlink('composer-setup.php'); unlink('installer.sig');" |
|
# Get the given TYPO3 core |
|
- composer require typo3/cms="${TYPO3_VERSION}" --update-with-dependencies |
|
# Get the TYPO3 testing framework (thx to Nicole and Helmut for that) |
|
- composer require nimut/testing-framework |
|
# Get the latest PHP_CodeSniffer |
|
- composer require squizlabs/php_codesniffer |
|
script: |
|
# Run Unit Tests |
|
- .Build/bin/phpunit -c Configuration/.Build/Tests/UnitTests.xml |
|
# Run PHP_CodeSniffer (warning_severity is needed due usage of hooks which are not psr2 compliant) |
|
- .Build/bin/phpcs --standard=PSR2 --config-set warning_severity 8 Classes Configuration/TCA Tests/Unit |
|
|
|
# Tests in PHP 5.6 and TYPO3 6.2 |
|
test:php56:typo3_62: |
|
<<: *testing |
|
variables: |
|
DOCKER_TAG: 5.6-alpine |
|
TYPO3_VERSION: ^6.2 |
|
|
|
# Build in PHP 5.6 and TYPO3 7.6 |
|
test:php56:typo3_7: |
|
<<: *testing |
|
variables: |
|
DOCKER_TAG: 5.6-alpine |
|
TYPO3_VERSION: ^7.6 |
|
|
|
# Build in PHP 7.0 and TYPO3 7.6 |
|
test:php70:typo3_7: |
|
<<: *testing |
|
variables: |
|
DOCKER_TAG: 7.0-alpine |
|
TYPO3_VERSION: ^7.6 |
|
|
|
# Build in PHP 7.1 and TYPO3 7.6 |
|
test:php71:typo3_7: |
|
<<: *testing |
|
variables: |
|
DOCKER_TAG: 7.1-alpine |
|
TYPO3_VERSION: ^7.6 |
|
|
|
# Build in PHP 7.0 and TYPO3 8 (latest stable release) |
|
test:php70:typo3_8: |
|
<<: *testing |
|
variables: |
|
DOCKER_TAG: 7.0-alpine |
|
TYPO3_VERSION: ^8 |
|
|
|
# Build in PHP 7.1 and TYPO3 8 (latest stable release) |
|
test:php71:typo3_8: |
|
<<: *testing |
|
variables: |
|
DOCKER_TAG: 7.1-alpine |
|
TYPO3_VERSION: ^8 |
|
|
|
# Build in PHP 7.0 and TYPO3 (current master) |
|
test:php70:typo3_master: |
|
<<: *testing |
|
variables: |
|
DOCKER_TAG: 7.0-alpine |
|
TYPO3_VERSION: dev-master |
|
|
|
# Build in PHP 7.1 and TYPO3 (current master) |
|
test:php71:typo3_master: |
|
<<: *testing |
|
variables: |
|
DOCKER_TAG: 7.1-alpine |
|
TYPO3_VERSION: dev-master |
|
|
|
mirror-to-github: |
|
stage: mirror |
|
image: indiehosters/git |
|
only: |
|
- master |
|
script: |
|
- git remote add github https://$GITHUB_USERNAME:$GITHUB_TOKEN@github.com/$GITHUB_USERNAME/$GITHUB_REMOTE_REPO_NAME.git |
|
- git push github master |
|
- git push github master --tags |
|
|
|
# TER Upload when tagging in master branch |
|
# The variables T3O_USERNAME and T3O_PASSWORD should be set in GitLab |
|
ter-upload: |
|
image: php:7-alpine |
|
stage: upload |
|
only: |
|
- tags |
|
before_script: |
|
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer |
|
- export COMPOSER_CACHE_DIR=.composer |
|
script: |
|
- composer install |
|
# Get the package for uploading to TER (thx to Claus) |
|
- composer require namelesscoder/typo3-repository-client |
|
- export TYPO3_PATH_WEB="$PWD/.Build/Web" |
|
# Upload to TER if a Git tag was set (and username/password is set in the global variables) |
|
- > |
|
if [ -n "$CI_COMMIT_TAG" ] && [ -n "$T3O_USERNAME" ] && [ -n "$T3O_PASSWORD" ]; then |
|
echo -e "Preparing upload of release ${CI_COMMIT_TAG} to TER\n" |
|
# Cleanup before we upload |
|
git reset --hard HEAD && git clean -fx |
|
# Upload |
|
TAG_MESSAGE=`git tag -n10 -l $CI_COMMIT_TAG | sed 's/^[0-9.]*[ ]*//g'` |
|
echo "Uploading release ${CI_COMMIT_TAG} to TER" |
|
.Build/bin/upload . "$T3O_USERNAME" "$T3O_PASSWORD" "$TAG_MESSAGE" |
|
fi; |
One Idea:
Use a cache key for all tests to share the composer cache across all dependent jobs
e.g.:
Use variables instead of script/export because they are merged from global to job e.g.: