mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-13 13:14:53 +00:00
feat(supported-version): dynamically compute (#120)
Previously, I maintained supported versions by revising a file of versions. This was monotonous, like time. Now, these are just based upon the documented EoL dates of the versions published by Magento.
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
[
|
||||
"magento/project-community-edition:>=2.3 <2.4",
|
||||
"magento/project-community-edition:>=2.4.0 <2.4.1",
|
||||
"magento/project-community-edition:>=2.4.1 <2.4.2",
|
||||
"magento/project-community-edition:>=2.4.2 <2.4.3",
|
||||
"magento/project-community-edition:>=2.4.3 <2.4.4",
|
||||
"magento/project-community-edition:>=2.4.4 <2.4.5",
|
||||
"magento/project-community-edition:>=2.4.5 <2.4.6",
|
||||
"magento/project-community-edition"
|
||||
]
|
||||
@@ -0,0 +1,24 @@
|
||||
import { getCurrentlySupportedVersions } from "./get-currently-supported";
|
||||
|
||||
describe('getCurrentlySupportedVersions', () => {
|
||||
it('should say that v2.4.0 is not supported in 2025', () => {
|
||||
const date: Date = new Date('2025-01-01T00:00:00Z');
|
||||
expect(getCurrentlySupportedVersions(date)).not.toContain('magento/project-community-edition:2.4.0');
|
||||
});
|
||||
|
||||
it('should say that v2.4.5 is supported in 2023 and most of 2024.', () => {
|
||||
const firstDayOf2023: Date = new Date('2023-01-01T00:00:00Z');
|
||||
const firstDayOf2024: Date = new Date('2024-01-01T00:00:00Z');
|
||||
const lastDayOf2024: Date = new Date('2024-12-31T00:00:00Z');
|
||||
const dayBeforeEol: Date = new Date('2024-11-24T00:00:00Z');
|
||||
const dayOfEol: Date = new Date('2024-11-25T00:00:00Z');
|
||||
const dayAfterEol: Date = new Date('2024-11-26T00:00:00Z');
|
||||
|
||||
expect(getCurrentlySupportedVersions(firstDayOf2023)).toContain('magento/project-community-edition:2.4.5-p1');
|
||||
expect(getCurrentlySupportedVersions(firstDayOf2024)).toContain('magento/project-community-edition:2.4.5-p1');
|
||||
expect(getCurrentlySupportedVersions(lastDayOf2024)).not.toContain('magento/project-community-edition:2.4.5-p1');
|
||||
expect(getCurrentlySupportedVersions(dayBeforeEol)).toContain('magento/project-community-edition:2.4.5-p1');
|
||||
expect(getCurrentlySupportedVersions(dayOfEol)).toContain('magento/project-community-edition:2.4.5-p1');
|
||||
expect(getCurrentlySupportedVersions(dayAfterEol)).not.toContain('magento/project-community-edition:2.4.5-p1');
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,7 @@
|
||||
import { MagentoMatrixVersion } from '../matrix/matrix-type';
|
||||
import allVersions from '../versions/individual.json';
|
||||
|
||||
export const getCurrentlySupportedVersions = (date: Date): string[] =>
|
||||
Object.entries(<Record<string,MagentoMatrixVersion>>allVersions)
|
||||
.filter(([key, value]) => new Date(value.eol) >= date)
|
||||
.map(([key, value]) => key);
|
||||
Reference in New Issue
Block a user