mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-15 17:36:14 +01:00

[TASK] Migrate GitHub Actions to use Build/Scripts/runTests.sh

This change migrates the GitHub Action workflows to use the
`runTests.sh` wrapper. Thus making it easy reproduciable locally
and have the exact same environment and workflow which ease
debugging on pipeline failures.

Functional database matrix may be increased in a dedicated follow-up
change and is avoided for now.

Note: composer normalize check is temporarly disabled, due how runTests.sh
      are handling composer.json changes. composer.json is reverted, thus
      composer.lock not matching composer.json. Good solution for this has
      to be searched.
This commit is contained in:
Stefan Bürk 2022-10-16 02:10:20 +02:00
parent 71bc7e137d
commit d0282d488a
4 changed files with 93 additions and 123 deletions

View file

@ -16,16 +16,12 @@ jobs:
steps: steps:
- name: "Checkout" - name: "Checkout"
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: "Install PHP" - name: "Set composer token"
uses: shivammathur/setup-php@v2 run: "Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -s composer -e 'config github-oauth.github.com ${{ github.token }}'"
with:
php-version: "${{ matrix.php-version }}"
coverage: none
tools: composer:v2.4
- name: "Show the Composer configuration" - name: "Show the Composer configuration"
run: "composer config --global --list" run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s composer -e 'config --global --list'"
- name: "Run PHP lint" - name: "Run PHP lint"
run: "composer ci:php:lint" run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s composer -e 'ci:php:lint'"
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -39,16 +35,12 @@ jobs:
steps: steps:
- name: "Checkout" - name: "Checkout"
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: "Install PHP" - name: "Set composer token"
uses: shivammathur/setup-php@v2 run: "Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -s composer -e 'config github-oauth.github.com ${{ github.token }}'"
with:
php-version: "${{ matrix.php-version }}"
coverage: none
tools: composer:v2.4
- name: "Show Composer version" - name: "Show Composer version"
run: "composer --version" run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s composer -e '--version'"
- name: "Show the Composer configuration" - name: "Show the Composer configuration"
run: "composer config --global --list" run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s composer -e 'config --global --list'"
- name: "Cache dependencies installed with composer" - name: "Cache dependencies installed with composer"
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
@ -56,14 +48,18 @@ jobs:
path: ~/.cache/composer path: ~/.cache/composer
restore-keys: "php${{ matrix.php-version }}-composer-\n" restore-keys: "php${{ matrix.php-version }}-composer-\n"
- name: "Install Composer dependencies" - name: "Install Composer dependencies"
run: "composer install --no-progress" run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s composerInstall"
- name: "Run command" - name: "Run command"
run: "composer ci:${{ matrix.command }}" run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s composer -e 'ci:${{ matrix.command }}'"
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
command: command:
- "composer:normalize" # @todo disabled composer:normalize temporarly, as this does not work out due composer.json <-> lock
# discrepancy with keep json file unchanged logic of runTests.sh. Does this tests make sense for
# extension/package development as this does not have fixed composer.lock files, thus always having
# valid composer.json <-> lock if not proceeded like runTests.sh ?
# - "composer:normalize"
- "json:lint" - "json:lint"
- "php:copypaste" - "php:copypaste"
- "php:cs-fixer" - "php:cs-fixer"
@ -76,6 +72,8 @@ jobs:
code-quality-frontend: code-quality-frontend:
name: "Code quality frontend checks" name: "Code quality frontend checks"
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
env:
GITHUB_COMPOSER_TOKEN: ${{ github.token }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -104,135 +102,128 @@ jobs:
steps: steps:
- name: "Checkout" - name: "Checkout"
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: "Install PHP" - name: "Set composer token"
uses: shivammathur/setup-php@v2 run: "Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -s composer -e 'config github-oauth.github.com ${{ github.token }}'"
with:
php-version: "${{ matrix.php-version }}"
coverage: none
tools: composer:v2.4
- name: "Show Composer version" - name: "Show Composer version"
run: "composer --version" run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e '--version'"
- name: "Show the Composer configuration" - name: "Show the Composer configuration"
run: "composer config --global --list" run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e 'config --global --list'"
- name: "Cache dependencies installed with composer" - name: "Cache dependencies installed with composer"
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
key: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-${{ hashFiles('**/composer.json') }}" key: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-${{ hashFiles('**/composer.json') }}"
path: ~/.cache/composer path: ~/.cache/composer
restore-keys: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-\n" restore-keys: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-\n"
- name: "Install TYPO3 Core"
env:
TYPO3: "${{ matrix.typo3-version }}"
run: |
composer require --no-ansi --no-interaction --no-progress --no-install typo3/cms-core:"$TYPO3"
composer show
- name: "Install lowest dependencies with composer" - name: "Install lowest dependencies with composer"
if: "matrix.composer-dependencies == 'lowest'" if: "matrix.composer-dependencies == 'lowest'"
run: | run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composerInstallLowest"
composer update --no-ansi --no-interaction --no-progress --with-dependencies --prefer-lowest
composer show
- name: "Install highest dependencies with composer" - name: "Install highest dependencies with composer"
if: "matrix.composer-dependencies == 'highest'" if: "matrix.composer-dependencies == 'highest'"
run: | run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composerInstallHighest"
composer update --no-ansi --no-interaction --no-progress --with-dependencies
composer show
- name: "Run unit tests" - name: "Run unit tests"
run: "composer ci:tests:unit" run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s unit"
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- typo3-version: "^11.5" - typo3-version: "11"
php-version: "7.4" php-version: "7.4"
composer-dependencies: lowest composer-dependencies: lowest
- typo3-version: "^11.5" - typo3-version: "11"
php-version: "7.4" php-version: "7.4"
composer-dependencies: highest composer-dependencies: highest
- typo3-version: "^11.5" - typo3-version: "11"
php-version: "8.0" php-version: "8.0"
composer-dependencies: lowest composer-dependencies: lowest
- typo3-version: "^11.5" - typo3-version: "11"
php-version: "8.0" php-version: "8.0"
composer-dependencies: highest composer-dependencies: highest
- typo3-version: "^11.5" - typo3-version: "11"
php-version: "8.1" php-version: "8.1"
composer-dependencies: lowest composer-dependencies: lowest
- typo3-version: "^11.5" - typo3-version: "11"
php-version: "8.1"
composer-dependencies: highest
- typo3-version: "12"
php-version: "8.1"
composer-dependencies: lowest
- typo3-version: "12"
php-version: "8.1" php-version: "8.1"
composer-dependencies: highest composer-dependencies: highest
functional-tests: functional-tests:
name: "Functional tests" name: "Functional tests"
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: php-lint needs: php-lint
env:
DB_DATABASE: typo3
DB_USER: root
DB_PASSWORD: root
DB_HOST: localhost
steps: steps:
- name: "Checkout" - name: "Checkout"
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: "Install PHP" - name: "Set composer token"
uses: shivammathur/setup-php@v2 run: "Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -s composer -e 'config github-oauth.github.com ${{ github.token }}'"
with:
php-version: "${{ matrix.php-version }}"
tools: composer:v2.4
extensions: mysqli
coverage: none
- name: "Show Composer version" - name: "Show Composer version"
run: "composer --version" run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e '--version'"
- name: "Show the Composer configuration" - name: "Show the Composer configuration"
run: "composer config --global --list" run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e 'config --global --list'"
- name: "Cache dependencies installed with composer" - name: "Cache dependencies installed with composer"
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
key: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-${{ hashFiles('**/composer.json') }}" key: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-${{ hashFiles('**/composer.json') }}"
path: ~/.cache/composer path: ~/.cache/composer
restore-keys: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-\n" restore-keys: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-\n"
- name: "Install TYPO3 Core" - name: "Set composer token"
env: run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e 'config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}'"
TYPO3: "${{ matrix.typo3-version }}"
run: |
composer require --no-ansi --no-interaction --no-progress --no-install typo3/cms-core:"$TYPO3"
composer show
- name: "Install lowest dependencies with composer" - name: "Install lowest dependencies with composer"
if: "matrix.composer-dependencies == 'lowest'" if: "matrix.composer-dependencies == 'lowest'"
run: | run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composerInstallLowest"
composer update --no-ansi --no-interaction --no-progress --with-dependencies --prefer-lowest
composer show
- name: "Install highest dependencies with composer" - name: "Install highest dependencies with composer"
if: "matrix.composer-dependencies == 'highest'" if: "matrix.composer-dependencies == 'highest'"
run: | run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composerInstallHighest"
composer update --no-ansi --no-interaction --no-progress --with-dependencies - name: "Run functional tests (sqlite)"
composer show run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d sqlite"
- name: "Start MySQL" - name: "Run functional tests (MySQL 5.5 mysqli)"
run: "sudo /etc/init.d/mysql start" if: "matrix.typo3-version == '11'"
- name: "Run functional tests" run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mysql -a mysqli -j 5.5"
run: | # TYPO3v12 has min requirement MySQL 8.0, so use this for minimum test compared to TYPO3v11 testing (MySQL 5.5) with mysqli
export typo3DatabaseName="$DB_DATABASE"; - name: "Run functional tests (MySQL 8.0 mysqli)"
export typo3DatabaseHost="$DB_HOST"; if: "matrix.typo3-version == '12'"
export typo3DatabaseUsername="$DB_USER"; run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mysql -a mysqli -j 5.5"
export typo3DatabasePassword="$DB_PASSWORD"; - name: "Run functional tests (MySQL 8.0 pdo_mysql)"
composer ci:tests:functional run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mysql -a pdo_mysql -j 8.0"
- name: "Run functional tests (MariaDB 10.2 mysqli)"
if: "matrix.typo3-version == '11'"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mariadb -a mysqli -i 10.2"
# TYPO3v12 has min requirement MariaDB 10.3, so use this for minimum test compared to TYPO3v11 testing (MariaDB 10.2)
- name: "Run functional tests (MariaDB 10.3 mysqli)"
if: "matrix.typo3-version == '12'"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mariadb -a mysqli -i 10.3"
- name: "Run functional tests (MariaDB 10.7 pdo_mysql)"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mariadb -a pdo_mysql -i 10.7"
- name: "Run functional tests (PostgresSQL 10)"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d postgres -k 10"
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- typo3-version: "^11.5" - typo3-version: "11"
php-version: "7.4" php-version: "7.4"
composer-dependencies: lowest composer-dependencies: lowest
- typo3-version: "^11.5" - typo3-version: "11"
php-version: "7.4" php-version: "7.4"
composer-dependencies: highest composer-dependencies: highest
- typo3-version: "^11.5" - typo3-version: "11"
php-version: "8.0" php-version: "8.0"
composer-dependencies: lowest composer-dependencies: lowest
- typo3-version: "^11.5" - typo3-version: "11"
php-version: "8.0" php-version: "8.0"
composer-dependencies: highest composer-dependencies: highest
- typo3-version: "^11.5" - typo3-version: "11"
php-version: "8.1" php-version: "8.1"
composer-dependencies: lowest composer-dependencies: lowest
- typo3-version: "^11.5" - typo3-version: "11"
php-version: "8.1"
composer-dependencies: highest
- typo3-version: "12"
php-version: "8.1"
composer-dependencies: lowest
- typo3-version: "12"
php-version: "8.1" php-version: "8.1"
composer-dependencies: highest composer-dependencies: highest

View file

@ -10,11 +10,6 @@ jobs:
code-coverage: code-coverage:
name: "Calculate code coverage" name: "Calculate code coverage"
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
env:
DB_DATABASE: typo3
DB_USER: root
DB_PASSWORD: root
DB_HOST: localhost
steps: steps:
- name: "Checkout" - name: "Checkout"
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -25,43 +20,32 @@ jobs:
tools: composer:v2.4 tools: composer:v2.4
extensions: xdebug, mysqli extensions: xdebug, mysqli
coverage: xdebug coverage: xdebug
- name: "Set composer token"
run: "Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -s composer -e 'config github-oauth.github.com ${{ github.token }}'"
- name: "Show Composer version" - name: "Show Composer version"
run: composer --version run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e '--version'"
- name: "Show the Composer configuration"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e 'config --global --list'"
- name: "Cache dependencies installed with composer" - name: "Cache dependencies installed with composer"
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
key: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-${{ hashFiles('**/composer.json') }}" key: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-${{ hashFiles('**/composer.json') }}"
path: ~/.cache/composer path: ~/.cache/composer
restore-keys: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-\n" restore-keys: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-\n"
- name: "Install TYPO3 Core"
env:
TYPO3: "${{ matrix.typo3-version }}"
run: |
composer require --no-ansi --no-interaction --no-progress --no-install typo3/cms-core:"$TYPO3"
composer show
- name: "Install lowest dependencies with composer" - name: "Install lowest dependencies with composer"
if: "matrix.composer-dependencies == 'lowest'" if: "matrix.composer-dependencies == 'lowest'"
run: | run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composerInstallLowest"
composer update --no-ansi --no-interaction --no-progress --with-dependencies --prefer-lowest
composer show
- name: "Install highest dependencies with composer" - name: "Install highest dependencies with composer"
if: "matrix.composer-dependencies == 'highest'" if: "matrix.composer-dependencies == 'highest'"
run: | run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composerInstallHighest"
composer update --no-ansi --no-interaction --no-progress --with-dependencies - name: "Create coverage directory structure"
composer show run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e 'coverage:create-directories'"
- name: "Start MySQL"
run: "sudo /etc/init.d/mysql start"
- name: "Run unit tests with coverage" - name: "Run unit tests with coverage"
run: composer ci:coverage:unit run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s unit -x -z 'coverage' -e '--whitelist Classes --coverage-php=.Build/coverage/unit.cov'"
- name: "Run functional tests with coverage" - name: "Run functional tests with coverage"
run: | run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mysql -a mysqli -j 8.0 -x -z 'coverage' -e '--whitelist Classes --coverage-php=.Build/coverage/functional.cov'"
export typo3DatabaseName="$DB_DATABASE";
export typo3DatabaseHost="$DB_HOST";
export typo3DatabaseUsername="$DB_USER";
export typo3DatabasePassword="$DB_PASSWORD";
composer ci:coverage:functional
- name: "Merge coverage results" - name: "Merge coverage results"
run: composer ci:coverage:merge run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e 'ci:coverage:merge'"
- name: "Upload coverage results to Coveralls" - name: "Upload coverage results to Coveralls"
env: env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -70,6 +54,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- typo3-version: "^11.5" - typo3-version: "11"
php-version: "7.4" php-version: "7.4"
composer-dependencies: highest composer-dependencies: highest

View file

@ -34,12 +34,6 @@ setUpDockerComposeDotEnv() {
echo "MYSQL_VERSION=${MYSQL_VERSION}" echo "MYSQL_VERSION=${MYSQL_VERSION}"
echo "POSTGRES_VERSION=${POSTGRES_VERSION}" echo "POSTGRES_VERSION=${POSTGRES_VERSION}"
echo "USED_XDEBUG_MODES=${USED_XDEBUG_MODES}" echo "USED_XDEBUG_MODES=${USED_XDEBUG_MODES}"
# needed for coveralls upload
echo "COVERALLS_REPO_TOKEN='${COVERALLS_REPO_TOKEN}'"
echo "GITHUB_REF='${GITHUB_REF}'"
echo "GITHUB_ACTIONS='${GITHUB_ACTIONS}'"
echo "GITHUB_RUN_ID='${GITHUB_RUN_ID}'"
echo "GITHUB_EVENT_NAME='${GITHUB_EVENT_NAME}'"
} > .env } > .env
} }

View file

@ -367,7 +367,8 @@ services:
set -x set -x
fi fi
php -v | grep '^PHP'; php -v | grep '^PHP';
php -dxdebug.mode=off .Build/vendor/bin/php-coveralls --coverage_clover=./.Build/logs/clover.xml --json_path=./.Build/logs/coveralls-upload.json -v XDEBUG_MODE=\"coverage\" \
php -dxdebug.mode=off ./.Build/vendor/bin/php-coveralls --coverage_clover=./.Build/logs/clover.xml --json_path=./.Build/logs/coveralls-upload.json -v
" "
phpstan: phpstan: