mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-08 19:46:41 +00:00
feat(supported-version): dynamically append "version" to matrix
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -16,7 +16,7 @@ export const getMatrixForVersions = (project: string, versions: string[]): Githu
|
||||
|
||||
return {
|
||||
magento: [...acc.magento, current],
|
||||
include: [...acc.include, knownVersions[current]]
|
||||
include: [...acc.include, { ...knownVersions[current], version: current.split(':')[1] ?? '' }]
|
||||
}
|
||||
}, {magento: [], include: []});
|
||||
}
|
||||
@@ -11,6 +11,7 @@ export interface Services {
|
||||
|
||||
export interface PackageMatrixVersion {
|
||||
magento: string,
|
||||
version: string,
|
||||
php: string | number,
|
||||
composer: string | number,
|
||||
mysql: string,
|
||||
|
||||
@@ -4,10 +4,11 @@ describe('amendMatrixForNext', () => {
|
||||
it('should amend the "next" versions listed in the matrix output for the given repo', () => {
|
||||
expect(
|
||||
amendMatrixForNext(
|
||||
{
|
||||
{
|
||||
include: [
|
||||
{
|
||||
"magento": "magento/project-community-edition:next",
|
||||
"version": "next",
|
||||
"php": 8.2,
|
||||
"composer": "2",
|
||||
"mysql": "mysql:8.0",
|
||||
@@ -24,15 +25,16 @@ describe('amendMatrixForNext', () => {
|
||||
}
|
||||
],
|
||||
magento: ["magento/project-community-edition:next"]
|
||||
},
|
||||
"https://upstream-nightly.mage-os.org",
|
||||
},
|
||||
"https://upstream-nightly.mage-os.org",
|
||||
new Date()
|
||||
)
|
||||
).toEqual(
|
||||
{
|
||||
{
|
||||
include: [
|
||||
{
|
||||
"magento": "magento/project-community-edition:@alpha",
|
||||
"version": "@alpha",
|
||||
"php": 8.2,
|
||||
"composer": "2",
|
||||
"mysql": "mysql:8.0",
|
||||
@@ -56,10 +58,11 @@ describe('amendMatrixForNext', () => {
|
||||
it('should should do nothing to matrixes that contain no next versions', () => {
|
||||
expect(
|
||||
amendMatrixForNext(
|
||||
{
|
||||
{
|
||||
include: [
|
||||
{
|
||||
"magento": "magento/project-community-edition:v2.4.6-p2",
|
||||
"version": "v2.4.6-p2",
|
||||
"php": 8.2,
|
||||
"composer": "2",
|
||||
"mysql": "mysql:8.0",
|
||||
@@ -76,15 +79,16 @@ describe('amendMatrixForNext', () => {
|
||||
}
|
||||
],
|
||||
magento: ["magento/project-community-edition:v2.4.6-p2"]
|
||||
},
|
||||
"https://upstream-nightly.mage-os.org",
|
||||
},
|
||||
"https://upstream-nightly.mage-os.org",
|
||||
new Date()
|
||||
)
|
||||
).toEqual(
|
||||
{
|
||||
{
|
||||
include: [
|
||||
{
|
||||
"magento": "magento/project-community-edition:v2.4.6-p2",
|
||||
"version": "v2.4.6-p2",
|
||||
"php": 8.2,
|
||||
"composer": "2",
|
||||
"mysql": "mysql:8.0",
|
||||
@@ -108,10 +112,11 @@ describe('amendMatrixForNext', () => {
|
||||
it('should only modify next versions', () => {
|
||||
expect(
|
||||
amendMatrixForNext(
|
||||
{
|
||||
{
|
||||
include: [
|
||||
{
|
||||
"magento": "magento/project-community-edition:v2.4.6-p2",
|
||||
"version": "v2.4.6-p2",
|
||||
"php": 8.2,
|
||||
"composer": "2",
|
||||
"mysql": "mysql:8.0",
|
||||
@@ -128,6 +133,7 @@ describe('amendMatrixForNext', () => {
|
||||
},
|
||||
{
|
||||
"magento": "magento/project-community-edition:next",
|
||||
"version": "next",
|
||||
"php": 8.2,
|
||||
"composer": "2",
|
||||
"mysql": "mysql:8.0",
|
||||
@@ -144,15 +150,16 @@ describe('amendMatrixForNext', () => {
|
||||
}
|
||||
],
|
||||
magento: ["magento/project-community-edition:v2.4.6-p2", "magento/project-community-edition:next"]
|
||||
},
|
||||
"https://upstream-nightly.mage-os.org",
|
||||
},
|
||||
"https://upstream-nightly.mage-os.org",
|
||||
new Date()
|
||||
)
|
||||
).toEqual(
|
||||
{
|
||||
{
|
||||
include: [
|
||||
{
|
||||
"magento": "magento/project-community-edition:v2.4.6-p2",
|
||||
"version": "v2.4.6-p2",
|
||||
"php": 8.2,
|
||||
"composer": "2",
|
||||
"mysql": "mysql:8.0",
|
||||
@@ -169,6 +176,7 @@ describe('amendMatrixForNext', () => {
|
||||
},
|
||||
{
|
||||
"magento": "magento/project-community-edition:@alpha",
|
||||
"version": "@alpha",
|
||||
"php": 8.2,
|
||||
"composer": "2",
|
||||
"mysql": "mysql:8.0",
|
||||
@@ -192,10 +200,11 @@ describe('amendMatrixForNext', () => {
|
||||
it('should amend the "next" versions listed in the matrix output for the given repo, for a different project', () => {
|
||||
expect(
|
||||
amendMatrixForNext(
|
||||
{
|
||||
{
|
||||
include: [
|
||||
{
|
||||
"magento": "mage-os/project-community-edition:next",
|
||||
"version": "next",
|
||||
"php": 8.2,
|
||||
"composer": "2",
|
||||
"mysql": "mysql:8.0",
|
||||
@@ -212,15 +221,16 @@ describe('amendMatrixForNext', () => {
|
||||
}
|
||||
],
|
||||
magento: ["mage-os/project-community-edition:next"]
|
||||
},
|
||||
"https://upstream-nightly.mage-os.org",
|
||||
},
|
||||
"https://upstream-nightly.mage-os.org",
|
||||
new Date()
|
||||
)
|
||||
).toEqual(
|
||||
{
|
||||
{
|
||||
include: [
|
||||
{
|
||||
"magento": "mage-os/project-community-edition:@alpha",
|
||||
"version": "@alpha",
|
||||
"php": 8.2,
|
||||
"composer": "2",
|
||||
"mysql": "mysql:8.0",
|
||||
@@ -240,4 +250,4 @@ describe('amendMatrixForNext', () => {
|
||||
}
|
||||
)
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
@@ -12,12 +12,11 @@ export const amendMatrixForNext = (matrix: GithubActionsMatrix, repository: Repo
|
||||
const nextVersionRegExp = new RegExp(nextVersionPlaceHolder + '$');
|
||||
matrix.magento = matrix.magento.map((item) => item.match(nextVersionRegExp) ? unifyNextPackageName(item, repository, date) : item);
|
||||
matrix.include = matrix.include.map((item) => {
|
||||
return item.magento.match(nextVersionRegExp)
|
||||
? {
|
||||
...item,
|
||||
magento: unifyNextPackageName(item.magento, repository, date),
|
||||
}
|
||||
: item;
|
||||
if (!item.magento.match(nextVersionRegExp)) {
|
||||
return item;
|
||||
}
|
||||
const magento = unifyNextPackageName(item.magento, repository, date);
|
||||
return { ...item, magento, version: magento.split(':')[1] };
|
||||
});
|
||||
return matrix;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { PackageMatrixVersion } from '../matrix/matrix-type';
|
||||
|
||||
const createTestEntry = (overrides: Partial<PackageMatrixVersion> = {}): PackageMatrixVersion => ({
|
||||
magento: 'magento/project-community-edition:2.4.7',
|
||||
version: '2.4.7',
|
||||
php: '8.3',
|
||||
composer: '2.7.4',
|
||||
mysql: 'mysql:8.4',
|
||||
|
||||
Reference in New Issue
Block a user