Skip to content

Commit b92a896

Browse files
committed
Configurer et relancer les tests PHPUnit via GitHub Actions
1 parent bebd97a commit b92a896

15 files changed

Lines changed: 2701 additions & 579 deletions

.github/workflows/phpunit.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,5 @@ tmp/*
4747
.env
4848
.phpstan.cache
4949
phpstan.phar
50+
51+
.phpunit.result.cache

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
}
1919
},
2020
"require-dev": {
21-
"phpstan/phpstan": "^2.1"
21+
"phpstan/phpstan": "^2.1",
22+
"phpunit/phpunit": "^9.6"
2223
}
2324
}

0 commit comments

Comments
 (0)