ci: Add runTests.sh #1845
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
pull_request: | |
branches: | |
- "**" | |
push: | |
branches: | |
- "main" | |
jobs: | |
Unit: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
typo3: | |
- '^12.4' | |
php: | |
- '8.1' | |
- '8.2' | |
- '8.3' | |
mysql: | |
- '8.0' | |
steps: | |
- name: Set up MySQL ${{ matrix.mysql }} | |
uses: mirromutth/[email protected] | |
with: | |
mysql version: ${{ matrix.mysql }} | |
mysql root password: 'root' | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up PHP Version ${{ matrix.php }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer:v2 | |
- name: Environment Check | |
run: | | |
php --version | |
composer --version | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Install dependencies with typo3/cms-core:${{ matrix.typo3 }} | |
if: matrix.typo3 != 'dev-main' | |
run: | | |
composer require typo3/cms-core:${{ matrix.typo3 }} --no-progress | |
git checkout composer.json | |
ln -nfs .Build/vendor/typo3/cms/typo3 typo3 | |
- name: Lint PHP | |
run: find . -name \*.php ! -path "./.Build/*" ! -path "./scripts/*" ! -path "./typo3_src/*" ! -path "./Resources/*" | parallel --gnu php -d display_errors=stderr -l {} > /dev/null \; | |
- name: Unit Tests | |
if: matrix.typo3 != 'dev-main' | |
run: | | |
export "UNIT_XML"=Tests/UnitTests.xml | |
.Build/bin/phpunit --coverage-filter Classes --coverage-clover=unittest-coverage.clover --colors -c $UNIT_XML Tests/Unit | |
- name: Functional Tests | |
run: | | |
export "FUNCTIONAL_XML"=Tests/FunctionalTests.xml | |
.Build/bin/phpunit --coverage-filter Classes --coverage-clover=functional-coverage.clover --colors -c $FUNCTIONAL_XML Tests/Functional --process-isolation | |
if: matrix.typo3 != 'dev-main' | |
env: | |
typo3DatabaseHost: 127.0.0.1 | |
typo3DatabaseName: typo3 | |
typo3DatabasePassword: root | |
typo3DatabaseUsername: root | |
- name: Tests for dev-main | |
run: | | |
export "FUNCTIONAL_XML"=Tests/FunctionalTests.xml | |
export "UNIT_XML"=Tests/UnitTests.xml | |
composer remove --dev ssch/typo3-rector | |
rm -rf composer.lock .Build | |
composer require typo3/cms-core:dev-main | |
ln -nfs .Build/vendor/typo3/cms/typo3 typo3 | |
.Build/bin/phpunit --colors -c $UNIT_XML Tests/Unit | |
.Build/bin/phpunit --colors -c $FUNCTIONAL_XML Tests/Functional --process-isolation | |
if: matrix.typo3 == 'dev-main' && matrix.php == '8.1' | |
env: | |
typo3DatabaseHost: 127.0.0.1 | |
typo3DatabaseName: typo3 | |
typo3DatabasePassword: root | |
typo3DatabaseUsername: root | |
- name: Set up PHP Version 7.4 for Scrutinizer Upload | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 7.4 | |
tools: composer:v2 | |
- name: Upload coverage results to Scrutinizer | |
if: matrix.typo3 == '^12.4' && matrix.php == '8.1' | |
run: | | |
wget https://scrutinizer-ci.com/ocular.phar | |
php ocular.phar code-coverage:upload --format=php-clover unittest-coverage.clover | |
php ocular.phar code-coverage:upload --format=php-clover functional-coverage.clover |