|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - 'master' |
| 8 | + - 'develop' |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + phpunit: |
| 15 | + name: PHP Unit |
| 16 | + runs-on: ubuntu-latest |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + php-version: ['7.4', '8.2'] |
| 20 | + services: |
| 21 | + mariadb: |
| 22 | + image: mariadb:10.6 |
| 23 | + env: |
| 24 | + MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 1 |
| 25 | + ports: |
| 26 | + - 3306:3306 |
| 27 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + - name: Setup PHP |
| 31 | + uses: shivammathur/setup-php@v2 |
| 32 | + with: |
| 33 | + php-version: '${{ matrix.php-version }}' |
| 34 | + extensions: json pdo_mysql curl gd imap xml opcache soap xml zip ssh2 mbstring ldap yaml snmp pcov |
| 35 | + coverage: none |
| 36 | + |
| 37 | + - name: Install dependencies |
| 38 | + run: composer install --prefer-dist --no-progress --optimize-autoloader |
| 39 | + |
| 40 | + # Setup cache directory |
| 41 | + - name: Setup cache directory |
| 42 | + run: | |
| 43 | + mkdir -p /tmp/jeedom/cache |
| 44 | + chmod 774 /tmp/jeedom |
| 45 | + chmod 774 /tmp/jeedom/cache |
| 46 | +
|
| 47 | + # Initialize configuration |
| 48 | + - name: Initialize configuration |
| 49 | + run: | |
| 50 | + cp core/config/common.config.sample.php core/config/common.config.php |
| 51 | + sed -i 's/#HOST#/127.0.0.1/g' core/config/common.config.php |
| 52 | + sed -i 's/#PORT#/3306/g' core/config/common.config.php |
| 53 | + sed -i 's/#DBNAME#/jeedom/g' core/config/common.config.php |
| 54 | + sed -i 's/#USERNAME#/root/g' core/config/common.config.php |
| 55 | + sed -i 's/#PASSWORD#/root/g' core/config/common.config.php |
| 56 | +
|
| 57 | + # Run Legacy test suite |
| 58 | + - name: Run legacy test suite |
| 59 | + env: |
| 60 | + DATABASE_DSN: mysql://root:root@localhost:3306/jeedom_test |
| 61 | + run: vendor/bin/phpunit --coverage-text --colors=never --testsuite "Legacy tests" |
0 commit comments