forked from pluginsGLPI/formcreator
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (133 loc) · 4.63 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: unit tests
on:
[push, pull_request]
env:
GLPI_SOURCE: "https://github.com/glpi-project/glpi"
GLPI_PACKAGE_URL_BASE: "https://nightly.glpi-project.org/glpi"
CS: 7.4
DB_HOST: 127.0.0.1
MYSQL_ROOT_USER: root
DB_USER: glpi
DB_PASSWD: glpi
DB_NAME: glpitest
OLD_DB_NAME: glpiupgradetest
PLUGINNAME: formcreator
PLUGIN_FIELDS_REF: 1.17.3
PLUGIIN_TAG_REF: 2.9.2
AFTER_SUCCESS_BRANCH: master
ATOUM_ARG: --force-terminal --use-dot-report
NOCOVERAGE: -ncc
COVERAGE: --nccfc CommonTreeDropdown CommonDropdown CommonDBTM CommonGLPI CommonDBConnexity CommonDBRelation CommonDBChild
CHROME_DRIVER_BINARY: chromedriver
SKIP_INIT: false
SKIP_FRESH_GLPI_INSTALL: false
SKIP_UPGRADE_GLPI_INSTALL: false
SKIP_INSTALL_PLUGIN_DEPENDENCIES: false
SKIP_UPGRADE_TESTS: false
SKIP_INSTALL_TESTS: false
SKIP_TESTS: false
SKIP_FUNCTIONAL_TESTS: true
SKIP_UNINSTALL_TESTS: false
SKIP_LINT_TESTS: false
SKIP_CS_TESTS: false
SKIP_PANTHER_INSTALL: true
jobs:
tests:
name: "Tests"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-versions: [7.4, 8.1, 8.2]
glpi-branch: [10.0/bugfixes]
glpi-package: [10.0.tar.gz]
services:
db:
image: mariadb:10.3
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
# Set health checks to wait until mysql database has started (it takes some seconds to start)
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Setup PHP with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: curl, fileinfo, gd, json, mbstring, mysqli, zlib, simplexml, xml, intl, bz2
coverage: xdebug
- name: "install packages"
run: |
sudo apt update
sudo apt install gettext
- name: "get browser"
run: |
sudo apt install chromium-browser chromium-chromedriver
- name: "Check tools"
run: |
which php
which mysql
which composer
php --version
mysql --version
composer --version
chromium-browser --version
ls -l /usr/bin/chromium*
$CHROME_DRIVER_BINARY --version
- name: "Checkout"
uses: actions/checkout@v3
- name: "Run tests"
run: |
GLPI_BRANCH=${{ matrix.glpi-branch }}
GLPI_PACKAGE=${{ matrix.glpi-package }}
GLPI_USE_REPO=${{ matrix.glpi-use-repo }}
sudo apt install patchutils -y
. ./tests/script-functions.sh
. ./tests/script-specific-functions.sh
$SKIP_INIT || init_databases
$SKIP_INIT || install_glpi
$SKIP_INIT || init_plugin
$SKIP_INIT || install_plugin_dependencies
export TEST_GLPI_CONFIG_DIR="tests/config-$OLD_DB_NAME"
$SKIP_UPGRADE_GLPI_INSTALL || init_glpi $OLD_DB_NAME $DB_USER $DB_PASSWD
$SKIP_UPGRADE_GLPI_INSTALL || init_plugins
echo status of plugins
mysql -h$DB_HOST -u$DB_USER -p$DB_PASSWD $OLD_DB_NAME -e "select name,directory,version,state from glpi_plugins WHERE directory IN ('formcreator')"
$SKIP_UPGRADE_TESTS || plugin_test_upgrade
export TEST_GLPI_CONFIG_DIR="tests/config-$DB_NAME"
$SKIP_FRESH_GLPI_INSTALL || init_glpi $DB_NAME $DB_USER $DB_PASSWD
$SKIP_FRESH_GLPI_INSTALL || init_plugins
$SKIP_INSTALL_TESTS || plugin_test_install
mysql -h$DB_HOST -u$DB_USER -p$DB_PASSWD $OLD_DB_NAME -e "select name,directory,version,state from glpi_plugins WHERE directory IN ('formcreator')"
$SKIP_TESTS || plugin_test
$SKIP_FUNCTIONAL_TESTS || plugin_test_functional
$SKIP_UNINSTALL_TESTS || plugin_test_uninstall
style:
strategy:
matrix:
php-versions: [8.1]
env:
- { GLPI_BRANCH: 10.0/bugfixes }
name: "Code quality"
runs-on: "ubuntu-latest"
steps:
- name: Setup PHP with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: xdebug
- name: "Checkout"
uses: actions/checkout@v3
- name: "Code quality tests"
run: |
. ./tests/script-functions.sh
. ./tests/script-specific-functions.sh
composer config --unset platform
rm composer.lock
composer install --no-interaction --no-progress
$SKIP_LINT_TESTS || plugin_test_lint
$SKIP_CS_TESTS || plugin_test_cs