From 0473bf3523c49921d6e39ec67be3e59ad96fb93a Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Tue, 19 May 2026 11:43:25 +0200 Subject: [PATCH] ci: modernize ci --- .github/workflows/continuous-integration.yml | 35 +++++ .github/workflows/tests.yml | 138 ------------------- 2 files changed, 35 insertions(+), 138 deletions(-) create mode 100644 .github/workflows/continuous-integration.yml delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 000000000..ee586ba0c --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,35 @@ +name: "Continuous integration" + +on: + push: + branches: + - "main" + - "develop" + - "support/*" + tags: + - "*" + pull_request: + workflow_dispatch: + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +jobs: + generate-ci-matrix: + name: "Generate CI matrix" + uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1" + with: + glpi-version: "10.0.x" + ci: + name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}" + needs: "generate-ci-matrix" + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.generate-ci-matrix.outputs.matrix) }} + uses: "glpi-project/plugin-ci-workflows/.github/workflows/continuous-integration.yml@v1" + with: + plugin-key: "formcreator" + glpi-version: "${{ matrix.glpi-version }}" + php-version: "${{ matrix.php-version }}" + db-image: "${{ matrix.db-image }}" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 2ab8944c1..000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,138 +0,0 @@ -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