declare supported PHP versions and re-adjust tests

This commit is contained in:
korelstar 2020-06-19 15:01:42 +02:00
parent e677f619f0
commit 8c83ac2129
4 changed files with 30 additions and 20 deletions

View File

@ -46,18 +46,17 @@ jobs:
strategy:
matrix:
version: [min, max]
include:
- version: min
php-version: 7.1
- version: max
php-version: 7.4
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up php${{ matrix.php-versions }}
- name: Determine PHP version
env:
VERSION_MINMAX: ${{ matrix.version }}
run: echo "::set-env name=PHP_VERSION::$(php tests/nextcloud-version.php --php-$VERSION_MINMAX)"
- name: Set up PHP ${{ env.PHP_VERSION }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
php-version: ${{ env.PHP_VERSION }}
- name: Install Dependencies
run: composer install --prefer-dist
- name: Install latest Nextcloud API (dev-master)

View File

@ -12,20 +12,19 @@ jobs:
strategy:
matrix:
version: [min, max]
include:
- version: min
php-version: 7.1
- version: max
php-version: 7.4
env:
SERVER_BRANCH: master
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up php${{ matrix.php-versions }}
- name: Determine PHP version
env:
VERSION_MINMAX: ${{ matrix.version }}
run: echo "::set-env name=PHP_VERSION::$(php tests/nextcloud-version.php --php-$VERSION_MINMAX)"
- name: Set up PHP ${{ env.PHP_VERSION }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
php-version: ${{ env.PHP_VERSION }}
- name: Install Dependencies
run: composer install --prefer-dist
- name: Prepare MySQL database
@ -35,8 +34,8 @@ jobs:
mysql -u root -proot -e "CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY '';"
mysql -u root -proot -e "GRANT ALL ON nextcloud.* TO 'nextcloud'@'localhost';"
- name: Select Nextcloud server branch
run: echo "::set-env name=SERVER_BRANCH::stable$(php tests/nextcloud-version.php --appinfo)"
if: matrix.version == 'min'
run: echo "::set-env name=SERVER_BRANCH::stable$(php tests/nextcloud-version.php --appinfo)"
- name: Prepare Nextcloud server using ${{ env.SERVER_BRANCH }}
working-directory: ../
run: |

View File

@ -22,6 +22,7 @@ The Notes app is a distraction free notes taking app for [Nextcloud](https://www
<repository type="git">https://github.com/nextcloud/notes.git</repository>
<screenshot small-thumbnail="https://raw.githubusercontent.com/nextcloud/screenshots/master/apps/Notes/notes-thumbnail.jpg">https://raw.githubusercontent.com/nextcloud/screenshots/master/apps/Notes/notes.png</screenshot>
<dependencies>
<php min-version="7.2" max-version="7.4" />
<nextcloud min-version="16" max-version="21" />
</dependencies>
<repair-steps>

View File

@ -50,7 +50,7 @@ function getValidProperty($json, $prop) {
return $json->{$prop};
}
function getNCVersionFromAppInfo($path, $minmax = 'min') {
function getDependencyVersionFromAppInfo($path, $type = 'nextcloud', $minmax = 'min') {
if (!file_exists($path)) {
throw new Exception('AppInfo does not exists: '.$path);
}
@ -59,7 +59,7 @@ function getNCVersionFromAppInfo($path, $minmax = 'min') {
}
$content = file_get_contents($path);
$info = new SimpleXMLElement($content);
$nc = $info->dependencies->nextcloud;
$nc = $info->dependencies->$type;
$v = (string)$nc->attributes()->{$minmax.'-version'};
return $v;
}
@ -79,8 +79,19 @@ function versionCompare($sv1, $sv2, $type) {
return true;
}
$pathAppInfo = __DIR__.'/../appinfo/info.xml';
if (in_array('--appinfo', $argv)) {
echo getNCVersionFromAppInfo(__DIR__.'/../appinfo/info.xml', 'min');
echo getDependencyVersionFromAppInfo($pathAppInfo, 'nextcloud', 'min');
exit;
}
if (in_array('--php-min', $argv)) {
echo getDependencyVersionFromAppInfo($pathAppInfo, 'php', 'min');
exit;
}
if (in_array('--php-max', $argv)) {
echo getDependencyVersionFromAppInfo($pathAppInfo, 'php', 'max');
exit;
}
@ -89,10 +100,10 @@ try {
$vComposer = getNCVersionFromComposer(__DIR__.'/../composer.json');
if ($vComposer === 'dev-master') {
$vComposer = getNCVersionFromComposerBranchAlias(__DIR__.'/../vendor/christophwurst/nextcloud/composer.json');
$vAppInfo = getNCVersionFromAppInfo(__DIR__.'/../appinfo/info.xml', 'max');
$vAppInfo = getDependencyVersionFromAppInfo($pathAppInfo, 'nextcloud', 'max');
$type = 'max';
} else {
$vAppInfo = getNCVersionFromAppInfo(__DIR__.'/../appinfo/info.xml', 'min');
$vAppInfo = getDependencyVersionFromAppInfo($pathAppInfo, 'nextcloud', 'min');
$type = 'min';
}
echo $type.': '.$vAppInfo.' (AppInfo) vs. '.$vComposer.' (Composer) => ';