mirror of
https://github.com/icewind1991/nextcloud-version-matrix.git
synced 2026-06-03 17:44:08 +02:00
add output for "availble" php version
This commit is contained in:
parent
d594a6929d
commit
abc1a0628d
5 changed files with 4826 additions and 4765 deletions
1
.github/workflows/main.yml
vendored
1
.github/workflows/main.yml
vendored
|
|
@ -22,5 +22,6 @@ jobs:
|
||||||
- name: Get the result
|
- name: Get the result
|
||||||
run: |
|
run: |
|
||||||
echo -e "Versions :\n${{ steps.run.outputs.versions }}"
|
echo -e "Versions :\n${{ steps.run.outputs.versions }}"
|
||||||
|
echo -e "Available PHP :\n${{ steps.run.outputs.php-available }}"
|
||||||
echo -e "Branches :\n${{ steps.run.outputs.branches }}"
|
echo -e "Branches :\n${{ steps.run.outputs.branches }}"
|
||||||
echo -e "Matrix :\n${{ steps.run.outputs.matrix }}"
|
echo -e "Matrix :\n${{ steps.run.outputs.matrix }}"
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,10 @@ Maximum supported php version
|
||||||
|
|
||||||
Minimum supported php version
|
Minimum supported php version
|
||||||
|
|
||||||
|
### `php-available`
|
||||||
|
|
||||||
|
Maximum supported php version that is available in the runner
|
||||||
|
|
||||||
### `php-max-list`
|
### `php-max-list`
|
||||||
|
|
||||||
Maximum supported php version, as a single-item list
|
Maximum supported php version, as a single-item list
|
||||||
|
|
@ -58,6 +62,10 @@ Maximum supported php version, as a single-item list
|
||||||
|
|
||||||
Minimum supported php version, as a single-item list
|
Minimum supported php version, as a single-item list
|
||||||
|
|
||||||
|
### `php-available-list`
|
||||||
|
|
||||||
|
Maximum supported php version that is available in the runner, as a single-item list
|
||||||
|
|
||||||
### `branches-max`
|
### `branches-max`
|
||||||
|
|
||||||
Maximum supported server version
|
Maximum supported server version
|
||||||
|
|
|
||||||
30
dist/index.js
vendored
30
dist/index.js
vendored
|
|
@ -42152,6 +42152,14 @@ module.exports = require("buffer");
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 2081:
|
||||||
|
/***/ ((module) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
module.exports = require("child_process");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ 6206:
|
/***/ 6206:
|
||||||
/***/ ((module) => {
|
/***/ ((module) => {
|
||||||
|
|
||||||
|
|
@ -42511,6 +42519,8 @@ const fs = __nccwpck_require__(7147);
|
||||||
const urlExist = __nccwpck_require__(5565);
|
const urlExist = __nccwpck_require__(5565);
|
||||||
const {HttpClient} = __nccwpck_require__(6255);
|
const {HttpClient} = __nccwpck_require__(6255);
|
||||||
const equal = __nccwpck_require__(3414);
|
const equal = __nccwpck_require__(3414);
|
||||||
|
const { promisify } = __nccwpck_require__(3837);
|
||||||
|
const exec = promisify((__nccwpck_require__(2081).exec))
|
||||||
|
|
||||||
const client = new HttpClient('nextcloud-version-matrix')
|
const client = new HttpClient('nextcloud-version-matrix')
|
||||||
|
|
||||||
|
|
@ -42553,6 +42563,15 @@ async function getAllPhpVersions() {
|
||||||
return matches.map(match => match[1]);
|
return matches.map(match => match[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function distroSupportsPhpVersion(version) {
|
||||||
|
try {
|
||||||
|
const output = await exec(`apt-cache policy php${version}`);
|
||||||
|
return output.stdout.includes("Candidate")
|
||||||
|
} catch (_e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onlyUnique(value, index, array) {
|
function onlyUnique(value, index, array) {
|
||||||
return array.findIndex(item => equal(value, item)) === index;
|
return array.findIndex(item => equal(value, item)) === index;
|
||||||
}
|
}
|
||||||
|
|
@ -42648,6 +42667,15 @@ function copy(obj) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const distroPhp = [];
|
||||||
|
let availablePhp = phpMax;
|
||||||
|
for(let version of php) {
|
||||||
|
if (await distroSupportsPhpVersion(version)) {
|
||||||
|
distroPhp.push(version)
|
||||||
|
availablePhp = version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// matrix with a single server version per php version
|
// matrix with a single server version per php version
|
||||||
const phpMatrix = cartesianProduct({
|
const phpMatrix = cartesianProduct({
|
||||||
"php-versions": php,
|
"php-versions": php,
|
||||||
|
|
@ -42681,11 +42709,13 @@ function copy(obj) {
|
||||||
|
|
||||||
core.setOutput("php-min-list", JSON.stringify([php[0]]));
|
core.setOutput("php-min-list", JSON.stringify([php[0]]));
|
||||||
core.setOutput("php-max-list", JSON.stringify([php[php.length - 1]]));
|
core.setOutput("php-max-list", JSON.stringify([php[php.length - 1]]));
|
||||||
|
core.setOutput("php-available-list", JSON.stringify([availablePhp]));
|
||||||
core.setOutput("branches-min-list", JSON.stringify([branches[0]]));
|
core.setOutput("branches-min-list", JSON.stringify([branches[0]]));
|
||||||
core.setOutput("branches-max-list", JSON.stringify([branches[branches.length - 1]]));
|
core.setOutput("branches-max-list", JSON.stringify([branches[branches.length - 1]]));
|
||||||
|
|
||||||
core.setOutput("php-min", php[0]);
|
core.setOutput("php-min", php[0]);
|
||||||
core.setOutput("php-max", php[php.length - 1]);
|
core.setOutput("php-max", php[php.length - 1]);
|
||||||
|
core.setOutput("php-available", availablePhp);
|
||||||
core.setOutput("branches-min", branches[0]);
|
core.setOutput("branches-min", branches[0]);
|
||||||
core.setOutput("branches-max", branches[branches.length - 1]);
|
core.setOutput("branches-max", branches[branches.length - 1]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
"main": "src/action.js",
|
"main": "src/action.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build src/action.js -o dist",
|
"build": "ncc build src/action.js -o dist",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "INPUT_FILENAME=.github/workflows/info.xml node src/action.js"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ const fs = require('fs');
|
||||||
const urlExist = require('url-exist');
|
const urlExist = require('url-exist');
|
||||||
const {HttpClient} = require('@actions/http-client');
|
const {HttpClient} = require('@actions/http-client');
|
||||||
const equal = require('deep-equal');
|
const equal = require('deep-equal');
|
||||||
|
const { promisify } = require('util');
|
||||||
|
const exec = promisify(require('child_process').exec)
|
||||||
|
|
||||||
const client = new HttpClient('nextcloud-version-matrix')
|
const client = new HttpClient('nextcloud-version-matrix')
|
||||||
|
|
||||||
|
|
@ -47,6 +49,15 @@ async function getAllPhpVersions() {
|
||||||
return matches.map(match => match[1]);
|
return matches.map(match => match[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function distroSupportsPhpVersion(version) {
|
||||||
|
try {
|
||||||
|
const output = await exec(`apt-cache policy php${version}`);
|
||||||
|
return output.stdout.includes("Candidate")
|
||||||
|
} catch (_e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onlyUnique(value, index, array) {
|
function onlyUnique(value, index, array) {
|
||||||
return array.findIndex(item => equal(value, item)) === index;
|
return array.findIndex(item => equal(value, item)) === index;
|
||||||
}
|
}
|
||||||
|
|
@ -142,6 +153,15 @@ function copy(obj) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const distroPhp = [];
|
||||||
|
let availablePhp = phpMax;
|
||||||
|
for(let version of php) {
|
||||||
|
if (await distroSupportsPhpVersion(version)) {
|
||||||
|
distroPhp.push(version)
|
||||||
|
availablePhp = version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// matrix with a single server version per php version
|
// matrix with a single server version per php version
|
||||||
const phpMatrix = cartesianProduct({
|
const phpMatrix = cartesianProduct({
|
||||||
"php-versions": php,
|
"php-versions": php,
|
||||||
|
|
@ -175,11 +195,13 @@ function copy(obj) {
|
||||||
|
|
||||||
core.setOutput("php-min-list", JSON.stringify([php[0]]));
|
core.setOutput("php-min-list", JSON.stringify([php[0]]));
|
||||||
core.setOutput("php-max-list", JSON.stringify([php[php.length - 1]]));
|
core.setOutput("php-max-list", JSON.stringify([php[php.length - 1]]));
|
||||||
|
core.setOutput("php-available-list", JSON.stringify([availablePhp]));
|
||||||
core.setOutput("branches-min-list", JSON.stringify([branches[0]]));
|
core.setOutput("branches-min-list", JSON.stringify([branches[0]]));
|
||||||
core.setOutput("branches-max-list", JSON.stringify([branches[branches.length - 1]]));
|
core.setOutput("branches-max-list", JSON.stringify([branches[branches.length - 1]]));
|
||||||
|
|
||||||
core.setOutput("php-min", php[0]);
|
core.setOutput("php-min", php[0]);
|
||||||
core.setOutput("php-max", php[php.length - 1]);
|
core.setOutput("php-max", php[php.length - 1]);
|
||||||
|
core.setOutput("php-available", availablePhp);
|
||||||
core.setOutput("branches-min", branches[0]);
|
core.setOutput("branches-min", branches[0]);
|
||||||
core.setOutput("branches-max", branches[branches.length - 1]);
|
core.setOutput("branches-max", branches[branches.length - 1]);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue