feat(supported-version): dynamically append "version" to matrix

This commit is contained in:
Damien Retzinger
2026-05-07 09:27:00 -04:00
parent c786530c3e
commit a7e327d44f
6 changed files with 36 additions and 25 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
@@ -16,7 +16,7 @@ export const getMatrixForVersions = (project: string, versions: string[]): Githu
return { return {
magento: [...acc.magento, current], magento: [...acc.magento, current],
include: [...acc.include, knownVersions[current]] include: [...acc.include, { ...knownVersions[current], version: current.split(':')[1] ?? '' }]
} }
}, {magento: [], include: []}); }, {magento: [], include: []});
} }
@@ -11,6 +11,7 @@ export interface Services {
export interface PackageMatrixVersion { export interface PackageMatrixVersion {
magento: string, magento: string,
version: string,
php: string | number, php: string | number,
composer: string | number, composer: string | number,
mysql: string, mysql: string,
@@ -8,6 +8,7 @@ describe('amendMatrixForNext', () => {
include: [ include: [
{ {
"magento": "magento/project-community-edition:next", "magento": "magento/project-community-edition:next",
"version": "next",
"php": 8.2, "php": 8.2,
"composer": "2", "composer": "2",
"mysql": "mysql:8.0", "mysql": "mysql:8.0",
@@ -33,6 +34,7 @@ describe('amendMatrixForNext', () => {
include: [ include: [
{ {
"magento": "magento/project-community-edition:@alpha", "magento": "magento/project-community-edition:@alpha",
"version": "@alpha",
"php": 8.2, "php": 8.2,
"composer": "2", "composer": "2",
"mysql": "mysql:8.0", "mysql": "mysql:8.0",
@@ -60,6 +62,7 @@ describe('amendMatrixForNext', () => {
include: [ include: [
{ {
"magento": "magento/project-community-edition:v2.4.6-p2", "magento": "magento/project-community-edition:v2.4.6-p2",
"version": "v2.4.6-p2",
"php": 8.2, "php": 8.2,
"composer": "2", "composer": "2",
"mysql": "mysql:8.0", "mysql": "mysql:8.0",
@@ -85,6 +88,7 @@ describe('amendMatrixForNext', () => {
include: [ include: [
{ {
"magento": "magento/project-community-edition:v2.4.6-p2", "magento": "magento/project-community-edition:v2.4.6-p2",
"version": "v2.4.6-p2",
"php": 8.2, "php": 8.2,
"composer": "2", "composer": "2",
"mysql": "mysql:8.0", "mysql": "mysql:8.0",
@@ -112,6 +116,7 @@ describe('amendMatrixForNext', () => {
include: [ include: [
{ {
"magento": "magento/project-community-edition:v2.4.6-p2", "magento": "magento/project-community-edition:v2.4.6-p2",
"version": "v2.4.6-p2",
"php": 8.2, "php": 8.2,
"composer": "2", "composer": "2",
"mysql": "mysql:8.0", "mysql": "mysql:8.0",
@@ -128,6 +133,7 @@ describe('amendMatrixForNext', () => {
}, },
{ {
"magento": "magento/project-community-edition:next", "magento": "magento/project-community-edition:next",
"version": "next",
"php": 8.2, "php": 8.2,
"composer": "2", "composer": "2",
"mysql": "mysql:8.0", "mysql": "mysql:8.0",
@@ -153,6 +159,7 @@ describe('amendMatrixForNext', () => {
include: [ include: [
{ {
"magento": "magento/project-community-edition:v2.4.6-p2", "magento": "magento/project-community-edition:v2.4.6-p2",
"version": "v2.4.6-p2",
"php": 8.2, "php": 8.2,
"composer": "2", "composer": "2",
"mysql": "mysql:8.0", "mysql": "mysql:8.0",
@@ -169,6 +176,7 @@ describe('amendMatrixForNext', () => {
}, },
{ {
"magento": "magento/project-community-edition:@alpha", "magento": "magento/project-community-edition:@alpha",
"version": "@alpha",
"php": 8.2, "php": 8.2,
"composer": "2", "composer": "2",
"mysql": "mysql:8.0", "mysql": "mysql:8.0",
@@ -196,6 +204,7 @@ describe('amendMatrixForNext', () => {
include: [ include: [
{ {
"magento": "mage-os/project-community-edition:next", "magento": "mage-os/project-community-edition:next",
"version": "next",
"php": 8.2, "php": 8.2,
"composer": "2", "composer": "2",
"mysql": "mysql:8.0", "mysql": "mysql:8.0",
@@ -221,6 +230,7 @@ describe('amendMatrixForNext', () => {
include: [ include: [
{ {
"magento": "mage-os/project-community-edition:@alpha", "magento": "mage-os/project-community-edition:@alpha",
"version": "@alpha",
"php": 8.2, "php": 8.2,
"composer": "2", "composer": "2",
"mysql": "mysql:8.0", "mysql": "mysql:8.0",
@@ -12,12 +12,11 @@ export const amendMatrixForNext = (matrix: GithubActionsMatrix, repository: Repo
const nextVersionRegExp = new RegExp(nextVersionPlaceHolder + '$'); const nextVersionRegExp = new RegExp(nextVersionPlaceHolder + '$');
matrix.magento = matrix.magento.map((item) => item.match(nextVersionRegExp) ? unifyNextPackageName(item, repository, date) : item); matrix.magento = matrix.magento.map((item) => item.match(nextVersionRegExp) ? unifyNextPackageName(item, repository, date) : item);
matrix.include = matrix.include.map((item) => { matrix.include = matrix.include.map((item) => {
return item.magento.match(nextVersionRegExp) if (!item.magento.match(nextVersionRegExp)) {
? { return item;
...item,
magento: unifyNextPackageName(item.magento, repository, date),
} }
: item; const magento = unifyNextPackageName(item.magento, repository, date);
return { ...item, magento, version: magento.split(':')[1] };
}); });
return matrix; return matrix;
} }
@@ -3,6 +3,7 @@ import { PackageMatrixVersion } from '../matrix/matrix-type';
const createTestEntry = (overrides: Partial<PackageMatrixVersion> = {}): PackageMatrixVersion => ({ const createTestEntry = (overrides: Partial<PackageMatrixVersion> = {}): PackageMatrixVersion => ({
magento: 'magento/project-community-edition:2.4.7', magento: 'magento/project-community-edition:2.4.7',
version: '2.4.7',
php: '8.3', php: '8.3',
composer: '2.7.4', composer: '2.7.4',
mysql: 'mysql:8.4', mysql: 'mysql:8.4',