This workflow will execute the following actions as long as they are available on the plugin repository. If the vendor package is not installed within the plugin repository, the CI workflow will attempt to use the vendor binaries provided by GLPI directly.
Action | Vendor package | Required config file |
---|---|---|
PHP Parallel Lint | php-parallel-lint/php-parallel-lint | |
PHP CodeSniffer | squizlabs/php_codesniffer | .phpcs.xml |
PHP-CS-Fixer | friendsofphp/php-cs-fixer | .php-cs-fixer.php |
PHPStan | phpstan/phpstan | phpstan.neon |
Psalm | vimeo/psalm | psalm.xml |
Rector | rector/rector | rector.php |
ESLint | eslint | eslint.config.js or eslint.config.mjs or eslint.config.cjs or .eslintrc.js |
Stylelint | stylelint | .stylelintrc.js |
Licence headers check | glpi-project/tools | tools/HEADER |
PHPUnit | phpunit/phpunit | phpunit.xml |
Jest | jest | jest.config.js |
TwigCS | friendsoftwig/twigcs | .twig_cs.dist.php |
During the PHPUnit
tests execution, GLPI will be accessible over HTTP (http://localhost/
).
name: "Continuous integration"
on:
pull_request:
jobs:
ci:
uses: "glpi-project/plugin-ci-workflows/.github/workflows/continuous-integration.yml@v1"
with:
# The plugin key (system name).
plugin-key: "myplugin"
# The version of GLPI on which to run the tests.
glpi-version: "10.0.x"
# The version of PHP on which to run the tests.
php-version: "8.1"
# The database docker image on which to run the tests.
db-image: "mariadb:11.4"
# Optional initialization script that can be used, for instance, to install additional system dependencies.
init-script: "./.github/workflows/init-script.sh"
The available glpi-version
/php-version
combinations corresponds to the ghcr.io/glpi-project/githubactions-glpi-apache
images tags
that can be found here.
The db-image
parameter is a combination of the DB server engine (mysql
, mariadb
or percona
) and the server version.
- MariaDB available versions are listed here
- MySQL available versions are listed here.
- Percona available versions are listed here.
An optional init-script
parameter can be used to define the path of an initialization script. This script will be executed with bash
.
It can be used, for instance, to install a specific PHP extension.
This workflow can be used to generate a matrix that contains the default PHP/SQL versions that are supported by the target GLPI version.
You can use it in combination with the Continuous Integration
workflow, as shown in the example below.
name: "Continuous integration"
on:
push:
branches:
- "main"
tags:
- "*"
pull_request:
schedule:
- cron: "0 0 * * *"
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"
# Whether the complete compatibility matrix should be generated.
# Default: false
complete-matrix: true
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: "myplugin"
glpi-version: "${{ matrix.glpi-version }}"
php-version: "${{ matrix.php-version }}"
db-image: "${{ matrix.db-image }}"