fix: handle negative due date for service levels #4460
This file contains 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: 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 |