Skip to content

Commit

Permalink
ci(): allow failures for GLPI 9.4 for now
Browse files Browse the repository at this point in the history
updated github labels and robo script

Signed-off-by: btry <tbugier@teclib.com>
  • Loading branch information
btry committed Jul 18, 2018
1 parent 001a82f commit fac8dfe
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 15 deletions.
20 changes: 18 additions & 2 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repository:
name: formcreator
description: GLPI Plugin Formcreator
homepage: https://plugisglpi.github.io/formcreator/
homepage: https://pluginsglpi.github.io/formcreator/
topics: service-catalog, ticket, helpdesk, incident-management, servicedesk, itil, php, open-source, gplv3
private: false
has_issues: true
Expand All @@ -12,12 +12,20 @@ repository:
allow_merge_commit: false
allow_rebase_merge: true
labels:
- name: api
color: 0052cc
- name: bug
color: f44336
- name: build
color: 795548
- name: cherry-pick
color: af1c46
- name: ci
color: fbca04
- name: cleanup
color: c2e0c6
- name: cli
color: 444444
- name: documentation
color: 607d8b
- name: duplicate
Expand All @@ -26,8 +34,14 @@ labels:
color: 3f51b5
- name: hacktoberfest
color: ff625f
- name: install
color: ffa31a
- name: invalid
color: cddc39
- name: locales
color: d4c5f9
- name: notification
color: cc6699
- name: performance
color: 009688
- name: question
Expand All @@ -38,9 +52,11 @@ labels:
color: 2196f3
- name: test
color: 8bc34a
- name: ui
color: bfdadc
- name: wontfix
color: ffffff
- name: help wanted
color: 33aa3f
- name: good first issue
color: 7057ff
color: 7057ff
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ language: php

env:
global:
- GLPI_SOURCE="https://github.com/glpi-project/glpi -b 9.2/bugfixes"
- GLPI_SOURCE="https://github.com/glpi-project/glpi"
- PHPUNIT_ARGS="--verbose --debug"
- CS=7.2
matrix:
- GLPI_BRANCH=9.2.1
- GLPI_BRANCH=9.2/bugfixes
- GLPI_BRANCH=9.3/bugfixes
- GLPI_BRANCH=master
php:

php:
- 5.6
- 7.0
- 7.1
Expand All @@ -19,6 +20,7 @@ php:

allow_failures:
- php: nightly
- env: GLPI_BRANCH=master

before_script:
- mysql -u root -e 'create database glpitest;'
Expand Down
29 changes: 26 additions & 3 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ protected function getPluginName() {
protected function getVersion() {
$setupFile = $this->getProjectPath(). "/setup.php";
$setupContent = file_get_contents($setupFile);
$pluginName = $this->getPluginName();
$constantName = "PLUGIN_" . strtoupper($this->getPluginName()) . "_VERSION";
$pattern = "#^define\('$constantName', '([^']*)'\);$#m";
preg_match($pattern, $setupContent, $matches);
Expand All @@ -79,10 +78,21 @@ protected function getVersion() {
throw new Exception("Could not determine version of the plugin");
}

protected function getIsRelease() {
$currentRev = $this->getCurrentCommitHash();
$setupContent = $this->getFileFromGit('setup.php', $currentRev);
$constantName = "PLUGIN_" . strtoupper($this->getPluginName()) . "_IS_OFFICIAL_RELEASE";
$pattern = "#^define\('$constantName', ([^\)]*)\);$#m";
preg_match($pattern, $setupContent, $matches);
if (isset($matches[1])) {
return $matches[1];
}
throw new Exception("Could not determine release status of the plugin");
}

protected function getGLPIMinVersion() {
$setupFile = $this->getProjectPath(). "/setup.php";
$setupContent = file_get_contents($setupFile);
$pluginName = $this->getPluginName();
$constantName = "PLUGIN_" . strtoupper($this->getPluginName()) . "_GLPI_MIN_VERSION";
$pattern = "#^define\('$constantName', '([^']*)'\);$#m";
preg_match($pattern, $setupContent, $matches);
Expand All @@ -102,9 +112,22 @@ protected function getBannedFiles() {
}

//Own plugin's robo stuff
public function archiveBuild() {

/**
* Build an redistribuable archive
*
* @param string $release 'release' if the archive is a release
*/
public function archiveBuild($release = 'release') {
$release = strtolower($release);
$version = $this->getVersion();

if ($release == 'release') {
if ($this->getIsRelease() !== 'true') {
throw new Exception('The Official release constant must be true');
}
}

if (!$this->isSemVer($version)) {
throw new Exception("$version is not semver compliant. See http://semver.org/");
}
Expand Down
10 changes: 10 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Features
<readme>https://github.com/pluginsGLPI/formcreator/blob/master/README.md</readme>
<authors>
<author>Jérémy Moreau</author>
<author>Thierry Bugier</author>
<author>Alexandre Delaunay</author>
<author>pluginsGLPI'</author>
</authors>
<versions>
Expand Down Expand Up @@ -216,14 +218,22 @@ Features
<langs>
<lang>ca_ES</lang>
<lang>cs_CZ</lang>
<lang>de_AT</lang>
<lang>de_DE</lang>
<lang>en_GB</lang>
<lang>en_US</lang>
<lang>es_419</lang>
<lang>es_AR</lang>
<lang>es_CL</lang>
<lang>es_ES</lang>
<lang>es_MX</lang>
<lang>fr_FR</lang>
<lang>hu_HU</lang>
<lang>it_IT</lang>
<lang>lv_LV</lang>
<lang>nb_NO</lang>
<lang>nl_BE</lang>
<lang>nl_NL</lang>
<lang>pl_PL</lang>
<lang>pt_BR</lang>
<lang>ro_RO</lang>
Expand Down
22 changes: 15 additions & 7 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@

global $CFG_GLPI;
// Version of the plugin
define('PLUGIN_FORMCREATOR_VERSION', '2.6.3');
define('PLUGIN_FORMCREATOR_VERSION', '2.6.4-dev');
// Schema version of this version
define('PLUGIN_FORMCREATOR_SCHEMA_VERSION', '2.6');
// is or is not an official release of the plugin
define('PLUGIN_FORMCREATOR_IS_OFFICIAL_RELEASE', false);


// Minimal GLPI version, inclusive
define ('PLUGIN_FORMCREATOR_GLPI_MIN_VERSION', '9.2.1');
Expand All @@ -50,12 +53,12 @@
* @return Array [name, version, author, homepage, license, minGlpiVersion]
*/
function plugin_version_formcreator() {
$version = rtrim(GLPI_VERSION, '-dev');
if (!method_exists('Plugins', 'checkGlpiVersion') && version_compare($version, PLUGIN_FORMCREATOR_GLPI_MIN_VERSION, 'lt')) {
echo "This plugin requires GLPI >= " . PLUGIN_FORMCREATOR_GLPI_MIN_VERSION;
$glpiVersion = rtrim(GLPI_VERSION, '-dev');
if (!method_exists('Plugins', 'checkGlpiVersion') && version_compare($glpiVersion, PLUGIN_FORMCREATOR_GLPI_MIN_VERSION, 'lt')) {
echo 'This plugin requires GLPI >= ' . PLUGIN_FORMCREATOR_GLPI_MIN_VERSION;
return false;
}
return array(
$requirements = [
'name' => _n('Form', 'Forms', 2, 'formcreator'),
'version' => PLUGIN_FORMCREATOR_VERSION,
'author' => '<a href="http://www.teclib.com">Teclib\'</a>',
Expand All @@ -64,10 +67,15 @@ function plugin_version_formcreator() {
'requirements' => [
'glpi' => [
'min' => PLUGIN_FORMCREATOR_GLPI_MIN_VERSION,
'dev' => true
]
]
);
];

if (PLUGIN_FORMCREATOR_IS_OFFICIAL_RELEASE) {
// This is not a development version
$requirements['requirements']['glpi']['max'] = PLUGIN_FORMCREATOR_GLPI_MAX_VERSION;
}
return $requirements;
}

/**
Expand Down

0 comments on commit fac8dfe

Please sign in to comment.