From 6e81ef96c7a0c8a1aa59554bf20ab202d7da4140 Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Sat, 25 Jun 2022 23:55:09 -0400 Subject: [PATCH] feat: add supported version matrix action (#6) --- .github/workflows/install.yaml | 55 +++++-------------- README.md | 1 + supported-version/README.md | 27 ++++++++++ supported-version/action.yml | 21 ++++++++ supported-version/supported.json | 90 ++++++++++++++++++++++++++++++++ 5 files changed, 153 insertions(+), 41 deletions(-) create mode 100644 supported-version/README.md create mode 100644 supported-version/action.yml create mode 100644 supported-version/supported.json diff --git a/.github/workflows/install.yaml b/.github/workflows/install.yaml index 3c4f2a6..dc4ab09 100644 --- a/.github/workflows/install.yaml +++ b/.github/workflows/install.yaml @@ -15,54 +15,27 @@ on: - README.md jobs: + compute_matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.supported-version.outputs.matrix }} + steps: + - uses: actions/checkout@v2 + - uses: ./supported-version + id: supported-version + - run: echo ${{ steps.supported-version.outputs.matrix }} + install-test: + needs: compute_matrix strategy: - matrix: - magento: - - 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 - include: - - - magento: magento/project-community-edition:>=2.3 <2.4 - php_version: 7.4 - composer_version: 1 - - - magento: magento/project-community-edition:>=2.4.0 <2.4.1 - php_version: 7.4 - composer_version: 1 - - - magento: magento/project-community-edition:>=2.4.1 <2.4.2 - php_version: 7.4 - composer_version: 1 - - - magento: magento/project-community-edition:>=2.4.2 <2.4.3 - php_version: 7.4 - composer_version: 2 - - - magento: magento/project-community-edition:>=2.4.3 <2.4.4 - php_version: 7.4 - composer_version: 2 - - - magento: magento/project-community-edition:>=2.4.4 <2.4.5 - php_version: 8.1 - composer_version: 2 - - - magento: magento/project-community-edition - composer_version: 2 - php_version: 8.1 - + matrix: ${{ fromJSON(needs.compute_matrix.outputs.matrix) }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: ./installation-test with: - composer_version: ${{ matrix.composer_version }} - php_version: ${{ matrix.php_version }} + composer_version: ${{ matrix.composer }} + php_version: ${{ matrix.php }} magento_version: ${{ matrix.magento }} composer_auth: ${{ secrets.COMPOSER_AUTH }} package_name: graycore/magento2-demo-package diff --git a/README.md b/README.md index 455a6b2..68a08ae 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Opinionated Github Actions and Workflows to make building, testing, and maintain | ------------------------------------------------ | ------------------------------------------------------------------ | | [Unit Test](./unit-test/README.md) | A Github Action that runs the Unit Tests a Magento Package | | [Installation Test](installation-test/README.md) | A Github Action that tests the installability of a Magento Package | +| [Supported Version](supported-version/README.md) | A Github Action that computes the currently supported Github Actions Matrix for Magento 2 | ### Action or Workflow? diff --git a/supported-version/README.md b/supported-version/README.md new file mode 100644 index 0000000..6f8cb5e --- /dev/null +++ b/supported-version/README.md @@ -0,0 +1,27 @@ +# Magento 2 Supported Versions + +A Github Action that computes the currently supported Github Actions Matrix for Magento 2 Versions + +All data comes from: + +- [v2.3](https://github.com/magento/devdocs/blob/master/src/_data/codebase/v2_3/system-requirements.yml) +- [v2.4](https://github.com/magento/devdocs/blob/master/src/_data/codebase/v2_4/system-requirements.yml) + +## Usage + +```yml +name: Compute Magento 2 Supported Versions + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + runs-on: ubuntu-latest + steps: + - uses: graycoreio/github-actions-magento2/supported-version@main +``` diff --git a/supported-version/action.yml b/supported-version/action.yml new file mode 100644 index 0000000..c35027a --- /dev/null +++ b/supported-version/action.yml @@ -0,0 +1,21 @@ +name: "Compute Supported Magento 2 Versions" +author: "Graycore" +description: "A Github Action that computes the Github Actions matrix for the currently supported versions of Magento 2" + +outputs: + matrix: + description: "The Github Actions matrix of software technologies required to run Magento." + value: ${{ steps.generate.outputs.matrix }} + +runs: + using: 'composite' + steps: + - run: | + content=`cat supported-version/supported.json | jq -c` + echo "::set-output name=matrix::$content" + shell: bash + id: generate + +branding: + icon: "code" + color: "green" diff --git a/supported-version/supported.json b/supported-version/supported.json new file mode 100644 index 0000000..bb4dd07 --- /dev/null +++ b/supported-version/supported.json @@ -0,0 +1,90 @@ +{ + "magento": [ + "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" + ], + "include": [ + { + "magento": "magento/project-community-edition:>=2.3 <2.4", + "php": 7.4, + "composer": 1, + "mysql": "mysql:5.7", + "elasticsearch": "elasticsearch:7.16.3", + "rabbitmq": "rabbitmq:3.8", + "redis": "redis:6.0", + "varnish": "varnish:6.0", + "nginx": "nginx:1.18" + }, + { + "magento": "magento/project-community-edition:>=2.4.0 <2.4.1", + "php": 7.4, + "composer": 1, + "mysql": "mysql:5.7", + "elasticsearch": "elasticsearch:7.6.2", + "rabbitmq": "rabbitmq:3.8", + "redis": "redis:5.0", + "varnish": "varnish:6.0", + "nginx": "nginx:1.18" + }, + { + "magento": "magento/project-community-edition:>=2.4.1 <2.4.2", + "php": 7.4, + "composer": 1, + "mysql": "mysql:8.0", + "elasticsearch": "elasticsearch:7.7.1", + "rabbitmq": "rabbitmq:3.8", + "redis": "redis:5.0", + "varnish": "varnish:6.0", + "nginx": "nginx:1.18" + }, + { + "magento": "magento/project-community-edition:>=2.4.2 <2.4.3", + "php": 7.4, + "composer": 2, + "mysql": "mysql:8.0", + "elasticsearch": "elasticsearch:7.9.3", + "rabbitmq": "rabbitmq:3.8", + "redis": "redis:6.0", + "varnish": "varnish:6.0", + "nginx": "nginx:1.18" + }, + { + "magento": "magento/project-community-edition:>=2.4.3 <2.4.4", + "php": 7.4, + "composer": 2, + "mysql": "mysql:8.0", + "elasticsearch": "elasticsearch:7.16.3", + "rabbitmq": "rabbitmq:3.8", + "redis": "redis:6.0", + "varnish": "varnish:6.0", + "nginx": "nginx:1.18" + }, + { + "magento": "magento/project-community-edition:>=2.4.4 <2.4.5", + "php": 8.1, + "composer": 2, + "mysql": "mysql:8.0", + "elasticsearch": "elasticsearch:7.16.3", + "rabbitmq": "rabbitmq:3.9", + "redis": "redis:6.2", + "varnish": "varnish:7.0", + "nginx": "nginx:1.18" + }, + { + "magento": "magento/project-community-edition", + "php": 8.1, + "composer": 2, + "mysql": "mysql:8.0", + "elasticsearch": "elasticsearch:7.16.3", + "rabbitmq": "rabbitmq:3.9", + "redis": "redis:6.2", + "varnish": "varnish:7.0", + "nginx": "nginx:1.18" + } + ] +} \ No newline at end of file