mirror of
https://github.com/icewind1991/nextcloud-version-matrix.git
synced 2026-06-03 09:34:12 +02:00
add option to add extra php versions for testing
This commit is contained in:
parent
ddbeff6b7a
commit
3b6f20f8d2
3 changed files with 4814 additions and 4768 deletions
|
|
@ -9,6 +9,10 @@ inputs:
|
||||||
description: 'Other fields to include in the output matrix, json encoded'
|
description: 'Other fields to include in the output matrix, json encoded'
|
||||||
required: false
|
required: false
|
||||||
default: '{}'
|
default: '{}'
|
||||||
|
with_php:
|
||||||
|
description: 'Extra php versions to use, either a single string or json array. These will be included in the matrix with the "master" server branch'
|
||||||
|
required: false
|
||||||
|
default: '[]'
|
||||||
outputs:
|
outputs:
|
||||||
matrix:
|
matrix:
|
||||||
description: 'Test matrix covering all server versions'
|
description: 'Test matrix covering all server versions'
|
||||||
|
|
|
||||||
25
dist/index.js
vendored
25
dist/index.js
vendored
|
|
@ -42621,6 +42621,14 @@ function copy(obj) {
|
||||||
try {
|
try {
|
||||||
const filename = core.getInput('filename') || 'appinfo/info.xml';
|
const filename = core.getInput('filename') || 'appinfo/info.xml';
|
||||||
const matrixInput = JSON.parse(core.getInput('matrix') || '{}');
|
const matrixInput = JSON.parse(core.getInput('matrix') || '{}');
|
||||||
|
const withPhpInput = core.getInput('with_php') || '[]';
|
||||||
|
console.log(withPhpInput);
|
||||||
|
let withPhp = [];
|
||||||
|
if (withPhpInput.startsWith('[') && withPhpInput.endsWith(']')) {
|
||||||
|
withPhp = JSON.parse(withPhpInput);
|
||||||
|
} else {
|
||||||
|
withPhp = [withPhpInput];
|
||||||
|
}
|
||||||
|
|
||||||
const content = fs.readFileSync(filename, 'utf8');
|
const content = fs.readFileSync(filename, 'utf8');
|
||||||
const document = new DOMParser().parseFromString(content);
|
const document = new DOMParser().parseFromString(content);
|
||||||
|
|
@ -42651,6 +42659,12 @@ function copy(obj) {
|
||||||
const phpMax = versionData.find(data => data.branch === row["server-versions"]).phpMax;
|
const phpMax = versionData.find(data => data.branch === row["server-versions"]).phpMax;
|
||||||
row["php-versions"] = phpMax.toFixed(1);
|
row["php-versions"] = phpMax.toFixed(1);
|
||||||
});
|
});
|
||||||
|
for (let extraPhpVersion of withPhp) {
|
||||||
|
serverMatrix.push({
|
||||||
|
"php-versions": extraPhpVersion,
|
||||||
|
"server-versions": "master",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
core.setOutput("versions", JSON.stringify(versions));
|
core.setOutput("versions", JSON.stringify(versions));
|
||||||
|
|
||||||
|
|
@ -42659,7 +42673,7 @@ function copy(obj) {
|
||||||
const phpMin = Math.min(...versionData.map(data => data.phpMin));
|
const phpMin = Math.min(...versionData.map(data => data.phpMin));
|
||||||
const phpMax = Math.max(...versionData.map(data => data.phpMax));
|
const phpMax = Math.max(...versionData.map(data => data.phpMax));
|
||||||
|
|
||||||
const php = [];
|
const php = withPhp.concat([]); // clone, not alias
|
||||||
for(let version = phpMin; version <= phpMax; version += 0.1) {
|
for(let version = phpMin; version <= phpMax; version += 0.1) {
|
||||||
// floats are a pain
|
// floats are a pain
|
||||||
version = parseFloat(version.toFixed(1));
|
version = parseFloat(version.toFixed(1));
|
||||||
|
|
@ -42670,6 +42684,7 @@ function copy(obj) {
|
||||||
version = Math.ceil(version) - 0.1;
|
version = Math.ceil(version) - 0.1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
php.sort();
|
||||||
|
|
||||||
const distroPhp = [];
|
const distroPhp = [];
|
||||||
let availablePhp = phpMax;
|
let availablePhp = phpMax;
|
||||||
|
|
@ -42688,7 +42703,7 @@ function copy(obj) {
|
||||||
phpMatrix.forEach(row => {
|
phpMatrix.forEach(row => {
|
||||||
const php = row['php-versions'];
|
const php = row['php-versions'];
|
||||||
const candidateVersion = versionData.findLast(data => data.phpMin <= php && data.phpMax >= php);
|
const candidateVersion = versionData.findLast(data => data.phpMin <= php && data.phpMax >= php);
|
||||||
row["server-versions"] = candidateVersion.branch;
|
row["server-versions"] = candidateVersion?.branch ?? "master";
|
||||||
});
|
});
|
||||||
|
|
||||||
// matrix with every php and server combination
|
// matrix with every php and server combination
|
||||||
|
|
@ -42701,6 +42716,12 @@ function copy(obj) {
|
||||||
const version = versionData.find(version => version.branch === row['server-versions']);
|
const version = versionData.find(version => version.branch === row['server-versions']);
|
||||||
return version.phpMin <= php && version.phpMax >= php;
|
return version.phpMin <= php && version.phpMax >= php;
|
||||||
});
|
});
|
||||||
|
for (let extraPhpVersion of withPhp) {
|
||||||
|
fullMatrix.push({
|
||||||
|
"php-versions": extraPhpVersion,
|
||||||
|
"server-versions": "master",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// matrix with at least one item for every server and php version
|
// matrix with at least one item for every server and php version
|
||||||
let testMatrix = phpMatrix.concat(serverMatrix).filter(onlyUnique);
|
let testMatrix = phpMatrix.concat(serverMatrix).filter(onlyUnique);
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,14 @@ function copy(obj) {
|
||||||
try {
|
try {
|
||||||
const filename = core.getInput('filename') || 'appinfo/info.xml';
|
const filename = core.getInput('filename') || 'appinfo/info.xml';
|
||||||
const matrixInput = JSON.parse(core.getInput('matrix') || '{}');
|
const matrixInput = JSON.parse(core.getInput('matrix') || '{}');
|
||||||
|
const withPhpInput = core.getInput('with_php') || '[]';
|
||||||
|
console.log(withPhpInput);
|
||||||
|
let withPhp = [];
|
||||||
|
if (withPhpInput.startsWith('[') && withPhpInput.endsWith(']')) {
|
||||||
|
withPhp = JSON.parse(withPhpInput);
|
||||||
|
} else {
|
||||||
|
withPhp = [withPhpInput];
|
||||||
|
}
|
||||||
|
|
||||||
const content = fs.readFileSync(filename, 'utf8');
|
const content = fs.readFileSync(filename, 'utf8');
|
||||||
const document = new DOMParser().parseFromString(content);
|
const document = new DOMParser().parseFromString(content);
|
||||||
|
|
@ -137,6 +145,12 @@ function copy(obj) {
|
||||||
const phpMax = versionData.find(data => data.branch === row["server-versions"]).phpMax;
|
const phpMax = versionData.find(data => data.branch === row["server-versions"]).phpMax;
|
||||||
row["php-versions"] = phpMax.toFixed(1);
|
row["php-versions"] = phpMax.toFixed(1);
|
||||||
});
|
});
|
||||||
|
for (let extraPhpVersion of withPhp) {
|
||||||
|
serverMatrix.push({
|
||||||
|
"php-versions": extraPhpVersion,
|
||||||
|
"server-versions": "master",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
core.setOutput("versions", JSON.stringify(versions));
|
core.setOutput("versions", JSON.stringify(versions));
|
||||||
|
|
||||||
|
|
@ -145,7 +159,7 @@ function copy(obj) {
|
||||||
const phpMin = Math.min(...versionData.map(data => data.phpMin));
|
const phpMin = Math.min(...versionData.map(data => data.phpMin));
|
||||||
const phpMax = Math.max(...versionData.map(data => data.phpMax));
|
const phpMax = Math.max(...versionData.map(data => data.phpMax));
|
||||||
|
|
||||||
const php = [];
|
const php = withPhp.concat([]); // clone, not alias
|
||||||
for(let version = phpMin; version <= phpMax; version += 0.1) {
|
for(let version = phpMin; version <= phpMax; version += 0.1) {
|
||||||
// floats are a pain
|
// floats are a pain
|
||||||
version = parseFloat(version.toFixed(1));
|
version = parseFloat(version.toFixed(1));
|
||||||
|
|
@ -156,6 +170,7 @@ function copy(obj) {
|
||||||
version = Math.ceil(version) - 0.1;
|
version = Math.ceil(version) - 0.1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
php.sort();
|
||||||
|
|
||||||
const distroPhp = [];
|
const distroPhp = [];
|
||||||
let availablePhp = phpMax;
|
let availablePhp = phpMax;
|
||||||
|
|
@ -174,7 +189,7 @@ function copy(obj) {
|
||||||
phpMatrix.forEach(row => {
|
phpMatrix.forEach(row => {
|
||||||
const php = row['php-versions'];
|
const php = row['php-versions'];
|
||||||
const candidateVersion = versionData.findLast(data => data.phpMin <= php && data.phpMax >= php);
|
const candidateVersion = versionData.findLast(data => data.phpMin <= php && data.phpMax >= php);
|
||||||
row["server-versions"] = candidateVersion.branch;
|
row["server-versions"] = candidateVersion?.branch ?? "master";
|
||||||
});
|
});
|
||||||
|
|
||||||
// matrix with every php and server combination
|
// matrix with every php and server combination
|
||||||
|
|
@ -187,6 +202,12 @@ function copy(obj) {
|
||||||
const version = versionData.find(version => version.branch === row['server-versions']);
|
const version = versionData.find(version => version.branch === row['server-versions']);
|
||||||
return version.phpMin <= php && version.phpMax >= php;
|
return version.phpMin <= php && version.phpMax >= php;
|
||||||
});
|
});
|
||||||
|
for (let extraPhpVersion of withPhp) {
|
||||||
|
fullMatrix.push({
|
||||||
|
"php-versions": extraPhpVersion,
|
||||||
|
"server-versions": "master",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// matrix with at least one item for every server and php version
|
// matrix with at least one item for every server and php version
|
||||||
let testMatrix = phpMatrix.concat(serverMatrix).filter(onlyUnique);
|
let testMatrix = phpMatrix.concat(serverMatrix).filter(onlyUnique);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue