Skip to content

Commit fd12390

Browse files
authored
Merge branch 'main' into test-matrix-latest-nightly
2 parents f0d2ac0 + 2189663 commit fd12390

12 files changed

Lines changed: 810 additions & 2513 deletions

File tree

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18.18.0
1+
v24.12.0

package-lock.json

Lines changed: 618 additions & 2456 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@
2121
"@actions/core": "^1.10.0"
2222
},
2323
"devDependencies": {
24-
"@types/jest": "^29.5.11",
25-
"@types/node": "^22.13.10",
26-
"@typescript-eslint/eslint-plugin": "^8.26.1",
27-
"@typescript-eslint/parser": "^8.26.1",
28-
"esbuild": "^0.25.1",
29-
"eslint": "^9.22.0",
24+
"@types/jest": "^29.5.14",
25+
"@types/node": "^24.10.4",
26+
"@typescript-eslint/eslint-plugin": "^8.49.0",
27+
"@typescript-eslint/parser": "^8.49.0",
28+
"esbuild": "^0.25.12",
29+
"eslint": "^9.39.2",
3030
"jest": "^29.5.0",
31-
"standard-version": "^9.5.0",
32-
"ts-jest": "^29.2.6",
33-
"typescript": "^5.8.2"
31+
"ts-jest": "^29.4.6",
32+
"typescript": "^5.9.3"
3433
}
3534
}

supported-version/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@ See the [action.yml](./action.yml)
1313

1414
| Input | Description | Required | Default |
1515
|-----------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |-----------------------|
16-
| kind | The "kind" of support you're targeting for your package. Allowed values are `currently-supported`, `latest`, `custom`, `nightly` and `all` | false | 'currently-supported' |
17-
| project | The project to return the supported versions for. Allowed values are `mage-os` and `magento-open-source` | false | 'magento-open-source' |
18-
| custom_versions | The versions you want to support, as a comma-separated string, i.e. 'magento/project-community-edition:2.3.7-p3, magento/project-community-edition:2.4.2-p2' | false | '' |
16+
| kind | The "kind" of support you're targeting for your package. See [Kinds](#kinds). | false | 'currently-supported' |
17+
| project | The project to return the supported versions for. Allowed values are `mage-os` and `magento-open-source` | false | 'magento-open-source' |
18+
| custom_versions | The versions you want to support, as a comma-separated string, i.e. 'magento/project-community-edition:2.3.7-p3, magento/project-community-edition:2.4.2-p2' | false | '' |
19+
| recent_time_frame | The time frame (from today) used when `kind` is `recent`. Combination of years (y), months (m), and days (d), e.g. `2y 2m 2d`. | false | '2y' |
1920

2021
## Kinds
2122
- `currently-supported` - The currently supported Magento Open Source versions by Adobe.
2223
- `latest` - The latest version of Magento only.
2324
- `custom` - A custom subset of the versions, as specified by you. Requires `custom_versions` sibling key.
2425
- `usable` - All versions of Magento, minus any that can no longer be installed or used under normal circumstances.
2526
- `nightly` - The nightly version of Magento (only available via `https://upstream-nightly.mage-os.org`)
27+
- `recent` - Versions released within a configurable time window from today (see `recent_time_frame`).
2628
- `all` - All versions of Magento (including patched/unpatched versions).
2729

2830
## Projects

supported-version/action.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: "A Github Action that computes the Github Actions matrix for the ch
55
inputs:
66
kind:
77
required: false
8-
description: "The kind of versions you want to return. Allowed values are `currently-supported`, `latest`, `custom`, `usable`, `nightly`, and `all`"
8+
description: "The kind of versions you want to return. Allowed values are `currently-supported`, `latest`, `custom`, `usable`, `nightly`, `recent` and `all`"
99
default: "currently-supported"
1010
project:
1111
required: false
@@ -17,12 +17,17 @@ inputs:
1717
description: "The specific custom versions of Magento that you want to use. Only applies when `kind` is `custom`"
1818
default: ""
1919

20+
recent_time_frame:
21+
required: false
22+
default: "2y"
23+
description: "The time frame (from today). Only used in `recent` kind. String that defines a time duration using a combination of years (y), months (m), and days (d). Each unit is optional and can appear in any order, separated by spaces. For example `2y 2m 2d`. "
24+
2025
outputs:
2126
matrix:
2227
description: "The Github Actions matrix of software technologies required to run Magento."
2328

2429
runs:
25-
using: "node20"
30+
using: "node24"
2631
main: dist/index.js
2732

2833
branding:

supported-version/dist/index.js

Lines changed: 38 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

supported-version/src/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ import { validateProject } from "./project/validate-projects";
55

66

77
export async function run(): Promise<void> {
8-
try {
8+
try {
99
const kind = core.getInput("kind");
1010
const customVersions = core.getInput("custom_versions");
1111
const project = core.getInput("project");
12-
12+
const recent_time_frame = core.getInput("recent_time_frame");
13+
1314
validateProject(<any>project)
1415

1516
validateKind(<any>kind, customVersions ? customVersions.split(',') : undefined);
1617

17-
core.setOutput('matrix', getMatrixForKind(kind, project, customVersions));
18-
}
18+
core.setOutput('matrix', getMatrixForKind(kind, project, customVersions, recent_time_frame));
19+
}
1920
catch (error) {
2021
core.setFailed(error.message);
2122
}

supported-version/src/kind/kinds.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const KNOWN_KINDS = {
77
'custom': true,
88
'usable': true,
99
'nightly': true,
10+
'recent': true,
1011
'all': true,
1112
}
1213

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import { Project } from "../project/projects";
2+
import { getRecentVersions } from "./recent";
3+
4+
describe('recent for magento-open-source', () => {
5+
const project: Project = "magento-open-source";
6+
7+
test.each([
8+
['2024-12-31T00:00:00Z', 'End of 2024', [
9+
"magento/project-community-edition:2.4.4-p7",
10+
"magento/project-community-edition:2.4.4-p8",
11+
"magento/project-community-edition:2.4.4-p9",
12+
"magento/project-community-edition:2.4.4-p10",
13+
"magento/project-community-edition:2.4.4-p11",
14+
"magento/project-community-edition:2.4.5-p6",
15+
"magento/project-community-edition:2.4.5-p7",
16+
"magento/project-community-edition:2.4.5-p8",
17+
"magento/project-community-edition:2.4.5-p9",
18+
"magento/project-community-edition:2.4.5-p10",
19+
"magento/project-community-edition:2.4.6-p4",
20+
"magento/project-community-edition:2.4.6-p5",
21+
"magento/project-community-edition:2.4.6-p6",
22+
"magento/project-community-edition:2.4.6-p7",
23+
"magento/project-community-edition:2.4.6-p8",
24+
"magento/project-community-edition:2.4.7",
25+
"magento/project-community-edition:2.4.7-p1",
26+
"magento/project-community-edition:2.4.7-p2",
27+
"magento/project-community-edition:2.4.7-p3",
28+
]],
29+
['2025-04-08T00:00:00Z', 'The day Damien wrote a test.', [
30+
"magento/project-community-edition:2.4.4-p9",
31+
"magento/project-community-edition:2.4.4-p10",
32+
"magento/project-community-edition:2.4.4-p11",
33+
"magento/project-community-edition:2.4.4-p12",
34+
"magento/project-community-edition:2.4.5-p8",
35+
"magento/project-community-edition:2.4.5-p9",
36+
"magento/project-community-edition:2.4.5-p10",
37+
"magento/project-community-edition:2.4.5-p11",
38+
"magento/project-community-edition:2.4.6-p6",
39+
"magento/project-community-edition:2.4.6-p7",
40+
"magento/project-community-edition:2.4.6-p8",
41+
"magento/project-community-edition:2.4.6-p9",
42+
"magento/project-community-edition:2.4.7-p1",
43+
"magento/project-community-edition:2.4.7-p2",
44+
"magento/project-community-edition:2.4.7-p3",
45+
"magento/project-community-edition:2.4.7-p4",
46+
]],
47+
['2025-08-08T00:00:00Z', 'Day Before v2.4.5 EoL', [
48+
"magento/project-community-edition:2.4.4-p10",
49+
"magento/project-community-edition:2.4.4-p11",
50+
"magento/project-community-edition:2.4.4-p12",
51+
"magento/project-community-edition:2.4.4-p13",
52+
"magento/project-community-edition:2.4.5-p9",
53+
"magento/project-community-edition:2.4.5-p10",
54+
"magento/project-community-edition:2.4.5-p11",
55+
"magento/project-community-edition:2.4.5-p12",
56+
"magento/project-community-edition:2.4.5-p13",
57+
"magento/project-community-edition:2.4.6-p7",
58+
"magento/project-community-edition:2.4.6-p8",
59+
"magento/project-community-edition:2.4.6-p9",
60+
"magento/project-community-edition:2.4.6-p10",
61+
"magento/project-community-edition:2.4.6-p11",
62+
"magento/project-community-edition:2.4.7-p2",
63+
"magento/project-community-edition:2.4.7-p3",
64+
"magento/project-community-edition:2.4.7-p4",
65+
"magento/project-community-edition:2.4.7-p5",
66+
"magento/project-community-edition:2.4.7-p6",
67+
"magento/project-community-edition:2.4.8",
68+
"magento/project-community-edition:2.4.8-p1"
69+
]],
70+
])(
71+
'recent for %s',
72+
(date, description ,result) => {
73+
expect(
74+
getRecentVersions(project, new Date(date), '360d')
75+
).toEqual(result);
76+
}
77+
);
78+
})
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { PackageMatrixVersion } from '../matrix/matrix-type';
2+
import { getIndividualVersionsForProject } from "../versions/get-versions-for-project";
3+
4+
export const getRecentVersions = (project: string, date: Date, durationStr: string): string[] => {
5+
const regex = /(?:(\d+)\s*y)?\s*(?:(\d+)\s*m)?\s*(?:(\d+)\s*d)?/i;
6+
const match = durationStr.match(regex);
7+
8+
if (!match) {
9+
throw new Error(`Invalid duration string: ${durationStr}`);
10+
}
11+
12+
const years = parseInt(match[1] || "0", 10);
13+
const months = parseInt(match[2] || "0", 10);
14+
const days = parseInt(match[3] || "0", 10);
15+
16+
const allVersions = getIndividualVersionsForProject(project)
17+
return Object.entries(<Record<string,PackageMatrixVersion>>allVersions)
18+
.filter(([key, value]) => {
19+
const dayOfRelease = new Date(value.release);
20+
dayOfRelease.setSeconds(dayOfRelease.getSeconds() + 1);
21+
const dateAfterRelease = new Date(value.release);
22+
23+
dateAfterRelease.setFullYear(dateAfterRelease.getFullYear() + years);
24+
dateAfterRelease.setMonth(dateAfterRelease.getMonth() + months);
25+
dateAfterRelease.setDate(dateAfterRelease.getDate() + days);
26+
27+
28+
return date >= dayOfRelease && date <= dateAfterRelease;
29+
})
30+
.map(([key, value]) => key);
31+
}

0 commit comments

Comments
 (0)