Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/phpunit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 1
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

# 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: vendor/bin/phpunit --coverage-text --colors=never --testsuite "Legacy tests"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ tmp/*
.env
.phpstan.cache
phpstan.phar

.phpunit.result.cache
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
"platform": {
"php": "7.4"
}
},
"require-dev": {
"phpunit/phpunit": "^9.6"
}
}
Loading