Skip to content

Commit 6e81ef9

Browse files
authored
feat: add supported version matrix action (#6)
1 parent 984dda3 commit 6e81ef9

File tree

5 files changed

+153
-41
lines changed

5 files changed

+153
-41
lines changed

.github/workflows/install.yaml

Lines changed: 14 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,54 +15,27 @@ on:
1515
- README.md
1616

1717
jobs:
18+
compute_matrix:
19+
runs-on: ubuntu-latest
20+
outputs:
21+
matrix: ${{ steps.supported-version.outputs.matrix }}
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: ./supported-version
25+
id: supported-version
26+
- run: echo ${{ steps.supported-version.outputs.matrix }}
27+
1828
install-test:
29+
needs: compute_matrix
1930
strategy:
20-
matrix:
21-
magento:
22-
- magento/project-community-edition:>=2.3 <2.4
23-
- magento/project-community-edition:>=2.4.0 <2.4.1
24-
- magento/project-community-edition:>=2.4.1 <2.4.2
25-
- magento/project-community-edition:>=2.4.2 <2.4.3
26-
- magento/project-community-edition:>=2.4.3 <2.4.4
27-
- magento/project-community-edition:>=2.4.4 <2.4.5
28-
- magento/project-community-edition
29-
include:
30-
31-
- magento: magento/project-community-edition:>=2.3 <2.4
32-
php_version: 7.4
33-
composer_version: 1
34-
35-
- magento: magento/project-community-edition:>=2.4.0 <2.4.1
36-
php_version: 7.4
37-
composer_version: 1
38-
39-
- magento: magento/project-community-edition:>=2.4.1 <2.4.2
40-
php_version: 7.4
41-
composer_version: 1
42-
43-
- magento: magento/project-community-edition:>=2.4.2 <2.4.3
44-
php_version: 7.4
45-
composer_version: 2
46-
47-
- magento: magento/project-community-edition:>=2.4.3 <2.4.4
48-
php_version: 7.4
49-
composer_version: 2
50-
51-
- magento: magento/project-community-edition:>=2.4.4 <2.4.5
52-
php_version: 8.1
53-
composer_version: 2
54-
55-
- magento: magento/project-community-edition
56-
composer_version: 2
57-
php_version: 8.1
58-
31+
matrix: ${{ fromJSON(needs.compute_matrix.outputs.matrix) }}
5932
runs-on: ubuntu-latest
6033
steps:
6134
- uses: actions/checkout@v2
6235
- uses: ./installation-test
6336
with:
64-
composer_version: ${{ matrix.composer_version }}
65-
php_version: ${{ matrix.php_version }}
37+
composer_version: ${{ matrix.composer }}
38+
php_version: ${{ matrix.php }}
6639
magento_version: ${{ matrix.magento }}
6740
composer_auth: ${{ secrets.COMPOSER_AUTH }}
6841
package_name: graycore/magento2-demo-package

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Opinionated Github Actions and Workflows to make building, testing, and maintain
1818
| ------------------------------------------------ | ------------------------------------------------------------------ |
1919
| [Unit Test](./unit-test/README.md) | A Github Action that runs the Unit Tests a Magento Package |
2020
| [Installation Test](installation-test/README.md) | A Github Action that tests the installability of a Magento Package |
21+
| [Supported Version](supported-version/README.md) | A Github Action that computes the currently supported Github Actions Matrix for Magento 2 |
2122

2223
### Action or Workflow?
2324

supported-version/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Magento 2 Supported Versions
2+
3+
A Github Action that computes the currently supported Github Actions Matrix for Magento 2 Versions
4+
5+
All data comes from:
6+
7+
- [v2.3](https://github.com/magento/devdocs/blob/master/src/_data/codebase/v2_3/system-requirements.yml)
8+
- [v2.4](https://github.com/magento/devdocs/blob/master/src/_data/codebase/v2_4/system-requirements.yml)
9+
10+
## Usage
11+
12+
```yml
13+
name: Compute Magento 2 Supported Versions
14+
15+
on:
16+
push:
17+
branches:
18+
- main
19+
pull_request:
20+
branches:
21+
- main
22+
23+
jobs:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: graycoreio/github-actions-magento2/supported-version@main
27+
```

supported-version/action.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: "Compute Supported Magento 2 Versions"
2+
author: "Graycore"
3+
description: "A Github Action that computes the Github Actions matrix for the currently supported versions of Magento 2"
4+
5+
outputs:
6+
matrix:
7+
description: "The Github Actions matrix of software technologies required to run Magento."
8+
value: ${{ steps.generate.outputs.matrix }}
9+
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- run: |
14+
content=`cat supported-version/supported.json | jq -c`
15+
echo "::set-output name=matrix::$content"
16+
shell: bash
17+
id: generate
18+
19+
branding:
20+
icon: "code"
21+
color: "green"

supported-version/supported.json

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"magento": [
3+
"magento/project-community-edition:>=2.3 <2.4",
4+
"magento/project-community-edition:>=2.4.0 <2.4.1",
5+
"magento/project-community-edition:>=2.4.1 <2.4.2",
6+
"magento/project-community-edition:>=2.4.2 <2.4.3",
7+
"magento/project-community-edition:>=2.4.3 <2.4.4",
8+
"magento/project-community-edition:>=2.4.4 <2.4.5",
9+
"magento/project-community-edition"
10+
],
11+
"include": [
12+
{
13+
"magento": "magento/project-community-edition:>=2.3 <2.4",
14+
"php": 7.4,
15+
"composer": 1,
16+
"mysql": "mysql:5.7",
17+
"elasticsearch": "elasticsearch:7.16.3",
18+
"rabbitmq": "rabbitmq:3.8",
19+
"redis": "redis:6.0",
20+
"varnish": "varnish:6.0",
21+
"nginx": "nginx:1.18"
22+
},
23+
{
24+
"magento": "magento/project-community-edition:>=2.4.0 <2.4.1",
25+
"php": 7.4,
26+
"composer": 1,
27+
"mysql": "mysql:5.7",
28+
"elasticsearch": "elasticsearch:7.6.2",
29+
"rabbitmq": "rabbitmq:3.8",
30+
"redis": "redis:5.0",
31+
"varnish": "varnish:6.0",
32+
"nginx": "nginx:1.18"
33+
},
34+
{
35+
"magento": "magento/project-community-edition:>=2.4.1 <2.4.2",
36+
"php": 7.4,
37+
"composer": 1,
38+
"mysql": "mysql:8.0",
39+
"elasticsearch": "elasticsearch:7.7.1",
40+
"rabbitmq": "rabbitmq:3.8",
41+
"redis": "redis:5.0",
42+
"varnish": "varnish:6.0",
43+
"nginx": "nginx:1.18"
44+
},
45+
{
46+
"magento": "magento/project-community-edition:>=2.4.2 <2.4.3",
47+
"php": 7.4,
48+
"composer": 2,
49+
"mysql": "mysql:8.0",
50+
"elasticsearch": "elasticsearch:7.9.3",
51+
"rabbitmq": "rabbitmq:3.8",
52+
"redis": "redis:6.0",
53+
"varnish": "varnish:6.0",
54+
"nginx": "nginx:1.18"
55+
},
56+
{
57+
"magento": "magento/project-community-edition:>=2.4.3 <2.4.4",
58+
"php": 7.4,
59+
"composer": 2,
60+
"mysql": "mysql:8.0",
61+
"elasticsearch": "elasticsearch:7.16.3",
62+
"rabbitmq": "rabbitmq:3.8",
63+
"redis": "redis:6.0",
64+
"varnish": "varnish:6.0",
65+
"nginx": "nginx:1.18"
66+
},
67+
{
68+
"magento": "magento/project-community-edition:>=2.4.4 <2.4.5",
69+
"php": 8.1,
70+
"composer": 2,
71+
"mysql": "mysql:8.0",
72+
"elasticsearch": "elasticsearch:7.16.3",
73+
"rabbitmq": "rabbitmq:3.9",
74+
"redis": "redis:6.2",
75+
"varnish": "varnish:7.0",
76+
"nginx": "nginx:1.18"
77+
},
78+
{
79+
"magento": "magento/project-community-edition",
80+
"php": 8.1,
81+
"composer": 2,
82+
"mysql": "mysql:8.0",
83+
"elasticsearch": "elasticsearch:7.16.3",
84+
"rabbitmq": "rabbitmq:3.9",
85+
"redis": "redis:6.2",
86+
"varnish": "varnish:7.0",
87+
"nginx": "nginx:1.18"
88+
}
89+
]
90+
}

0 commit comments

Comments
 (0)