mirror of
https://github.com/icewind1991/nextcloud-version-matrix.git
synced 2026-11-29 23:40:48 +01: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
|
|
@ -5,6 +5,8 @@ const fs = require('fs');
|
|||
const urlExist = require('url-exist');
|
||||
const {HttpClient} = require('@actions/http-client');
|
||||
const equal = require('deep-equal');
|
||||
const { promisify } = require('util');
|
||||
const exec = promisify(require('child_process').exec)
|
||||
|
||||
const client = new HttpClient('nextcloud-version-matrix')
|
||||
|
||||
|
|
@ -47,6 +49,15 @@ async function getAllPhpVersions() {
|
|||
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) {
|
||||
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
|
||||
const phpMatrix = cartesianProduct({
|
||||
"php-versions": php,
|
||||
|
|
@ -175,11 +195,13 @@ function copy(obj) {
|
|||
|
||||
core.setOutput("php-min-list", JSON.stringify([php[0]]));
|
||||
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-max-list", JSON.stringify([branches[branches.length - 1]]));
|
||||
|
||||
core.setOutput("php-min", php[0]);
|
||||
core.setOutput("php-max", php[php.length - 1]);
|
||||
core.setOutput("php-available", availablePhp);
|
||||
core.setOutput("branches-min", branches[0]);
|
||||
core.setOutput("branches-max", branches[branches.length - 1]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue