Configurer et relancer les tests PHPUnit via GitHub Actions #8
Workflow file for this run
This file contains hidden or 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: | |
| push: | |
| pull_request: | |
| branches: | |
| - 'master' | |
| - 'beta' | |
| - 'alpha' | |
| permissions: | |
| contents: read | |
| jobs: | |
| phpunit: | |
| name: PHP Unit | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| php-version: ['7.4', '8.2'] | |
| services: | |
| mariadb: | |
| image: mariadb:10.6 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '${{ matrix.php-version }}' | |
| extensions: json pdo_mysql curl gd imap xml opcache soap xml zip ssh2 mbstring ldap yaml snmp pcov | |
| coverage: none | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress --optimize-autoloader | |
| # Download PHPUnit | |
| - name: Download PHPUnit | |
| run: wget -O phpunit.phar https://phar.phpunit.de/phpunit-9.phar && chmod +x phpunit.phar | |
| # Setup cache directory | |
| - name: Setup cache directory | |
| run: | | |
| mkdir -p /tmp/jeedom/cache | |
| chmod 774 /tmp/jeedom | |
| chmod 774 /tmp/jeedom/cache | |
| # Initialize configuration | |
| - name: Initialize configuration | |
| run: | | |
| cp core/config/common.config.sample.php core/config/common.config.php | |
| sed -i 's/#HOST#/127.0.0.1/g' core/config/common.config.php | |
| sed -i 's/#PORT#/3306/g' core/config/common.config.php | |
| sed -i 's/#DBNAME#/jeedom/g' core/config/common.config.php | |
| sed -i 's/#USERNAME#/root/g' core/config/common.config.php | |
| sed -i 's/#PASSWORD#/root/g' core/config/common.config.php | |
| # Run Legacy test suite | |
| - name: Run legacy test suite | |
| env: | |
| DATABASE_DSN: mysql://root:root@localhost:3306/jeedom_test | |
| run: ./phpunit.phar --coverage-text --colors=never --testsuite "Legacy tests" |