Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI config #110

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: "Continuous integration"

on:
push:
branches:
- "master"
- "develop"
tags:
- "*"
pull_request:
workflow_dispatch:

jobs:
lint:
name: "Lint"
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
include:
- {php-version: "7.4"}
- {php-version: "8.0"}
- {php-version: "8.1"}
- {php-version: "8.2"}
- {php-version: "8.3-rc"}
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "none"
tools: "composer, cs2pr"
- name: "Install Composer dependencies"
run: |
composer install --ansi --no-interaction --no-progress --prefer-dist
- name: "PHP Parallel Lint"
run: |
vendor/bin/parallel-lint --colors --checkstyle --exclude ./vendor/ . | cs2pr
- name: "PHP_CodeSniffer"
run: |
vendor/bin/phpcs -q --report=checkstyle | cs2pr
- name: "Check for missing/outdated headers"
run: |
vendor/bin/licence-headers-check --ansi --no-interaction
- name: Checkout GLPI
uses: actions/checkout@v4
with:
repository: glpi-project/glpi
path: glpi
fetch-depth: 1
ref: 10.0/bugfixes
- name: Install xmllint
run: sudo apt-get install -y gettext
- name: "Build dependencies / translations"
run: cd glpi && php bin/console dependencies install && php bin/console locales:compile
- name: Copy plugin
run: rsync -avr --exclude='glpi' ./* glpi/plugins/fields/
- name: PHPStan checks
run: cd glpi/plugins/fields && php vendor/bin/phpstan analyze --ansi --memory-limit=1G --no-interaction --no-progress
17 changes: 17 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<ruleset>
<file>.</file>
<exclude-pattern>/.git/</exclude-pattern>
<exclude-pattern type="relative">^vendor/</exclude-pattern>

<arg name="colors" />
<arg name="extensions" value="php" />
<arg value="p" />
<arg name="warning-severity" value="0" />

<rule ref="PSR12">
<exclude name="Generic.Files.LineLength" />
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
</rule>
<rule ref="Generic.Arrays.ArrayIndent"></rule>
</ruleset>
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"php": ">=7.4"
},
"require-dev": {
"glpi-project/tools": "^0.6"
"glpi-project/tools": "^0.7.1",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpstan/phpstan": "^1.10",
"squizlabs/php_codesniffer": "^3.7"
},
"config": {
"optimize-autoloader": true,
Expand Down
196 changes: 188 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 20 additions & 15 deletions front/config.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* -------------------------------------------------------------------------
*/

include ('../../../inc/includes.php');
include('../../../inc/includes.php');
require_once('../inc/config.class.php');


Expand All @@ -38,25 +38,30 @@
$PluginSccmConfig = new PluginSccmConfig();

if (isset($_POST["update"])) {
if (array_key_exists('sccmdb_password', $_POST)) {
// Password must not be altered.
$_POST['sccmdb_password'] = $_UPOST['sccmdb_password'];
}
if (array_key_exists('sccmdb_password', $_POST)) {
// Password must not be altered.
$_POST['sccmdb_password'] = $_UPOST['sccmdb_password'];
}

$PluginSccmConfig->update($_POST);
$PluginSccmConfig->update($_POST);

$sccmDB = new PluginSccmSccmdb();
if ($sccmDB->connect()) {
Session::addMessageAfterRedirect("Connexion réussie !.", false, INFO, false);
} else {
Session::addMessageAfterRedirect("Connexion incorrecte.", false, ERROR, false);
}
if ($sccmDB->connect()) {
Session::addMessageAfterRedirect("Connexion réussie !.", false, INFO, false);
} else {
Session::addMessageAfterRedirect("Connexion incorrecte.", false, ERROR, false);
}


Html::back();
Html::back();
}

Html::header(__("Setup - SCCM", "sccm"), $_SERVER["PHP_SELF"],
"plugins", "sccm", "configuration");
Html::header(
__("Setup - SCCM", "sccm"),
$_SERVER["PHP_SELF"],
"plugins",
"sccm",
"configuration"
);
$PluginSccmConfig->showConfigForm($PluginSccmConfig);
Html::footer();
Html::footer();
Loading